Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Show Hidden Lines of a part in a view?

10 REPLIES 10
Reply
Message 1 of 11
montylowe
1516 Views, 10 Replies

Show Hidden Lines of a part in a view?

I am looking for a way to Show Hidden Lines of a part in a view via vb code? Thanks in advance for you help.

Tags (1)
10 REPLIES 10
Message 2 of 11
Mike.Wohletz
in reply to: montylowe

I think this is what you are asking for..

 

  Public Sub ShowHiddenLines()
        If oApp.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
            Dim oDrawDoc As DrawingDocument = oApp.ActiveDocument
            Dim oView As DrawingView = oDrawDoc.ActiveSheet.DrawingViews.Item(1)
            oView.ViewStyle = DrawingViewStyleEnum.kHiddenLineDrawingViewStyle
        End If
    End Sub

 

This will show the hidden lines for the first view in the sheet.

 

Message 3 of 11
montylowe
in reply to: montylowe

Thanks for your reply. I am looking to control the hidden lines in a sub part of the assembly in the view, not the overall hidden lines in the view. Thanks for your help.

Message 4 of 11
RodrigoEiras
in reply to: montylowe

 

This is an old thread, but I am having the same problem.

 

I have managed to get the command name to activate the hidden lines for a component/subassembly, but I am missing two things to be able to use it properly:

 

1.- How can I select with iLogic a component/subassembly in a view?

 

2.- Can I check whether the hidden lines of that component/subassembly are already activated?

 

I paste below what I have, any help would be highly appreciated.

 

SyntaxEditor Code Snippet

Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager

Dim oControlDef As ControlDefinition
oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBodyHiddenLinesCtxCmd")

oControlDef.Execute

 

 

 

Message 5 of 11
RodrigoEiras
in reply to: RodrigoEiras

 

I got some more information from another post about how to reach the assembly in the view, so I believe I might be a bit closer, but still not there...

 

The SelectSet.Select method is not working. I am not sure I am doing it in the right context.

 

Still pending the issue to check whether the hidden lines were already activated, or a command to remove the hidden lines would also work.

 

 

 

SyntaxEditor Code Snippet

Dim drawDoc As DrawingDocument
drawDoc = ThisApplication.ActiveDocument

Dim drawView As DrawingView
drawView = ActiveSheet.View("FRONT VIEW").View

' Get the assembly shown in the view
Dim asmDoc As AssemblyDocument
asmDoc = drawView.ReferencedDocumentDescriptor.ReferencedDocument

' Get the desired occurrence
Dim occ As ComponentOccurrence
drawDoc.SelectSet.Clear

For Each occ in  asmDoc.ComponentDefinition.Occurrences
    If occ.Name = "ShellNZ1:1" Then
        drawDoc.SelectSet.Select (occ) 'NOT WORKING
        Trace.writeline("ShellNZ1:1 has been selected")
    End If
Next    


Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager

Dim oControlDef As ControlDefinition
oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBodyHiddenLinesCtxCmd")

oControlDef.Execute

 

 

 

Message 6 of 11

I think it is not working because of the levels things are on. You might have better luck going through the browser and selecting parts there with select-set, or just simply getting the user to select the browser nodes via the Pick command.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 7 of 11

 

Hi Justin,

 

Could you give some tip about how the selection can be done through the browser?. I want to avoid the user having to make the selection manually.

 

Best regards

 

 

 

Rodrigo

 

Message 8 of 11

oPane = ThisApplication.ActiveDocument.BrowserPanes("Model")
oDwgName = oPane.TopNode 'Is the WO# and sheet name
oDwgRes = oDwgName.BrowserNodes.Item("Drawing Resources")
oSktch = oDwgRes.BrowserNodes.Item(4)

Is an example of accessing things through the browser.
Then just collect the browser nodes and add them to the select set.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 9 of 11

 

Hi Justin,

 

I think this is a very good direction to go, but I am having problems to move in the BrowserPane when you have different views in a Sheet. Could you share any more elaborated example to traverse the browserpane in a drawing?.

 

Best regards

 

 

 

Rodrigo

 

 

Message 10 of 11

 

Hi Justin,

 

I have invested some more time and finally got to a partial solution. It has some limitations.

 

1.- I would need to find a way to know whether the hidden lines were already activated

 

2.- I didn't manage to make SelectSet.Select work on the DrawingDocument, so I can only select one node using DoSelect

 

Any idea to solve at least the first limitation would be highly appreciated

 

Thanks for your help. I am much closer to the solution

 

 

SyntaxEditor Code Snippet

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisDrawing.Document

Dim oBrowserPane As BrowserPane
oBrowserPane = oDrawingDoc.BrowserPanes("Model")

Dim oTopNode As BrowserNode
Dim oSheetNode As BrowserNode
Dim oViewNode As BrowserNode

oTopNode = oBrowserPane.TopNode
'Trace.Writeline ( "Got Top Node : " & oTopNode.FullPath)

oSheetNode = oTopNode.BrowserNodes.Item(2)
'Trace.Writeline ( "Got Sheet Node : " & oSheetNode.FullPath)

oViewNode = oSheetNode.BrowserNodes.Item(3)
'Trace.Writeline ( "Got View Node : " & oViewNode.FullPath)

oAssemblyNode = oViewNode.BrowserNodes.Item(7)
'Trace.Writeline ( "Got Assembly (in view) Node : " & oViewNode.FullPath)

For Each oBrowserNode In oAssemblyNode.BrowserNodes
    If oBrowserNode.FullPath = "Box.idw:Sheet:1:FRONT VIEW:Box.iam:Box.iam (iLogic):ShellNZ1:1 (iLogic)" Then
        oTargetNode = oBrowserNode
        Trace.Writeline( "Got Target Node : " & oTargetNode.FullPath )
    Else
'        Trace.Writeline( "Got NOT Target Node : " & oBrowserNode.FullPath )
    End If    
Next


oTargetNode.DoSelect

Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager

Dim oControlDef As ControlDefinition
oControlDef = oCommandMgr.ControlDefinitions.Item("DrawingBodyHiddenLinesCtxCmd")

oControlDef.Execute

 

 

Message 11 of 11
BromanSillito
in reply to: montylowe

Here's a way I've found to do it. It just iterates through the curves of the specified part (as named in the browser) and then if it finds a hidden line it makes it invisible. Not the most elegant solution, but does what I need it to at least. It was done in vb.net, visual studio, so it would have to be tweaked for iLogic.

 

 Public Sub TurnOffHiddenLinesSub(oView As DrawingView, partName As String)

        Dim oDrawDoc As DrawingDocument = oInventorApp.ActiveDocument
        Dim oSheet As Sheet = oDrawDoc.ActiveSheet
        Dim oAsmDoc As AssemblyDocument = oView.ReferencedDocumentDescriptor.ReferencedDocument
        Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
        Dim oOcc As ComponentOccurrence = oAsmDef.Occurrences.ItemByName(partName)
        Dim oCurve As DrawingCurve

        For count = 1 To oView.DrawingCurves(oOcc).Count
            oCurve = oView.DrawingCurves(oOcc).Item(count)
            If oCurve.Segments.Item(1).HiddenLine = True Then
                oCurve.Segments.Item(1).Visible = False
            End If
        Next

    End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report