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
>