News: Contact us to upgrade your software!

Author Topic: Setting Concepts in the COM  (Read 43094 times)

cfriedland5

  • Client
  • **
  • Posts: 18
    •  
Setting Concepts in the COM
« on: August 01, 2013, 01:37:16 PM »
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?

Ryan

  • Administrator
  • *****
  • Posts: 145
    •  
Re: Setting Concepts in the COM
« Reply #1 on: August 02, 2013, 12:00:50 PM »
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: [Select]
# 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)
        group.Save()


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.

-Ryan

Ryan

  • Administrator
  • *****
  • Posts: 145
    •  
Re: Setting Concepts in the COM
« Reply #2 on: January 06, 2015, 08:52:49 PM »
In 7.0, this method has been replaced by the Group.SetConcepts() method.

Code: [Select]
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.

-Ryan