Jump to content

Lisp to convert circles, arc to Line


esputro

Recommended Posts

try this

 

; converts an arc to a series of straights
(vl-load-com)
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setq oldecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(while (setq ent (entsel "\nPick arc: "))
(setq obj (vlax-ename->vla-object (car ent)))
(if (= div nil) (setq div (getint "\nEnter number of chords: ")))
     
(setq  endpt (vlax-curve-getEndPoint obj)
    totlen (vlax-curve-getDistAtPoint obj endpt)
    arclen (/ totlen div)
    chrdpt (vlax-curve-getStartPoint obj)
    num 1     
)
(repeat div
 (setq newpt (vlax-curve-getPointatDist obj (* arclen num)))
 (command "line" chrdpt newpt "")
 (setq num (+ num 1))   
 (setq chrdpt newpt)
) ;repeat
(setq objlst (cons obj objlst))
) ; end while
;(vlax-for objdel objlst (vlax-delete  objdel))
(setvar "cmdecho" oldecho)
(setvar "osmode" oldsnap)
(princ)

Link to comment
Share on other sites

The code posted by BIGAL will defame a serie of arcs into line segments It doesn't define a command, but is intended to be run directly; just paste it on command prompt or on VLIDE console.

If you want a command, then:

(defun c:ATOL() ;arc to lines
;place BIGAl's code here
)

Link to comment
Share on other sites

pBe it was done as a quickie to get around wipeout not supporting arcs and some other software importing autocad dwgs as a underlying frame did not support arcs, a good idea probably an option within the one lisp 2 versions ATOLN & ATOLD

 

Esputro did it meet your needs or do you need like pBe has suggested ?

Link to comment
Share on other sites

  • 5 years later...

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