Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Naming edges via iLogic

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
harvey_craig2RCUH
200 Views, 3 Replies

Naming edges via iLogic

harvey_craig2RCUH
Advocate
Advocate

In a part document can an entity be named via iLogic. I have accessed an edge like so:

oDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
oCompDef.SurfaceBodies.Item(1).Edges.Item(1)

it would make sense for me to then add on:

.Name("myFirstEdge")

However this isn't an option. Is this something I can do? 

0 Likes

Naming edges via iLogic

In a part document can an entity be named via iLogic. I have accessed an edge like so:

oDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
oCompDef.SurfaceBodies.Item(1).Edges.Item(1)

it would make sense for me to then add on:

.Name("myFirstEdge")

However this isn't an option. Is this something I can do? 

3 REPLIES 3
Message 2 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @harvey_craig2RCUH.  Try this:

Dim Doc As Inventor.Document = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oEdge As Edge = oCompDef.SurfaceBodies.Item(1).Edges.Item(1)
Dim oNEs As NamedEntities = iLogicVb.Automation.GetNamedEntities(Doc)
oNEs.SetName(oEdge, "Edge Name")

You can also access this special iLogic only resource through the following:

ThisDoc.NamedEntities

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Hi @harvey_craig2RCUH.  Try this:

Dim Doc As Inventor.Document = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oEdge As Edge = oCompDef.SurfaceBodies.Item(1).Edges.Item(1)
Dim oNEs As NamedEntities = iLogicVb.Automation.GetNamedEntities(Doc)
oNEs.SetName(oEdge, "Edge Name")

You can also access this special iLogic only resource through the following:

ThisDoc.NamedEntities

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

harvey_craig2RCUH
Advocate
Advocate

Cheers Wesley, problem solved!

0 Likes

Cheers Wesley, problem solved!

Message 4 of 4

WCrihfield
Mentor
Mentor

Just be aware that the iLogic term 'ThisDoc' may be accessing a different document than the phrase 'ThisApplication.ActiveDocument ' in some situations.  That is why there is two different ways to access that NamedEntities object.  We can also do the same task using Inventor API code, instead of iLogic API code, but it requires more code.  When you assign a name to a Face, Edge, or Vertex using the manual 'Assign Name' tool (in parts only - right-click menu, when one is selected), or by using the iLogic NamedEntities methods, this is essentially just creating an AttributeSet on that object (within its AttributeSets collection), then creating an Attribute within that AttributeSet, with a String ValueType value, and the supplied name as the Value of that Attribute.  We can also find these objects using the AttributesManager object that we can get from the owning Document object (Document.AttributeManager).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Just be aware that the iLogic term 'ThisDoc' may be accessing a different document than the phrase 'ThisApplication.ActiveDocument ' in some situations.  That is why there is two different ways to access that NamedEntities object.  We can also do the same task using Inventor API code, instead of iLogic API code, but it requires more code.  When you assign a name to a Face, Edge, or Vertex using the manual 'Assign Name' tool (in parts only - right-click menu, when one is selected), or by using the iLogic NamedEntities methods, this is essentially just creating an AttributeSet on that object (within its AttributeSets collection), then creating an Attribute within that AttributeSet, with a String ValueType value, and the supplied name as the Value of that Attribute.  We can also find these objects using the AttributesManager object that we can get from the owning Document object (Document.AttributeManager).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

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

Post to forums  

Autodesk Design & Make Report