Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
707 Views, 8 Replies

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

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
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

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
Message 3 of 9
Anonymous
in reply to: Anonymous

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
>
Message 4 of 9
Anonymous
in reply to: Anonymous

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
Message 5 of 9
herrwolf1
in reply to: Anonymous

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

 

Thank you,

 

Eric

Message 6 of 9
rrdeveloper
in reply to: herrwolf1

I need a similar solution.. Any success?

Message 7 of 9
PACDrafting
in reply to: rrdeveloper

Can you reach it via the BrowserNodes?

Message 8 of 9
PACDrafting
in reply to: PACDrafting

obrow.NativeObject.ViewStyle = kHiddenLineRemovedDrawingViewStyle or

 

obrow.NativeObject.ViewStyle = kHiddenLineDrawingViewStyle

Message 9 of 9
PACDrafting
in reply to: PACDrafting

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report