How to know Specific Object After Using kAllEntitiesFilter

How to know Specific Object After Using kAllEntitiesFilter

dgreatice
Collaborator Collaborator
668 Views
3 Replies
Message 1 of 4

How to know Specific Object After Using kAllEntitiesFilter

dgreatice
Collaborator
Collaborator

Hi expert,

 

Can help me for find, how to know the selected object is a specific filter object, I am also confused how to make this question understandable. in this code I want to specify, whether the object I choose is a custom table or partslist table or revision table?

 

After I know the type of object, there is another code that I have prepared.

 

I have trouble knowing how to know what object, when using (kAllEntitiesFilter).

I vba macro in Inventor 2014.

 

 

Dim oDwgDoc As DrawingDocument
Set oDwgDoc = ThisApplication.ActiveDocument

 

Public Sub ChooseTableToEdit()

 

Dim oSheet As Sheet
Set oSheet = oDwgDoc.ActiveSheet

 

Dim CMDMan As CommandManager
Set CMDMan = ThisApplication.CommandManager

 

Dim TableObj As Object
Set TableObj = CMDMan.Pick(kAllEntitiesFilter, "Select any table")

 

If TableObj = kDrawingCustomTableFilter Then
    MsgBox ("You want edit Custom table Table?")

    'Next my code
ElseIf TableObj = kDrawingPartsListFilter Then
    MsgBox ("You want to edit Part List Table?")

    'Next my code
ElseIf TableObj = kDrawingRevisionTableFilter Then
    MsgBox ("You want to edit Revision Table?")

    'Next my code
End If

 

End Sub

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
669 Views
3 Replies
Replies (3)
Message 2 of 4

MechMachineMan
Advisor
Advisor

You can't figure out what filter it was selected with as the Pick Method returns the object

 

Instead you need to use the SelectedObject.TYPE property to find the type of the object you selected.

 

It should return a number/enum that corresponds with inventor's ObjectTypeEnum.

 

If the object returns as kGenericObject, I believe that means you are out of luck.


--------------------------------------
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 4

dgreatice
Collaborator
Collaborator

Hi,

 

did you mean like this?, can you help me with sample from my code. The red text was still error, because i dont know to set ObjectTypeEnum to specific class.

 

Dim oDwgDoc As DrawingDocument
Set oDwgDoc = ThisApplication.ActiveDocument

 

Public Sub ChooseTableToEdit()

 

Dim oSheet As Sheet
Set oSheet = oDwgDoc.ActiveSheet

 

Dim CMDMan As CommandManager
Set CMDMan = ThisApplication.CommandManager

 

Dim TableObj As Object
Set TableObj = CMDMan.Pick(kAllEntitiesFilter, "Select any table")

 

Dim oCusTab As CustomTable
Dim oPartList As PartsList
Dim oRevTab As RevisionTable

 

If TableObj.Type = 117461248 Then
    MsgBox ("You want edit Custom table Table?")

    Set oCustTab = TableObj


ElseIf TableObj.Type = 117444096 Then
    MsgBox ("You want to edit Part List Table?")

    set oPartList = TableObj


ElseIf TableObj.Type = 117466624 Then
    MsgBox ("You want to edit Revision Table?")

    set oRevTab = TableObj


End If

 

End Sub

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 4 of 4

MechMachineMan
Advisor
Advisor

You could still use the same TableObj... you don't need to redefine it. But it should be identifying the proper type of item for you now, right?


--------------------------------------
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