[iLogic] Open Drawing First View Model iProperties

[iLogic] Open Drawing First View Model iProperties

JoãoASilva
Advocate Advocate
1,294 Views
13 Replies
Message 1 of 14

[iLogic] Open Drawing First View Model iProperties

JoãoASilva
Advocate
Advocate

Hello Everyone!

 

I'm trying to open the iProperties window of a model (part or assembly), while on a drawing.

This is the current code:

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet

Dim oDrawingView As DrawingView
oDrawingView = oSheet.DrawingViews.Item(1)

 I don't know how, using iLogic, I could select the model in the view.

After that, I could just launch the window using:

Call ThisApplication.CommandManager.ControlDefinitions.Item("DrawingiPropertiesCmd").Execute

 

Any tips?

João Silva

Mechanical Engineer

 

0 Likes
1,295 Views
13 Replies
Replies (13)
Message 2 of 14

bradeneuropeArthur
Mentor
Mentor

Try this:

 

 

Public Sub main
	Dim a As Inventor.DrawingDocument = ThisDrawing.Document
	Dim b As Inventor.DrawingView = a.ActiveSheet.DrawingViews.Item(1)
	Dim rd As Inventor.Document = b.ReferencedDocumentDescriptor.ReferencedDocument
	Dim doc As Inventor.Document
	
	If rd.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then
		doc = ThisApplication.Documents.Open(rd.FullDocumentName, True)
		Call ThisApplication.CommandManager.ControlDefinitions.Item("PartiPropertiesCmd").Execute
	End If
	If rd.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
		doc = ThisApplication.Documents.Open(rd.FullDocumentName, True)
		Call ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyiPropertiesCmd").Execute
	End If

	
	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

Message 3 of 14

WCrihfield
Mentor
Mentor

Here's another route to do pretty much the same thing, using just that original command, without checking the model document's type, or specifically opening the model document.  In theory, if you have the drawing open, and that model document is being shown in the views, the model document is already loaded into memory, so you should be able to manipulate its iProperties.

This code simulates you right-clicking on the model's node under that drawing view in the model browser tree, then choosing iProperties.

Dim oView As DrawingView = ThisDrawing.Document.Sheets(1).DrawingViews(1)
Dim oRefDocDef As ComponentDefinition = oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition
Dim oMPane As BrowserPane = ThisDrawing.Document.BrowserPanes("Model")
Dim oNode As BrowserNode = oMPane.GetBrowserNodeFromObject(oRefDocDef)
oNode.DoSelect
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingiPropertiesCmd").Execute

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

JoãoASilva
Advocate
Advocate

@bradeneuropeArthur 

The code works, but not how I wanted.

The screencast below shows what I'm trying to do with iLogic:

 

https://knowledge.autodesk.com/community/screencast/f088567f-ea5a-4696-a4b0-479499596a6c

João Silva

Mechanical Engineer

 

0 Likes
Message 5 of 14

JoãoASilva
Advocate
Advocate

@WCrihfield 

This works well if the drawing only has 1 sheet.

But in a multisheet case, it opens the drawing iProperties.

 

I'll try to tweak the code a bit and get back to you.

João Silva

Mechanical Engineer

 

0 Likes
Message 6 of 14

bradeneuropeArthur
Mentor
Mentor

What is wrong with the code than?

You like to edit the i-properties from the model-file in the first drawing-view, correct?

 

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

JoãoASilva
Advocate
Advocate

@bradeneuropeArthur 

There is nothing wrong with your code. 😊

I think there is a faster way to do this (and lighter on the computer), instead of opening and closing the part/assembly.

If I'm not able to translate to iLogic what I can do manually, i'll go the route your code provides 👍

João Silva

Mechanical Engineer

 

0 Likes
Message 8 of 14

bradeneuropeArthur
Mentor
Mentor

What properties would like to edit?

creating a form with those is much easier than using the i-property dialog form inventor!

 

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 9 of 14

JoãoASilva
Advocate
Advocate

@bradeneuropeArthur 

We have forms, but sometimes one part goes to the drawing stage without beeing fully categorized.

It's way faster to open the iProperties than to open the part and launch the form.

Most of the times it is just missing a revision or a description.

 

Maybe i've got a strange case of iLogic and time saving addiction 😅

João Silva

Mechanical Engineer

 

0 Likes
Message 10 of 14

johan.degreef
Advisor
Advisor

I needed the same, but I found this to be the solution

https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=2843977258636952957&appLang=en&os=Win64

 

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
Message 11 of 14

WCrihfield
Mentor
Mentor

After you said something, I tested on a multi-page drawing too, and saw that you were right about it not working in that situation, for some odd reason.

So, I modified the code to now check the model's document type, then get its correct (non-generic) type of definition object, but still not open the model.  Then use that correct type of definition object as input for the browser node finder line.  Then select the node.  Then run the drawing version of the iProperties command.

This passed the multi-page problem for me, and shows the iProperties dialog for the model document, instead of for the drawing.

Dim oMPane As BrowserPane = ThisDrawing.Document.BrowserPanes("Model")
Dim oNode As BrowserNode
Dim oMDoc As Document = ThisDrawing.ModelDocument
If oMDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
	Dim oADoc As AssemblyDocument = oMDoc
	Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
	oNode = oMPane.GetBrowserNodeFromObject(oADef)
	oNode.DoSelect
	ThisApplication.CommandManager.ControlDefinitions.Item("DrawingiPropertiesCmd").Execute
ElseIf oMDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
	Dim oPDoc As PartDocument = oMDoc
	Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
	oNode = oMPane.GetBrowserNodeFromObject(oPDef)
	oNode.DoSelect
	ThisApplication.CommandManager.ControlDefinitions.Item("DrawingiPropertiesCmd").Execute
End If

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 12 of 14

JoãoASilva
Advocate
Advocate

@johan.degreef 

Thanks for the add in! But I think we can get there thru iLogic 😊

 

@WCrihfield 

Somehow it's not working for me...

Are you using Inventor 2021?

João Silva

Mechanical Engineer

 

0 Likes
Message 13 of 14

WCrihfield
Mentor
Mentor

Yes.  Inventor Pro 2021.1 on fully updated Windows 10 Enterprise 64bit Dell PC.

That last code I posted worked correctly on my multi-sheet drawing test document.

However, after opening several older multi-sheet drawing files and testing on some of them, it didn't work consistently every time, so it seems it is still not perfect.

Honestly, using an iLogic rule to do what there is already a fairly simple right-click solution for, doesn't seem very efficient though, since you pretty much have to click about the same amount to get to the iLogic tab, then to the rule, if you have a ton of rules to sift through, like I do.  Maybe a similar code would work better from a VBA macro, but I doubt it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 14 of 14

JoãoASilva
Advocate
Advocate

I didn't mention before, but I have a VBA template that allows me to launch a rule and add a button.

Almost every rule I have, I create a button, and then place it in my custom ribbon and/or right click radial menu.

 

So, for me, a rule is always faster (only 1 click) than having to browse thru anything.

 

I'll try to tweak and get back if I find anything useful 😉

João Silva

Mechanical Engineer

 

0 Likes