TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: tefached on April 24, 2022, 12:28:24 PM
-
hi, anybody can help me get the coordinates of the center of an arc within a polyline?
i did my best to try to get it but i can't and i'm only able to get the radius using the bulge and pt1 and pt2 (ends of the arc)
added a picture for reference
thanks in advance
-
You're welcome to use my Bulge Conversion functions (http://lee-mac.com/bulgeconversion.html) for this task - simply supply the two vertex coordinates and the bulge value to either my 'LM:Bulge->Arc' function (to obtain both the centre & radius), or my 'LM:BulgeCenter' function (to obtain only the centre).
-
wow this is amazing! this is exactly what i'm looking for thank you so much good sir!
-
You're welcome to use my Bulge Conversion functions (http://lee-mac.com/bulgeconversion.html) for this task - simply supply the two vertex coordinates and the bulge value to either my 'LM:Bulge->Arc' function (to obtain both the centre & radius), or my 'LM:BulgeCenter' function (to obtain only the centre).
(defun c:ccm
(/ os ss ent enx lst p1
) (setq ss
(ssget "_+.:E:S" '
((0 .
"lwpolyline")))) lst (LM:lwvertices enx)
)
(LM:bulgecentre p q b)
(list (LM:bulgeradius p q b
)) )
)
)
lst
)
)
)
)
)
)
)
)
(defun LM:bulgeradius
(p1 p2 b
) )
(defun LM:bulgecentre
(p1 p2 b
) (+ (angle p1 p2
) (- (/ pi
2) (* 2 (atan b
)))) )
)
Hi Mac, I am using your function and it is correct for the most part, but I seem to have found an error, I found the wrong center point in this drawing test. I uploaded the code and drawings of the problem, please help to check, thank you
-
Didn't run the code but your AUPREC is set to 0 that might affect the calculation.
-
I tried setting the value of AUPREC to 1, it still doesn't work
-
Given that the polyline vertices are represented with respect to the Object Coordinate System (OCS), the resulting centre point will also be expressed with respect to the OCS. As such, you'll need to express this relative to the UCS before supplying the point to the CIRCLE command (which expects a point relative to the UCS).
Simply change this:
(LM:bulgecentre p q b)
(list (LM:bulgeradius p q b
)) )
to:
(list (LM:bulgeradius p q b
)) )
-
thanks mac you are a genius at autolisp
-
thanks mac you are a genius at autolisp
Yes he is. :-)
-
You're both too kind :-)
-
You're both too kind :)
We are many more than two... Thanks Lee :) ;)