Get the Entity ID of a Face/Edge/Vert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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