Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Get Sketch Line From Geometric Constraint

johnster100
Collaborator

Get Sketch Line From Geometric Constraint

johnster100
Collaborator
Collaborator

Hi,

I'm trying to delete all the geometric constraints from a sketchline. I can check the EntityOne and I can see it's the curve I want but the 'Is' statement in the 'If' statement returns false :disappointed_face:

 

What am i doing wrong?

 

	For Each oConstraint As GeometricConstraint In oSketch.GeometricConstraints
		If oConstraint.EntityOne is oL Then
			oConstraint.Delete
	End If


Next

 

0 Likes
Reply
147 Views
1 Reply
Reply (1)

WCrihfield
Mentor
Mentor

Hi @johnster100.  As you might have noticed, the GeometricConstraint object is a generic base class for a whole bunch of other more specific types of geometric constraint objects (CoincidentConstraint, CollinearConstraint, ConcentricConstraint, etc, etc.).  Not all types of geometric constraints have that 'EntityOne' property, so that may be the main problem.  It is likely encountering a constraint that does not have that 'EntityOne' property, so that line of code fails.  Plus, what if the line is actually the value of the 'EntityTwo' property of one of the ones that has that property, instead of its 'EntityOne' property.  Your code will likely have to filter for what more specific Type of constraint it is first, then use the appropriate property check that would work on that type of constraint object.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes