iLogic Ignore Construction Lines on Sketch Extents

iLogic Ignore Construction Lines on Sketch Extents

dsl145
Advocate Advocate
669 Views
2 Replies
Message 1 of 3

iLogic Ignore Construction Lines on Sketch Extents

dsl145
Advocate
Advocate

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

Accepted solutions (1)
670 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

You just need to add an extra check at the beginning of the loop for its Construction boolean property, like this.

Sub Main
	MsgBox("Hi")
End Sub
Public Function GetSketchExtents

Dim sSketch As PlanarSketch = ThisDoc.Document.ComponentDefinition.Features.SweepFeatures.Item(1).Profile.Parent
Dim oSketchRange As Box2d = ThisApplication.TransientGeometry.CreateBox2d
Dim oEntity As SketchEntity
For Each oEntity In sSketch.SketchEntities
	If oEntity.Construction = False Then
		oSketchRange.Extend(oEntity.RangeBox.MinPoint)
		oSketchRange.Extend(oEntity.RangeBox.MaxPoint)
	End If
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

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

AlexKorzun
Autodesk
Autodesk

Hi,

Please try .Construction property of SketchEntity to find out.

 

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.