Show hidden lines

Show hidden lines

Lesoux
Advocate Advocate
2,120 Views
5 Replies
Message 1 of 6

Show hidden lines

Lesoux
Advocate
Advocate

Hi, everyone.

 

Suppose you have an assembly drawing. Your drawing view contains all patrs and subassemblies that shown without any hidden lines. You want to show hidden lines for some particular parts or subassemblies, not everywhere. Inventor has option for that. You need to find a part in the Inventor tree, right-click and select option Hidden Lines.

 

Is there some way to do the same thing using API?

 

As I know, right now we can show/hide all hidden lines only.

 

Thanks in advance.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Accepted solutions (1)
2,121 Views
5 Replies
Replies (5)
Message 2 of 6

AlexKorzun
Autodesk
Autodesk
Accepted solution

Hi,

 

There is no direct API to deal with the occurrence view style inside of the drawing view. This will appear in future version of Inventor.

As a workaround you may consider the manipulations with the browser nodes (please note: will not work in Inventor Server/C360).

 

Below is the browser view of the occurrence you want to toggle:

1.jpg

 

You will need to explode the hierarchy (something that will require experimentation) and execute the command in the way similar to:

Method SwitchHiddenLinesCmd() As String
    Dim fPath As String
    Try
        InventorApplication.SilentOperation = True
        Dim oDoc = GetHostObject(mySupportDrawing)
        Dim oSheet = GetHostObject(mySupportDrawing.myassemblySheet)
        Dim oView = GetHostObject(mySupportDrawing.myassemblySheet.MyAssemblyBaseView)
        
        Dim oTop = oDoc.BrowserPanes.get_Item("DlHierarchy").TopNode
        
        ' Find a BrowserNode relates with a component
        Dim oComp = oTop.BrowserNodes.get_Item("Assembly:1")
        oComp.Expanded=True
        oComp = oComp.BrowserNodes.get_Item("SUPPORT ASSEMBLY:Assembly4.iam")
        oComp.Expanded=True
        oComp = oComp.BrowserNodes.get_Item("Assembly4.iam")
        oComp.Expanded=True
        oComp = oComp.BrowserNodes.get_Item("supportAssembly")
        oComp.Expanded=True
        oComp = oComp.BrowserNodes.get_Item("LegRight")
        oComp.Expanded=True
        
        fPath = oComp.FullPath
        oComp.DoSelect()
        
        ' Switch the Hidden Lines toggle
        Dim oCommand = InventorApplication.CommandManager.ControlDefinitions.get_Item("DrawingBodyHiddenLinesCtxCmd")
        oCommand.Execute()
    Finally
        InventorApplication.SilentOperation = False
    End Try
    
    Return fPath
End Method

 

Result:

2.jpg

 

Running the code again will toggle the "Hidden Lines" back to original state

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Reply
Reply
Message 3 of 6

Lesoux
Advocate
Advocate

Thank you Alex for your help. Let me try this way, I'll let you know about results.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Message 4 of 6

Lesoux
Advocate
Advocate

Well. Everything works perfect. Thanks. I just modify method as I need.

 

Method SwitchHiddenLinesCmd(view As Part, objList As List) As Boolean
   Try
      InventorApplication.SilentOperation = True

      Dim oDoc As Any = GetHostObject(Me.Parent)
      Dim oSheet As Any = GetHostObject(Me)
      Dim oView = GetHostObject(view)
      Dim oTop = oDoc.BrowserPanes.get_Item("DlHierarchy").TopNode

      Dim oOcc As Any = GetHostObject(view.Model)

   ' Find a BrowserNode relates with a component
      Dim oComp = oTop.BrowserNodes.get_Item(oSheet.Name)
      oComp.Expanded = True

      oComp = oComp.BrowserNodes.get_Item(view.displayName + ":" + oOcc.Definition.Document.DisplayName)
      oComp.Expanded = True

      oComp = oComp.BrowserNodes.get_Item(oOcc.Definition.Document.DisplayName)
      oComp.Expanded = True

      For i = 1 To length(objList)
            Dim obj As Part = nth(i, objList)
            Dim oNode As Any = oComp.BrowserNodes.get_Item(GetHostObject(obj).Name)

            oNode.DoSelect()

      ' Switch the Hidden Lines toggle
            Dim oCommand = InventorApplication.CommandManager.ControlDefinitions.get_Item("DrawingBodyHiddenLinesCtxCmd")
            oCommand.Execute()
      Next
   Finally
      InventorApplication.SilentOperation = False
   End Try

   Return True
End Method

 

I know it will work with first level assembly only, but it's enough for right now.

Win10 x64
Xeon E5-1630
32 Gb RAM
Quadro K5200

Inventor 2020.3.4, Build 373
Reply
Reply
0 Likes
Message 5 of 6

chrisdrogers
Contributor
Contributor

It has been 5 years since this post.  Is there a method to do this through the API or are we still required to use the browser selections and call a command?

Reply
Reply
0 Likes
Message 6 of 6

ruthsteed
Autodesk
Autodesk

Hi,

Unfortunately, the workaround provided by Alex is still the way to do this.  Providing this functionality is on our radar, but it's hard to say when it might be available.

Regards,

Ruth Steed

Inventor Development



Ruth Steed
Inventor Development Team
Autodesk, Inc.

Reply
Reply