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: 

Parts visible in a drawing view

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
1069 Views, 7 Replies

Parts visible in a drawing view

Anonymous
Not applicable
Hi all. Is there a way to get a list of parts that are visible in a given drawing view ? My problem is that I want to selectively show hidden parts in a drawing view. If i change the view to show hidden lines, there's too much detail showing. I am thinking to find out programmatically what parts are visible in a given view, and turn the visibility of the hidden parts programmatically. Then I hope to go to the selected parts and make them visible manually. So effectively, instead of having to make invisible many parts, I can make do with making visible two or three parts of choice. Am I on the right track ? In there another way to achieve the same ? Thanks and Regards Abhishek Singhal
0 Likes

Parts visible in a drawing view

Hi all. Is there a way to get a list of parts that are visible in a given drawing view ? My problem is that I want to selectively show hidden parts in a drawing view. If i change the view to show hidden lines, there's too much detail showing. I am thinking to find out programmatically what parts are visible in a given view, and turn the visibility of the hidden parts programmatically. Then I hope to go to the selected parts and make them visible manually. So effectively, instead of having to make invisible many parts, I can make do with making visible two or three parts of choice. Am I on the right track ? In there another way to achieve the same ? Thanks and Regards Abhishek Singhal
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Have you had any luck with this ??
0 Likes

Have you had any luck with this ??
Message 3 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Has anyone out there had any luck with this? We need to be able to exclude some parts from showing their hidden lines in the view because of too much detail.

I know this can be done manually by deselecting the "Hidden Lines" option for the component under the view "tree". I have not had any luck finding support for this in the API.

Thoughts?

Thanks,
George.
0 Likes

Has anyone out there had any luck with this? We need to be able to exclude some parts from showing their hidden lines in the view because of too much detail.

I know this can be done manually by deselecting the "Hidden Lines" option for the component under the view "tree". I have not had any luck finding support for this in the API.

Thoughts?

Thanks,
George.
Message 4 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
This is possible to do thru the API, though it may not be very
striaghtforward. I don't have any code, but here's what you'll need to do:

1. Turn on hidden line display for the entire view (DrawingView.ViewStyle =
kHiddenLineDrawingViewStyle)
2. Selectively turn off the hidden line display for individual components:
i. Get the ComponentOccurrence or ComponentOccurrenceProxy object
from the referenced assembly that corresponds to the component you
want to turn off the hidden lines for.
ii. Pass in the above object to DrawingView.DrawingCurves property
to retrieve all curves associated with the component.
iii. Iterate over all curves, and iterate over all segments of each
curve.
iv. For every segment, check if its a hidden line
(DrawingCurveSegment.HiddenLine property) and make it invisible if it is
(DrawingCurveSegment.Visible property).

Sanjay-
0 Likes

This is possible to do thru the API, though it may not be very
striaghtforward. I don't have any code, but here's what you'll need to do:

1. Turn on hidden line display for the entire view (DrawingView.ViewStyle =
kHiddenLineDrawingViewStyle)
2. Selectively turn off the hidden line display for individual components:
i. Get the ComponentOccurrence or ComponentOccurrenceProxy object
from the referenced assembly that corresponds to the component you
want to turn off the hidden lines for.
ii. Pass in the above object to DrawingView.DrawingCurves property
to retrieve all curves associated with the component.
iii. Iterate over all curves, and iterate over all segments of each
curve.
iv. For every segment, check if its a hidden line
(DrawingCurveSegment.HiddenLine property) and make it invisible if it is
(DrawingCurveSegment.Visible property).

Sanjay-
Message 5 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Hi Sanjay,
Thanks for the reply...

I tried the approach you suggested below and it appears like it "should" work. However, some hidden lines are still showing up. I have posted attached a screenshot of a simple case and in the next post I will post the dataset in a zip file.

The VBA code I used to test is...

Public Sub test()
Dim oOcc As ComponentOccurrence
Dim oView As DrawingView
Set oView = ThisDocument.Sheets(1).DrawingViews(1)

Dim oCurve As DrawingCurve
Dim oSegment As DrawingCurveSegment

For Each oOcc In oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences
For Each oCurve In oView.DrawingCurves(oOcc)
For Each oSegment In oCurve.Segments
If oSegment.HiddenLine Then
oSegment.Visible = False
End If
Next oSegment
Next oCurve
Next
End Sub

Any thoughts?

p.s. It's kinda funny that this Autodesk discussion group doesn't allow me to upload DWFx files but I can upload DWF... I'm just sayin' 🙂

Thanks,
George
0 Likes

Hi Sanjay,
Thanks for the reply...

I tried the approach you suggested below and it appears like it "should" work. However, some hidden lines are still showing up. I have posted attached a screenshot of a simple case and in the next post I will post the dataset in a zip file.

The VBA code I used to test is...

Public Sub test()
Dim oOcc As ComponentOccurrence
Dim oView As DrawingView
Set oView = ThisDocument.Sheets(1).DrawingViews(1)

Dim oCurve As DrawingCurve
Dim oSegment As DrawingCurveSegment

For Each oOcc In oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences
For Each oCurve In oView.DrawingCurves(oOcc)
For Each oSegment In oCurve.Segments
If oSegment.HiddenLine Then
oSegment.Visible = False
End If
Next oSegment
Next oCurve
Next
End Sub

Any thoughts?

p.s. It's kinda funny that this Autodesk discussion group doesn't allow me to upload DWFx files but I can upload DWF... I'm just sayin' 🙂

Thanks,
George
Message 6 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
The dataset is attached...

Thanks,
George
0 Likes

The dataset is attached...

Thanks,
George
Message 7 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
There seems to be a problem in turning that particular hidden edge invisible
via the API. Perhaps something to do with it being a silhouette edge of the
conical face. I'll file this in our database. Another option for you is to
put all the hidden edges on a new layer and turn the layer off. I've
modified your code to do this. I created a new layer as a copy of the first
one I find - you may want to refine that.

Sanjay-

Public Sub test()

Dim oOcc As ComponentOccurrence
Dim oView As DrawingView
Set oView = ThisDocument.Sheets(1).DrawingViews(1)

Dim oLayer As Layer
Set oLayer = ThisDocument.StylesManager.Layers(1).Copy("Invisible")
oLayer.Visible = False

Dim oCurve As DrawingCurve
Dim oSegment As DrawingCurveSegment

For Each oOcc In
oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences
For Each oCurve In oView.DrawingCurves(oOcc)
For Each oSegment In oCurve.Segments
If oSegment.HiddenLine Then
oSegment.Layer = oLayer
End If
Next oSegment
Next oCurve
Next

End Sub
0 Likes

There seems to be a problem in turning that particular hidden edge invisible
via the API. Perhaps something to do with it being a silhouette edge of the
conical face. I'll file this in our database. Another option for you is to
put all the hidden edges on a new layer and turn the layer off. I've
modified your code to do this. I created a new layer as a copy of the first
one I find - you may want to refine that.

Sanjay-

Public Sub test()

Dim oOcc As ComponentOccurrence
Dim oView As DrawingView
Set oView = ThisDocument.Sheets(1).DrawingViews(1)

Dim oLayer As Layer
Set oLayer = ThisDocument.StylesManager.Layers(1).Copy("Invisible")
oLayer.Visible = False

Dim oCurve As DrawingCurve
Dim oSegment As DrawingCurveSegment

For Each oOcc In
oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences
For Each oCurve In oView.DrawingCurves(oOcc)
For Each oSegment In oCurve.Segments
If oSegment.HiddenLine Then
oSegment.Layer = oLayer
End If
Next oSegment
Next oCurve
Next

End Sub
Message 8 of 8
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Great idea Sanjay!

Thanks for your help! I'll give it a go...
0 Likes

Great idea Sanjay!

Thanks for your help! I'll give it a go...

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

Post to forums  

Autodesk Design & Make Report