Software Use > Scripting

Setting Concepts in the COM


I saw in an old thread from March 2011 that changing a group's concept was not supported by the COM. Is this still the case?

Yes you can do this.

All the check boxes in the Concepts tab correspond to "Group Options". In the object model you can set these using the Group.GroupOption property. The option IDs are not published in the API, but they are attached in the sample script.

Here's an example in Python. The VB code is the same except you use "oGroup.GroupOption(Unstiff_One_stack) = False" instead of the group.SetOption(Unstiff_One_stack, False) syntax.

--- Code: ---# Group Options IDs - Family-based
Unstiff_One_stack = 1
Unstiff_Two_stack = 2
Unstiff_Three_stack = 3
Unstiff_Honeycomb_sandwich = 4
Unstiff_Foam_sandwich = 5
Unstiff_Link_facesheet_top_and_bottom_stack_materials = 6

for group in project.Groups:
    if group.Family == bpfUnstiffenedPlateSandwichPanelFamily:
        print (group.GroupName)
        # Setup honeycomb sandwich
        group.SetGroupOption(Unstiff_One_stack, False)
        group.SetGroupOption(Unstiff_Two_stack, False)
        group.SetGroupOption(Unstiff_Three_stack, False)
        group.SetGroupOption(Unstiff_Honeycomb_sandwich, True) # Enable honeycomb
        group.SetGroupOption(Unstiff_Foam_sandwich, False)
        group.SetGroupOption(Unstiff_Link_facesheet_top_and_bottom_stack_materials, True)

--- End code ---

This method of setting concepts is valid for Versions 6.4 and below. However this method will be changing in the next (major) version release.


In 7.0, this method has been replaced by the Group.SetConcepts() method.

--- Code: ---conceptIds = [ bpcOneStack ] # Define an array of concept IDs using the BeamPanelConcept (bpc) enumeration.
group.SetConcepts(conceptIds) # group.Save() is not necessary. Changes are immediately applied to the database.
--- End code ---



[0] Message Index

Go to full version