Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API Routine needed (please)

Status
Not open for further replies.

Bootneck

Automotive
Aug 7, 2001
3
0
0
GB

I am trying to produce a simple CAPP program for an assignment at university, but have hit a brick wall. I need to be able to capture the features and their associated information (Type, dia, length, width, depth, etc) using an API routine, that I can then import/link into an Access database. Is there anyone out there that can help me or at least steer me in the right direction. I have tried to use a design table, but this process requires too much manual input, and as a result it is not reliable.
PLEASE HELP ME!!

 
Replies continue below

Recommended for you

This is all going to depend on the features that you want information from. Your question is not detailed enough to provide a sample, but here is some of the methodology you may need to use.

Method 1:
If you are simply trying to extract dimensions and custom properties from a part, drawing or assembly, you can use the GetSystemValue2 and GetCustomInfo methods to retrieve the values.

Method 2:
If the user is going to select the feature, then you can use the SelectionManager method in conjunction with the GetSelectObjects3 method to trap the selected object. From there, you can extract the properties of the features. If this is all going to be automatic, you will have to traverse through the design tree, capturing the information you want.

You may have to validate the geometry of the selected item using the GetSelectedObjectType2 method which references the swSelectType_e enumeration.

Once you have identified the feature, you can use the individual feature objects to extract the information.

Needless to say, this can be quite a hefty task. There should be plenty of examples in the SolidWorks API Help that can help you through the process.
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Dis
Firstly thankyou for such a prompt reply.

Secondly, in answer to your question, The type of features I will need to carry out this assignment are Holes, Pockets, Steps, Boss, Rib, Fillet, Chamfer, ect (these I have classified as Main Features) the next type of information I would need to know is the type of sub Feature (Through, Blind, composite, Isolated or Chain) once i have been able to establish what is what, i will then need to obtain the relevant dims associated with each sub feature. Hope this makes my initial enquiry/plea a little more easier to understand.

As for now, I will attempt to write some form of API routine using the information you have so kindly supplied. (although I'm dreading it a little due to the fact that the only programming I have done to any extent has been with AutoLISP)
 
Bootneck:

Looks like you have a pretty large task ahead. If these features are consistantly labeled in the design tree, it would be much easier to traverse through that. Then, once you hit a particular feature, you can get the values you need. There are several samples in the SolidWorks install that illustrate the process of traversing through the design tree. Unfortunately, this project is going to take some significant time. Needless to say, I don't have that much free time to whip up a solution for you. However, if you have any specific questions while progressing through this project, just post them here. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Status
Not open for further replies.
Back
Top