- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've got the following code to determine the extents of a sketch for a swept part, but it's picking up the construction lines for the sketches as well. Is there any way to just have it take the extents of the drawn components and ignore the construction lines.
Code below:
Public Function GetSketchExtents
Dim sSketch As PlanarSketch
sSketch = ThisDoc.Document.ComponentDefinition.Features.SweepFeatures.Item(1).Profile.Parent
Dim oSketchRange As Box2d
oSketchRange = ThisApplication.TransientGeometry.CreateBox2d
Dim oEntity As SketchEntity
For Each oEntity In sSketch.SketchEntities
Call oSketchRange.Extend(oEntity.RangeBox.MinPoint)
Call oSketchRange.Extend(oEntity.RangeBox.MaxPoint)
Next
'MsgBox("(Values)" & vbCrLf & _
'"MaxPoint.X [cm]= " & oSketchRange.MaxPoint.X & vbCrLf & _
'"MinPoint.X = [cm]" & oSketchRange.MinPoint.X & vbCrLf & _
'"MaxPoint.Y = [cm]" & oSketchRange.MaxPoint.Y & vbCrLf & _
'"MinPoint.Y = [cm]" & oSketchRange.MinPoint.Y)
dblHeight = ((oSketchRange.MaxPoint.X - oSketchRange.MinPoint.X)/2.54)
dblWidth = ((oSketchRange.MaxPoint.Y - oSketchRange.MinPoint.Y)/2.54)
'MsgBox("(Values)" & vbCrLf & _
'"dblHeight = [in]" & dblHeight & vbCrLf & _
'"dblWidth = [in]" & dblWidth)
End Function
Solved! Go to Solution.