News: Need training? HyperSizer Training Videos are available now! Learn more here: https://hypersizer.com/trainingevents/e-learning/

Author Topic: How to create new component via VBA? No ComponentCol.Create method exists.  (Read 66813 times)

Usr182x

  • Client
  • **
  • Posts: 1
    •  
Is there method of creating a new component similar to how a new assembly can be created with AssemblyCol.Create()?  Neither classes (Component or ComponentCol) have a "New()" or ".Create" method.  Is there a trick to it or is it impossible to do via scripting?

I'm wanting to create components similar to the way you can use the FEM Viewer GUI by selecting menu items Component -> Create Using FEM Viewer (by element).  I would like to use Excel to create components by using [Component Name, Component ID, Element ID List].  The FEM Viewer allows a user to define a component with nothing but these three variables.

Thank you.

James

  • Administrator
  • *****
  • Posts: 286
    •  
There is not a 'create component' method. Creating and editing component membership touches too many database tables.

A work around is to create assemblies, by element, through the FEM viewer > Assembly > Create multiple assemblies by specifying input files...

The input files can be comma-separated lists of elements. A unique assembly will be created for each input file selected. When elements that are members of the same component are split into multiple assemblies, new components are created to enforce the rule that components can only live in one assembly. After this process is run you could reassign the new components to the original assemblies using the VBA script.

I hope this is helpful.

-James