- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Get Sketch Line From Geometric Constraint
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 ![]()
What am i doing wrong?
For Each oConstraint As GeometricConstraint In oSketch.GeometricConstraints If oConstraint.EntityOne is oL Then oConstraint.Delete End If
Next
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
(Not an Autodesk Employee)