Inventor Customization

Reply
*Bob S.
Message 1 of 9 (411 Views)

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

411 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
*Brian Ekins \(Autodesk\)
Message 2 of 9 (411 Views)

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
*Bob S.
Message 3 of 9 (411 Views)

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
>
*Brian Ekins \(Autodesk\)
Message 4 of 9 (411 Views)

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
Valued Contributor
herrwolf1
Posts: 54
Registered: ‎08-21-2008
Message 5 of 9 (408 Views)

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

Member
rrdeveloper
Posts: 5
Registered: ‎07-13-2011
Message 6 of 9 (162 Views)

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?

Mentor
PACDrafting
Posts: 587
Registered: ‎10-22-2007
Message 7 of 9 (156 Views)

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?

Mentor
PACDrafting
Posts: 587
Registered: ‎10-22-2007
Message 8 of 9 (155 Views)

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

Mentor
PACDrafting
Posts: 587
Registered: ‎10-22-2007
Message 9 of 9 (153 Views)

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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube