Moldflow Insight Forum
Welcome to Autodesk’s Moldflow Insight Forums. Share your knowledge, ask questions, and explore popular Moldflow Insight topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Beams using the API

2 REPLIES 2
Reply
Message 1 of 3
_JoThu_
437 Views, 2 Replies

Create Beams using the API

Hello,

 

I want to use the API to create some beam elements and to assign all elements that have been created to a certain layer. But besides of creating beams, the feature also creates curves and nodes, which I cannot access.

 

Below you can find simplified code to get a better understanding:

'Create layer
Set TestLayer = Synergy.LayerManager.CreateLayerByName ("Test Layer")

'Prepare beam creation
Set Vector = Synergy.CreateVector()
Vector.SetXYZ 0, 0, 0
Set Vector_1 = Synergy.CreateVector()
Vector_1.SetXYZ 0, 0, 150
Set MeshEditor = Synergy.MeshEditor()
Set Prop = MeshEditor.FindProperty(40420, 1)

'Create beams -> Output: EntList with created beam elements
Set EntList_Beams = MeshEditor.CreateBeamsByPoints(Vector, Vector_1, 10, Prop)

'Assign beam elements to layer
Synergy.LayerManager.AssignToLayer EntList_Beams, TestLayer

 

So far, everything works fine.

As the code shows, the return of CreateBeamsByPoints is a EntList with created beam elements, which makes it very easy to assign them to a layer. Unfortunately the curves and nodes which are created during this process as well, are not part of this EntList.

 

Do you have an idea how to get a EntList with these curves and nodes?

 

Thanks in advance for your support and

best regardes

 

Jochen

Tags (2)
Labels (1)
  • API
2 REPLIES 2
Message 2 of 3
M.Brassel
in reply to: _JoThu_

Hello @_JoThu_ ,

I think you could create a layer and make it active. So the new end nodes should be created in the active layer.

 

Here is a workflow that might help:

  • Also you could examine your highest node ID or curve ID.
  • So you know the IDs of all your newly created nodes, depending on the number of elements you created. The number of curves depends on how often you repeat your step of creating beams.
  • Then you could create an entity list containing these node IDs or curve IDs. Here are some examples:
    • EntList.SelectFromString "N18 N23"
    • Set Predicate1 = PredicateManager.CreateLabelPredicate("N23:N100")
      EntList.SelectFromPredicate Predicate1 
  • Then you could assign these nodes or curves to a specific layer as you did with the beams before.

I wish you fun and success with your programming task.

--
Please use "accept as solution", so others may find solutions quickly. Also give kudos where suitable to further enhance these forums.
Message 3 of 3
_JoThu_
in reply to: M.Brassel

Hello @M.Brassel ,

 

thanks for giving me a new approach to solve this.

 

I will test it and come back to you.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report