How to show hidden lines of an occurrence on drawing view?

How to show hidden lines of an occurrence on drawing view?

Anton_Chernomazov
Contributor Contributor
2,826 Views
14 Replies
Message 1 of 15

How to show hidden lines of an occurrence on drawing view?

Anton_Chernomazov
Contributor
Contributor

I need to show hidden lines of an occurrence on an drawing view with Inventor API. 

I try to do it showing hidden lines for every occurrence and then disable visibility for segments of all occurrence exept target. But I'm sure that it is bad practice.

re any another ways to do it?

0 Likes
Accepted solutions (1)
2,827 Views
14 Replies
Replies (14)
Message 2 of 15

bradeneuropeArthur
Mentor
Mentor

select in the browser!

in the treeview select the part or assembly then select hidden lines..

 

No coding required...

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 15

HideoYamada
Advisor
Advisor

Hi Anton,

 

I understand that you want to re-show the lines which are hided by a user. O.K.?

 

This code (VBA) re-show the all hidden lines.

Public Sub Test()
    Dim oDrawingDoc As DrawingDocument: Set oDrawingDoc = ThisApplication.ActiveDocument
    Dim oSheet As Sheet
    For Each oSheet In oDrawingDoc.Sheets
        Dim oView As DrawingView
        For Each oView In oSheet.DrawingViews
            Dim oDrawingCurve As DrawingCurve
            For Each oDrawingCurve In oView.DrawingCurves
                Dim oDrawingCurveSegment As DrawingCurveSegment
                For Each oDrawingCurveSegment In oDrawingCurve.Segments
                    'Debug.Print oDrawingCurveSegment.Visible
                    If oDrawingCurveSegment.Visible = False Then oDrawingCurveSegment.Visible = True
                Next oDrawingCurveSegment
            Next oDrawingCurve
        Next oView
    Next oSheet
End Sub

 

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 4 of 15

Anton_Chernomazov
Contributor
Contributor

Oh, thanks! I just try it right now.

0 Likes
Message 5 of 15

Anton_Chernomazov
Contributor
Contributor

I neet to show hidden lines just for single occurrence of assembly. In User Interface I can do it with right mouse click on occurrence in Model browser and select "Show hidden lines". But I need to do it with VBA.

0 Likes
Message 6 of 15

bradeneuropeArthur
Mentor
Mentor

Sorry, but did you read my comment?

 

select in the browser!

in the treeview select the part or assembly then select hidden lines..

 

No coding required...

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 15

Anton_Chernomazov
Contributor
Contributor

I know how I can do it in user interface. But I do need to do it with coding on VBA.

0 Likes
Message 8 of 15

bradeneuropeArthur
Mentor
Mentor

Where do you select the object?

  1. In the browser
  2. in the drawing view

what if the object is completely hidden and not visible in the drawing view?

 

Regards,

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 15

HideoYamada
Advisor
Advisor

Hi Anton,

 

This code re-shows hidden lines of the occurrence which contains the selected line.

At first you should select a line and then execute Test().

 

Public Sub Test()
    Dim oDrawingDoc As DrawingDocument: Set oDrawingDoc = ThisApplication.ActiveDocument
    Dim oSelectedCurve As DrawingCurve
    Set oSelectedCurve = oDrawingDoc.SelectSet(1).Parent
    Dim oOcc As ComponentOccurrence
    Set oOcc = oSelectedCurve.ModelGeometry.Parent.Parent
    Debug.Print oOcc.Name
    Dim oView As DrawingView
    Set oView = oSelectedCurve.Parent
    
    ReShowHiddenLines oView, oOcc
End Sub

Private Sub ReShowHiddenLines(oView As DrawingView, oOcc As ComponentOccurrence)
    Dim oDrawingCurves As DrawingCurvesEnumerator
    Set oDrawingCurves = oView.DrawingCurves(oOcc)
    
    Dim oDrawingCurve As DrawingCurve
    For Each oDrawingCurve In oDrawingCurves
        Dim oDrawingCurveSegment As DrawingCurveSegment
        For Each oDrawingCurveSegment In oDrawingCurve.Segments
            'Debug.Print oDrawingCurveSegment.Visible
            If oDrawingCurveSegment.Visible = False Then oDrawingCurveSegment.Visible = True
        Next oDrawingCurveSegment
    Next oDrawingCurve
End Sub

You can re-show the occurrence lines by your code with using ReShowHiddenLines().

 

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 10 of 15

Anton_Chernomazov
Contributor
Contributor

It does not work in case the occurrence is hidden completely and drawing view has no one curve of this occurrence.

0 Likes
Message 11 of 15

HideoYamada
Advisor
Advisor

Hi,

 

What is the expected workflow for doing this?

 

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
Message 12 of 15

Anton_Chernomazov
Contributor
Contributor

I can see target occerrence on view. More over all curves of this occurrence have hidden line style. 

That all equal I do right mouse click on occurrence in browser and select "Show hidden lines".

0 Likes
Message 13 of 15

bradeneuropeArthur
Mentor
Mentor
Accepted solution

 

Public Sub main()

Dim CmdMan As ControlDefinition
Set CmdMan = ThisApplication.CommandManager.ControlDefinitions.Item("DrawingBodyHiddenLinesCtxCmd")

CmdMan.Execute

or ...................
CmdMan.Execute2 (True)

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

Anton_Chernomazov
Contributor
Contributor

I find necessary browser node of target occurrence and call DoSelect().

Then I execute control defenition but it does not work for me.

 

componentNode.DoSelect();
controlDef = inventorApp.CommandManager.ControlDefinitions["DrawingBodyHiddenLinesCtxCmd"];
controlDef.Execute();
controlDef.Execute2(true);

 

 

0 Likes
Message 15 of 15

Anton_Chernomazov
Contributor
Contributor

Thanks. I just expand every browser node before get target and it works for me.