Section Line Visibility - "DrawingSectionViewShowEntireLine.cmd"

Section Line Visibility - "DrawingSectionViewShowEntireLine.cmd"

Rich-T
Advocate Advocate
402 Views
5 Replies
Message 1 of 6

Section Line Visibility - "DrawingSectionViewShowEntireLine.cmd"

Rich-T
Advocate
Advocate

Hi all,

I'm looking for some help with section lines in drawings.

I want a rule that selects all section lines and toggles their visibility on/off.

 

I can do it with 

DrawingSectionViewShowEntireLine.cmd

but it requires the user to select a section line - I want the code to search for and select all section lines in the IDW.

Any guidance would be greatly appreciated.

0 Likes
Accepted solutions (2)
403 Views
5 Replies
Replies (5)
Message 2 of 6

dalton98
Collaborator
Collaborator

I'm not exactly sure what you are asking but this is some code to change the drawing view style.

daltonparrish_0-1649271473383.png

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oView As DrawingView
For Each oView In oDoc.ActiveSheet.DrawingViews
oView = oDoc.ActiveSheet.DrawingViews.Item(1)

oView.ViewStyle = DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle
'oView.ViewStyle = DrawingViewStyleEnum.
Next
0 Likes
Message 3 of 6

Rich-T
Advocate
Advocate

Thanks for your interest. What I'm after is to be able to toggle the section cut line visibility with code.

I want the code to search for all section lines in all drawing sheets, select them and toggle the visibility on/off.

 

I have some code that requires the user to select each section line manually but its slower than simply R-Clicking and using "Show Entire Line"

 

RichardThompson2015_0-1649278136221.png

 

0 Likes
Message 4 of 6

dalton98
Collaborator
Collaborator

I did a little looking around and couldn't find much. I found a way to make the entire line disapear.

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument


Dim oView As DrawingView
For Each oView In oDoc.ActiveSheet.DrawingViews
Try
oView.DisplayDefinitionInBase = False
Catch
End Try
Next

 This information can be found in the top right of the inventor browser. (?) icon > Help > Programming/API Help

0 Likes
Message 5 of 6

dalton98
Collaborator
Collaborator
Accepted solution

@Rich-T Ok this is what you want 

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
For Each oSheet In oDrawingDoc.Sheets
	Dim oView As DrawingView
	For Each oView In oSheet.DrawingViews
		oDrawingDoc.SelectSet.Select(oView)
		Dim oCtrlDef As ControlDefinition
		oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("DrawingSectionViewShowEntireLineCtxCmd")
		oCtrlDef.Execute
		oDrawingDoc.SelectSet.Clear
	Next
Next

 

0 Likes
Message 6 of 6

Rich-T
Advocate
Advocate
Accepted solution

That's excellent, thanks Dalton.

The bit below was what I couldn't get my brain around. It all makes sense when you see it.

oDrawingDoc.SelectSet.Select(oView)

Thanks again.

0 Likes