Autodesk Inventor Customization
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
*Bob S.
For Brian (or other knowledgea ble person): Component Occurence in Drawing View to Hidden Line style?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
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\)
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing View to Hidden Line style?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.ReferencedDo cument
' 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
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.ReferencedDo
' 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.
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing View to Hidden Line style?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.ReferencedDo cument
>
> ' 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
>
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.ReferencedDo
>
> ' 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\)
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing View to Hidden Line style?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
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
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing V
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing V
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-13-2011 04:14 AM in reply to:
herrwolf1
I need a similar solution.. Any success?
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing V
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-13-2011 06:22 AM in reply to:
rrdeveloper
Can you reach it via the BrowserNodes?
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing V
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-13-2011 06:45 AM in reply to:
PACDrafting
obrow.NativeObject.ViewStyle = kHiddenLineRemovedDrawingViewStyle or
obrow.NativeObject.ViewStyle = kHiddenLineDrawingViewStyle
Re: For Brian (or other knowledgea ble person): Component Occurence in Drawing V
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-13-2011 06:52 AM in reply to:
PACDrafting
My mistake. Can only get to the assembly not occurrences.
