ilogic code to execute Drawing View command to reorient view

ilogic code to execute Drawing View command to reorient view

juha.marttilaXAEZL
Explorer Explorer
396 Views
4 Replies
Message 1 of 5

ilogic code to execute Drawing View command to reorient view

juha.marttilaXAEZL
Explorer
Explorer
Hello Everyone,
Looking for iLogic code to activate "VIEW1" in drawing and execute the Drawing View
(like double clicking on drawing view) command so that I am able to reorient the view using the cube.

It seems like the code would include below?
ThisApplication.ActiveSheet.View("VIEW1")
CommandManager.ControlDefinitions.Item("DrawingBaseViewCmd").Execute

 

0 Likes
Accepted solutions (1)
397 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @juha.marttilaXAEZL.  I think the command you are looking for is "DrawingViewEditCtxCmd".  And to use that, you would first have to put that DrawingView object into the DrawingDocument.SelectSet, one way or another first.  Then execute the command.  But I am not sure you can add a DrawingView object directly into the SelectSet.  You may have to first get its BrowserNode, then use the BrowserNode.DoSelect, which will select that node for you, then execute that command.  You can get the BrowserNode using the DrawingDocument.BrowserPanes.Item("Model").GetBrowserNodeFromObject(oDrawingView).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

juha.marttilaXAEZL
Explorer
Explorer
Hi @WCrihfield, Thanks for the feedback
0 Likes
Message 4 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @juha.marttilaXAEZL ,

 

 

Here's an example:

' Set a reference to the select set.
Dim oSelectSet As SelectSet
oSelectSet = ThisApplication.ActiveDocument.SelectSet

Dim doc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = doc.ActiveSheet
For Each oView As DrawingView In oSheet.DrawingViews
	If oView.Name = "VIEW1" Then
		oSelectSet.Select(oView)
		ThisApplication.CommandManager.ControlDefinitions.Item("DrawingViewEditCtxCmd").Execute
		Return
	End If
Next

 I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 5 of 5

juha.marttilaXAEZL
Explorer
Explorer
Hello  @Anonymous_Waguespac, 

I sincerely appreciate your guidance, and I'm thrilled to report that your solution worked seamlessly and exactly as I envisioned. Thank you very much!
0 Likes