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

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

Anonymous
Not applicable
1,294 Views
8 Replies
Message 1 of 9

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

Anonymous
Not applicable
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
0 Likes
1,295 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
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
0 Likes
Message 3 of 9

Anonymous
Not applicable
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
>
0 Likes
Message 4 of 9

Anonymous
Not applicable
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
0 Likes
Message 5 of 9

herrwolf1
Enthusiast
Enthusiast

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

 

Thank you,

 

Eric

0 Likes
Message 6 of 9

Anonymous
Not applicable

I need a similar solution.. Any success?

0 Likes
Message 7 of 9

PACDrafting
Collaborator
Collaborator

Can you reach it via the BrowserNodes?

0 Likes
Message 8 of 9

PACDrafting
Collaborator
Collaborator

obrow.NativeObject.ViewStyle = kHiddenLineRemovedDrawingViewStyle or

 

obrow.NativeObject.ViewStyle = kHiddenLineDrawingViewStyle

0 Likes
Message 9 of 9

PACDrafting
Collaborator
Collaborator

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

0 Likes