VB.net Find Face by face name.

VB.net Find Face by face name.

aaron_lucy
Contributor Contributor
1,823 Views
5 Replies
Message 1 of 6

VB.net Find Face by face name.

aaron_lucy
Contributor
Contributor

I just got Inventor 2019 and i am trying to automate the process of selecting faces and exporting them to a .dxf file.  Does anyone have an example in .net of selecting faces by the faces "Assigned Name"?

0 Likes
1,824 Views
5 Replies
Replies (5)
Message 2 of 6

MechMachineMan
Advisor
Advisor

I've looked through the online programming help and can't see anything about grabbing the face names...


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 6

BrianEkins
Mentor
Mentor

What do you mean by "Assigned Name"?  Faces don't have a name.  However, API attributes are commonly used as a way to associate information with a face and that information can be used later to find that face again.  Essentially, using attributes as a way to name a face.  

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 4 of 6

MechMachineMan
Advisor
Advisor

@BrianEkins

 

Looks like a new addition to the UI for 2019...

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2019...


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 5 of 6

BrianEkins
Mentor
Mentor

@MechMachineMan, thanks for pointing this out.  I know they had been talking about providing this capability as part of iLogic but I didn't know it had gone into the product.

 

Regarding the original question, I took a look at this and the iLogic naming is using API attributes to implement it.  Remember that iLogic is an add-in and is using the same API functionality that everyone else is to provide its functionality.  Here's some code that will return a Face or Edge object that has the specified name.

 

Public Sub GetNameTest()
    Dim doc As PartDocument = ThisApplication.ActiveDocument
    Dim faceOrEdge As Object = GetNamedEntity(doc, "Brian")
End Sub


Public Function GetNamedEntity(doc As Inventor.Document, name As String) As Object
    Dim attribMgr As AttributeManager = doc.AttributeManager
    Dim objsFound As ObjectCollection
    objsFound = attribMgr.FindObjects("iLogicEntityNameSet", "iLogicEntityName", name)
    
    If objsFound.Count > 0 Then
        Return(objsFound.Item(1))
    Else
        Return(Nothing)
    End If
End Function

The AttributeManager utility provides a good view of what's going on.

 

 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 6 of 6

aaron_lucy
Contributor
Contributor

Thanks @BrianEkins.  That was exactly what i needed!

0 Likes