How to extract features from Solidwork API?

Dear all,

i can use SolidWorks well, but new to SolidWorks API. What i want to do is to extract the features from the existing SolidWorks models? In UG, the users can design the part using the features such as the block, the hole, the chamfer and it is easy to extract the composed features name and the features' dimensions. But in SolidWorks, the modelling process is based on Sketh and then create the

3D model using extruding, revolving or swepting process, is it possible to get the block, hole or chamfer features information from the ready solidwork part? From the feature manager design tree, the features in SolidWorks are called extrude1, extrude2....is there any other method to get the information about features such block, hole or cylinder which are composed of the part?

In fact what i want to do is not extracting the features but want to change any dimension of any features of the part and then update the part automatically, but not as what to do to edit the part in SolidWorks in which we have to edit the sketch dimension first and then roll forward again and again. To tract the block, cylinder features from the part is the first step for me to change the dimension and update the solid model afterward, infact, it is still not easy to carry on the next step.

Really hope someone who has done the similar job can give me some hint to help me to go on with the work.

thanks very much, hope i have expressed myself well and you can understand what i want to do. :)

Reply to
syshieley
Loading thread data ...

Hello,

You can use ModelDoc::FirstFeature method to get the first feature of the model (!). You can then use various methods of the Feature object to extract information about the feature. You can, for example, determine feature type by callin Feature::GetTypeName, get feature type specific data by calling Feature::GetDefinition, and Configuration::GetParameters to get list of model parameters. Every piece of detail is quite well documented including various examples in the API help, so happy reading!

-h-

Reply to
Heikki Leivo

Hello,

You can use this one:

Set swapp = createobject("sldworks.application")

Set swModel = swapp.ActiveDoc

Set swfeat = swModel.FirstFeature While Not swfeat Is Nothing 'Debug.Print swfeat.Name & " - " & swfeat.GetTypeName

Set swfeat = swfeat.GetNextFeature Wend

Kind regards,

JJ

formatting link

Reply to
JJ

thanks so much guys

i will try it and come back to you later

thanks

Reply to
syshieley

thanks so much guys

i will try it and come back to you later

thanks

Reply to
syshieley

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.