Select Body in Drawing View from drawing curve

Select Body in Drawing View from drawing curve

johnster100
Collaborator Collaborator
1,170 Views
4 Replies
Message 1 of 5

Select Body in Drawing View from drawing curve

johnster100
Collaborator
Collaborator

Hi,

I'm trying to write code to display the hidden curves for a specific component occurrence. I've seen people that are doing similar by finding the occurrence in the assembly tree. I'm struggling with this a bit as it's quite a complicated drawing with lots of different types of view (sections, details etc) so locating the node can be tricky.

 

I was wondering if it's possible to select 'a body' in a drawing view from one of it's drawing curves (similar to select Body in the filters option) as I can very easily get the drawing curves for a specific view. 

 

Untitled.png

 

So far I have not managed to find a way to do this.

 

Once I've done this I can run the control definition option for showing hidden curves and my code will work as intended.

 

thanks,

John

 

 

0 Likes
Accepted solutions (1)
1,171 Views
4 Replies
Replies (4)
Message 3 of 5

johnster100
Collaborator
Collaborator

Hi Jhoel,

thanks for that. 

 

I'm trying to avoid using the node browser if possible. Mainly because it's tricky to traverse (or if you traverse it all it's very slow as it goes through every model and every feature). The attached code looks good but it only searches the first view. 

 

I appreciate it could be edited to achieve my end goal but was hoping to find a short cut 🙂

 

thanks,

John

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Try this.  If I have a multi-body part shown in multiple views in my drawing, and the drawing is Active, I can run this rule, select the edge within one of the views, and it turns the visibility of that SurfaceBody (solid body) off within the model file. It works for me.

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oDCS As DrawingCurveSegment = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter,"Select a drawing curve segment within a view.")
Dim oBody As SurfaceBody = oDCS.Parent.ModelGeometry.Parent
oBody.Visible = False

You may not see the effects immediately in the drawing file, but when you open the model file, you'll see that solid body has been turned off.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

johnster100
Collaborator
Collaborator

Hi,

I ended up using the code posted by Jhoel. 

 

I still think it would be good if you didn't have to use the browser and could select the solid from it's occurrence but the code he provided did work better than I thought it would. I had initially mis-understood how it worked 😞

 

thanks again Jhoel!

0 Likes