Message 1 of 28
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I worked in a simple code that let me align two polygons just choosing one of its lines, it worked but is not a 100% what I would like, I going to attach images as reference and the code I made. I'd like to improve is the polygons should be aligned to the closest point of its vertices when I choose the line. They should not be aligned one inside the another, I don't know if it is possible to align the text included inside the polygon since most of the time the polygons contain text. finally I would like autoCAD requests me a distance as a kerf since sometimes a space is needed between polygons
(defun c:ALI ()
(setq picked_data (entsel "\nSelect object to align: ")
picked_pline (car picked_data)
picked_point (vlax-curve-getclosestpointto picked_pline (cadr picked_data))
picked_param (fix (vlax-curve-getparamatpoint picked_pline picked_point))
p1 (vlax-curve-getpointatparam picked_pline picked_param)
p2 (vlax-curve-getpointatparam picked_pline (1+ picked_param))
)
(setq picked_data2 (entsel "\nSelect the reference object: ")
picked_pline2 (car picked_data2)
picked_point2 (vlax-curve-getclosestpointto picked_pline2 (cadr picked_data2))
picked_param2 (fix (vlax-curve-getparamatpoint picked_pline2 picked_point2))
p3 (vlax-curve-getpointatparam picked_pline2 picked_param2)
p4 (vlax-curve-getpointatparam picked_pline2 (1+ picked_param2))
)
(command "align" pause "" p1 p3 p2 p4 "" "")
)
Solved! Go to Solution.