Message 1 of 2
Find Sketch containing a specified dimension parameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi! This is a "share your knowledge"-post. I make intense use of sketchbased top-down-modeling. While this, I sometimes need to find where in a bunch of sketches a certain dimension parameter of which I know the name is defined. So I wrote some lines of code for this. Or did I miss some out-of-the-box function that does the same?
Dim name As String = InputBox("Enter the the name of the dimension to find:", "Find sketch containing dimension")
If (name <> "") Then
Dim oDoc As PartDocument = ThisDoc.Document
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSketches As PlanarSketches = oCompDef.Sketches
Dim waehl As SelectSet = oDoc.SelectSet
waehl.Clear
For Each oSketch As Sketch In oSketches
For Each oDimConst As DimensionConstraint In oSketch.DimensionConstraints
If (oDimConst.Parameter.Name = name) Then
Logger.Info(oDimConst.Parameter.Name)
waehl.Select(oSketch)
End If
Next
Next
End If