leonucadomi Posted July 20, 2022 Posted July 20, 2022 someone help me to get the start point and end point of any arc is there any lsp routine for this? thanks test.dwg Quote
ReMark Posted July 20, 2022 Posted July 20, 2022 (edited) Why a lisp routine? Do you normally have a drawing with two or more arcs where you require such information? Edited July 20, 2022 by ReMark Quote
leonucadomi Posted July 20, 2022 Author Posted July 20, 2022 I need to learn how to get those points, I need it for another more complex routine Quote
leonucadomi Posted July 20, 2022 Author Posted July 20, 2022 what I need is to touch the arc and make a mirror with axis of symmetry in the initial and final points of that arc Quote
kirby Posted July 20, 2022 Posted July 20, 2022 Extremely quick and dirty. The DXF Reference manual is your friend... (defun C:GetArc ( / k MyEntSel MyEnt MyEntData MyEntType CP Radius StartAng EndAng SP EP ) ; Select an arc, get geometry and draw radials ; KJM July 2022 (setq k 1) (while k (setq MyEntSel (entsel "\nSelect an ARC...")) (if MyEntSel (progn (setq MyEnt (car MyEntSel)) (setq MyEntData (entget MyEnt)) (setq MyEntType (strcase (cdr (assoc 0 MyEntData)))) (if (equal MyEntType "ARC") (progn (setq k nil) ; stop selection loop ) (progn (prompt "\n Selection was ")(princ MyEntType)(prompt ", try again...")(princ) ) ) ; close if ) ) ; close if ) ; close while ; Get geometry (setq CP (cdr (assoc 10 MyEntData))) ; Centre Point (setq Radius (cdr (assoc 40 MyEntData))) (setq StartAng (cdr (assoc 50 MyEntData))) ; Radians! (setq EndAng (cdr (assoc 51 MyEntData))) ; Make start and end points (setq SP (polar CP StartAng Radius)) (setq EP (polar CP EndAng Radius)) ; Report (prompt "\n Centre = ")(princ CP)(prompt " Radius = ")(princ Radius) (prompt " Start Point = ")(princ SP)(prompt " End Point = ")(princ EP) (princ) ; Draw something (command ".POINT" SP) (command ".POINT" CP) (command ".POINT" EP) (command ".LINE" SP CP EP "") (princ) ) Quote
ronjonp Posted July 20, 2022 Posted July 20, 2022 (edited) There are also the curve-functions which you can feed an ename to: VLAX-CURVE-GETSTARTPOINT VLAX-CURVE-GETENDPOINT (if (setq e (car (entsel))) (progn (setq sp (vlax-curve-getstartpoint e)) (setq ep (vlax-curve-getendpoint e))) ) Edited July 20, 2022 by ronjonp 1 Quote
Lee Mac Posted July 20, 2022 Posted July 20, 2022 Here's another, from my library: ;; Arc Endpoints - Lee Mac ;; Returns the endpoints of an Arc expressed in WCS (defun LM:ArcEndpoints ( ent / cen nrm rad ) (setq ent (entget ent) nrm (cdr (assoc 210 ent)) cen (cdr (assoc 010 ent)) rad (cdr (assoc 040 ent)) ) (mapcar (function (lambda ( ang ) (trans (mapcar '+ cen (list (* rad (cos ang)) (* rad (sin ang)) 0.0)) nrm 0) ) ) (list (cdr (assoc 50 ent)) (cdr (assoc 51 ent))) ) ) 2 Quote
leonucadomi Posted July 21, 2022 Author Posted July 21, 2022 now I have 2 routines that do it but separated and I don't know how to join them 1.lsp 2.lsp test.dwg Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.