AnsweredAssumed Answered

Parent/Child tree structure of drawings

Question asked by Eric Snyder on Apr 21, 2020
Latest reply on Apr 22, 2020 by Eric Snyder

I am needing to write a script that hides or shows sketches in the tree of a drawing. The specification seems a little "goofy" for the tree. Basically, the tree is a parent/child relationship with unique instances by appending an instance number on the end of a name. This represents a "Russian Doll" type tree:

sketchName@Assem0-1@Drawing View1/Assem1-1@Assem0/Assem2-1@Assem1/Assem3-1@Assem2/Assem4-1@Assem3/Assem5-2@Assem4/Assem6-2@Assem5/Part1-1@Assem6

Same as:

Drawing View1

   Assem0-1

      Assem2-1

         Assem3-1

            Assem4-1

               Assem5-1

                  Assem6-1

                     Part1-1

                        sketchName

Any node could have multiple children as in the case with a Part1-1 where Part1 has multiple features.

 

My challenge here is to build the spec (unless it already exists somewhere in SolidWorks):

sketchName@Assem0-1@Drawing View1/Assem1-1@Assem0/Assem2-1@Assem1/Assem3-1@Assem2/Assem4-1@Assem3/Assem5-2@Assem4/Assem6-2@Assem5/Part1-1@Assem6

to be used in:

Part.Extension.SelectByID2

Unless there is a better way to do this.

 

I see that I can select a IDrawingComponent by using IDrawingComponent.Select but that just selects the component, not a sketch inside the component.

 

Question:

How to select a sketch (with a particular name) in a part or assembly in a particular view using the API?

Outcomes