I want with API to traverse the design tree and if find a feature Sweep1 then Sketch1 from the feature => Show!
How can do this?
You are right the previous example was specific for assembly. If you want the macro to work with all SolidWorks files then it is better to use recursive traversing of the feature tree with TreeControlItem.
Here is a similar macro from SolidWorks resources: 2012 SOLIDWORKS API Help - Traverse FeatureManager Design Tree (VBA)
Here is a modified version of this macro to meet your requirements: #CODE|Traversing With TreeControlItem
Hope this can help
Try this example: #CODE|Traversing All Features In Assembly
The code has 2 constants at the beginning of the code:
Const STR_SEARCHED_FEAT_NAME As String = "Sweep*"
Const STR_SEARCHED_SKETCH_NAME As String = "Sketch*"
The " * " sign allows to find and select all features with similar names (e.g. Sweep1, Sweep2... and Sketch1, Sketch2.....)
How can i do the same thing in drawing?
Retrieving data ...