Hi,
I need to get the Entity ID of a Face, Edge or Vertex and store it for later use.
I've made an Add-In program in Visual Studio that let the user pick an edge from the model and I want the program to create a Fixed constraint at the given entity. The constraint is created with iLogic and it need the entity ID as an input.
The code I made is shown below:
------------------------------------------------------------------------------------------------------------------------
Imports Autodesk.iLogic.Interfaces
Imports Inventor
Private Sub Pick_Faces()
' Dim Varibles etc
Dim oEdge As Edge
Dim strCmdForConstraint As String
Dim ID As Integer
MsgBox("Select Edges for Fixed-Constraints, Press ESC to Continue")
Do
' Let the User select an Edge
oEdge = g_inventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeCircularFilter, "Pick a Edge") 'kAllEntitiesFilter kPartEdgeCircularFilter
' Get the ID of the Edge
ID = THE EDGE ID
' Define a Constraint at the given Edge ID
If Not oEdge Is Nothing Then
strCmdForConstraint = "<Constraint Name=""Fixed Constraint"" " &
"ID = ""1"" Type=""0"" " &
"CoordinateSystemID=""0"" " &
"Tx=""1"" Ty=""1"" Tz=""1"" Rx=""1"" Ry=""1"" Rz=""1"" " &
"EntitiesCount=""5"" " &
"ArrowLength=""50"" ArrowColor=""14803200"" " &
"DisplayDensity=""4"" " &
"SubcaseCount=""1"" Subcases=""1""> " &
"<Entity1 GeometryType=""1"" GeometryID=""" & ID & """ ComponentName=""""/></Constraint>"
'Create Constraint
Nastran_AddinObj.Run(strCmdForConstraint)
End If
Loop While Not oEdge Is Nothing
End Sub
------------------------------------------------------------------------------------------------------------------------
Is there a way to get the ID from the selected edge of the user? (The orange line above in the code)
Regards
Perra
Faces, Edges, and Vertices don't have a simple ID. I don't know what Nastran is expecting for that input. Is there some documentation that describes what's expected. Maybe you need to somehow name the entity first?
Hi, thanks for responding!
Nastran expects an answer as an integer (in my case around 1 to 5).
Here are some documentation:
and
http://help.autodesk.com/view/NINCAD/2019/ENU/?guid=GUID-1B3F560D-C41A-4A13-8379-4035B97A7A37
I will try your suggestion and name the edge first and then implement it in the code!
/ Perra
Unfortunately it seems that Nastran In-CAD only accepts integers as Entity ID.
I couldn't name the entity and refer to it in the code.
Thank You for your interest!
Their documentation for this is also worthless. My guess is that they're using the index within the array of whatever type of entity it is. Since one of the arguments specifies if it's a face, edge, vertex or sketch, if you say you have a Face of ID 6 then maybe they're iterating through the collection of faces on the body and using the 6th one. That's just a guess and you'll have to experiment a bit to see if that is what they're doing but since there's not a real ID for those entities, that's all I can think of.
I found a video were a guy named Chris have done it the same way I want it!
Now I just need to figure it out how the code works.
Will try to contact him!
Hey @Anonymous ,
Not sure whether this is what you need. From Inventor 2019, iLogic provided a function to assign name to b-rep entities. After being assigned name, the name of the entity is stored in AttributeSet itself which can be used to find it.
Hi Anonymous,
I do have the same issue to get a linear simulation automated running.
Did you already solved the problem or got an answer from Chris Atherton regarding the faceID?
Best regards
Tobias
Can't find what you're looking for? Ask the community or share your knowledge.