Why cannot get SelectionSet in DrawingSheet

Why cannot get SelectionSet in DrawingSheet

1354448288
Contributor Contributor
403 Views
2 Replies
Message 1 of 3

Why cannot get SelectionSet in DrawingSheet

1354448288
Contributor
Contributor

I used the following codes to get a SelectionSet from a drawing sheet, but I cannot get anything.  The Visual Studio send tips:  cannot make the System._ComObject to Inventor.SelectionSet.

Here are my code:

 

SelectSet selectSet = null;
            if (drawingDocument.SelectSet.Count == 0)
            {
                Console.WriteLine("Select a drawing view");
                //selectSet = inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view");
                selectSet = inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingSheetFilter, "Select drawing sheet!");
            }
            else
            {
                selectSet = drawingDocument.SelectSet;
            }

 

 

After running the codes, I choosed the red line, (of course, the other lines are banned to choose), and the Visual Studio send the message : cannot make the System._ComObject to Inventor.SelectionSet.

1.png

I am very confused about it. How should I get the SelectionSet?

 

0 Likes
Accepted solutions (1)
404 Views
2 Replies
Replies (2)
Message 2 of 3

bradeneuropeArthur
Mentor
Mentor

This will work:

Public Sub main()

Dim a As Object
Set a = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingSheetFilter, "Select drawing sheet!")


MsgBox a.Name
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 3

bradeneuropeArthur
Mentor
Mentor
Accepted solution

and this works too:

Public Sub main()

Dim a As SelectSet
Set a = ThisApplication.ActiveDocument.SelectSet
 a.Select(ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingSheetFilter, "Select drawing sheet!"))


MsgBox a.Item(1).Name
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature