Jump to content

ARC START AND END POINT... HELP


leonucadomi

Recommended Posts

Why a lisp routine?  Do you normally have a drawing with two or more arcs where you require such information?

Edited by ReMark
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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)))
    )
)

 

  • Like 2
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...