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.
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.
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.
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
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
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
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
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
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