• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    *Bob S.

    For Brian (or other knowledgeable person): Component Occurence in Drawing View to Hidden Line style?

    360 Views, 8 Replies
    01-05-2010 11:16 AM
    Can this be done? I want to go through the DrawingView Object
    to get at a subcomponent of an assembly and either set that
    component to have hidden lines (where needed) or no hidden
    lines. An example would be nice.

    Bob
    Please use plain text.
    *Brian Ekins \(Autodesk\)

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing View to Hidden Line style?

    01-07-2010 08:01 AM in reply to: *Bob S.
    Here's some example code that will change the appearance of an occurrence.
    This uses a top-level occurrence in an assembly, but it could be at any
    level of the assembly.

    Public Sub SetOccurrenceStyleInDrawing()
    Dim drawDoc As DrawingDocument
    Set drawDoc = ThisApplication.ActiveDocument

    Dim drawView As DrawingView
    Set drawView = drawDoc.ActiveSheet.DrawingViews.Item(1)

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

    ' Get the desired occurrence. This just gets the 3rd one in the tree.
    Dim occ As ComponentOccurrence
    Set occ = asmDoc.ComponentDefinition.Occurrences.Item(3)

    ' Get the drawing curves that represent the occurrence.
    Dim drawCurves As DrawingCurvesEnumerator
    Set drawCurves = drawView.DrawingCurves(occ)

    ' Change the style of the curves.
    Dim curve As DrawingCurve
    For Each curve In drawCurves
    curve.LineType = kDashedLineType
    Next
    End Sub

    --
    Brian Ekins
    Inventor API Product Designer
    http://blogs.autodesk.com/modthemachine
    Please use plain text.
    *Bob S.

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing View to Hidden Line style?

    01-07-2010 08:14 AM in reply to: *Bob S.
    Brian,

    Thanks for the example! Though looking at this, doesn't this just
    change ALL the curves for the occurence to dashed lines? What I
    wanted to do is either turn on or off the display of hidden edges,
    like an edgewise hole. Similar to RMB on a selected occurence in
    the drawing view and toggling Hidden Lines on or off.

    Bob

    Brian Ekins (Autodesk) wrote:
    > Here's some example code that will change the appearance of an occurrence.
    > This uses a top-level occurrence in an assembly, but it could be at any
    > level of the assembly.
    >
    > Public Sub SetOccurrenceStyleInDrawing()
    > Dim drawDoc As DrawingDocument
    > Set drawDoc = ThisApplication.ActiveDocument
    >
    > Dim drawView As DrawingView
    > Set drawView = drawDoc.ActiveSheet.DrawingViews.Item(1)
    >
    > ' Get the assembly shown in the view
    > Dim asmDoc As AssemblyDocument
    > Set asmDoc = drawView.ReferencedDocumentDescriptor.ReferencedDocument
    >
    > ' Get the desired occurrence. This just gets the 3rd one in the tree.
    > Dim occ As ComponentOccurrence
    > Set occ = asmDoc.ComponentDefinition.Occurrences.Item(3)
    >
    > ' Get the drawing curves that represent the occurrence.
    > Dim drawCurves As DrawingCurvesEnumerator
    > Set drawCurves = drawView.DrawingCurves(occ)
    >
    > ' Change the style of the curves.
    > Dim curve As DrawingCurve
    > For Each curve In drawCurves
    > curve.LineType = kDashedLineType
    > Next
    > End Sub
    >
    Please use plain text.
    *Brian Ekins \(Autodesk\)

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing View to Hidden Line style?

    01-07-2010 10:04 AM in reply to: *Bob S.
    I misunderstood. What you want to do isn't supported by the API. I thought
    I had a workaround to be able to use the command, the same way you do
    through the user-interface, but I'm having trouble getting it to work.
    --
    Brian Ekins
    Inventor API Product Designer
    http://blogs.autodesk.com/modthemachine
    Please use plain text.
    Valued Contributor
    Posts: 54
    Registered: ‎08-21-2008

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing V

    08-11-2010 07:54 AM in reply to: *Brian Ekins \(Autodesk\)

    Was this issue fixed in 2011? If not, where you able to come up with a workaround?

     

    Thank you,

     

    Eric

    Please use plain text.
    Member
    rrdeveloper
    Posts: 5
    Registered: ‎07-13-2011

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing V

    09-13-2011 04:14 AM in reply to: herrwolf1

    I need a similar solution.. Any success?

    Please use plain text.
    Mentor
    Posts: 565
    Registered: ‎10-22-2007

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing V

    09-13-2011 06:22 AM in reply to: rrdeveloper

    Can you reach it via the BrowserNodes?

    Please use plain text.
    Mentor
    Posts: 565
    Registered: ‎10-22-2007

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing V

    09-13-2011 06:45 AM in reply to: PACDrafting

    obrow.NativeObject.ViewStyle = kHiddenLineRemovedDrawingViewStyle or

     

    obrow.NativeObject.ViewStyle = kHiddenLineDrawingViewStyle

    Please use plain text.
    Mentor
    Posts: 565
    Registered: ‎10-22-2007

    Re: For Brian (or other knowledgeable person): Component Occurence in Drawing V

    09-13-2011 06:52 AM in reply to: PACDrafting

    My mistake. Can only get to the assembly not occurrences.

    Please use plain text.