I would like to use iLogic to find the location of the points of a line, determine if the line is approximately vertical, and apply a vertical constraint if it is vertical.
Here is the code process I envision:
1. Automatically select a straight line.
2. Find the location of its end points.
3. Compare the X-value of the end points to see if they are vertically aligned (or almost so).
4. If they are vertically aligned, apply a vertical constraint.
5. Select next line and repeat.
Is this possible with iLogic? I don't see any way of calling a line's sketch points or finding their location.
iLogic is good at editing model parameters that have defined names such as d0, d1, "my_width", etc.
I don't think it can find un-named properties of objects such as lines and end-points which Lisp in AutoCAD can easily do?
I was actually able to solve this problem and create code that helps clean up badly constrained or dimensioned sketches. This is what it can automatically do (depending on what the user selects):
1. Delete all dimensions (optional).
2. Delete all constraints by type based on user input (optional).
3. Analyze the sketch and apply vertical constraints to all lines which are within a user-specified tolerance of being vertical (optional).
4. Analyze the sketch and apply horizontal constraints to all lines which are within a user-specified tolerance of being horizontal (optional).
5. Analyze the sketch and apply tangent constraints to all lines or arcs which are within a user-specified tolerance of being tangential to other arcs (optional).
If there is interest, I could share the code.
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
I realize this thread is a year old, but, if you're still interested, I've polished up this code and used it as part of the Sketch Repair Tool that I posted here: