How to extract features from Solidwork API?

Discussion in 'SolidWorks' started by syshieley, Jul 10, 2006.

  1. syshieley

    syshieley Guest

    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.
    :)
     
    syshieley, Jul 10, 2006
    #1
  2. syshieley

    Heikki Leivo Guest

    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-
     
    Heikki Leivo, Jul 10, 2006
    #2
  3. syshieley

    JJ Guest

    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
    www.studiozwaard.nl
     
    JJ, Jul 12, 2006
    #3
  4. syshieley

    syshieley Guest

    thanks so much guys

    i will try it and come back to you later

    thanks
     
    syshieley, Jul 13, 2006
    #4
  5. syshieley

    syshieley Guest

    thanks so much guys

    i will try it and come back to you later

    thanks
     
    syshieley, Jul 13, 2006
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.