Jump to content

Recommended Posts

Posted

Greetings everyone!

 

I am happy to be a proud member of this community and look forward to expanding my knowledge of AutoCAD even further past my years of already using it.

 

So my situation...

 

I found a lisp routine here by focarro for his ellipse to polyline.

 

What I did next:

  1. Copied it to Notepad
  2. Saved it as ellipse2poly.lsp to a folder
  3. Loaded it in AutoCAD using the Autolisp Load
  4. Saved it to my File Support Path in AutoCAD
  5. Restarted AutoCAD

But it seems as if it is not working... Anyone have any advice about what I have missed or done wrong?

 

Any advice would be greatly appreciated! Thanks in advance!

Posted (edited)
What are you typing on the command line?

 

e2p... but I have also tried ell2p "I believe this is what you should use" but you have the lisp all messed up.

 

You need to learn to use Code Tags "#"

 

Go into the CODE box and select all and copy and past into Notebook and make sure you are saving as a text document with ext LSP.

 

;| Transforms a spline ellipse into a polyline ellipse
[email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] AUGUST 2004
-----------------------------------------------------------
--
|;
(defun c:e2p( /
old new ;existent and new polyline
sav ;store system variables
cen ;center of ellipse
dep ;axis end point deplacement 
(relative to cen)
p1 p2 ;first axis enpoints
p3 ;sec. axis endpoint
)
(setq old (car (entsel "\n select ellipse to 
change ")))
(while old
(if (= (cdr (assoc 0 (entget 
old))) "ELLIPSE")
(progn
(setq sav (mapcar 'getvar '("PELLIPSE" 
"OSMODE" "UCSICON"))
cen (cdr (assoc 10 (entget 
old)))
dep (cdr (assoc 11 (entget 
old))))
(mapcar 'setvar '("PELLIPSE" "OSMODE" 
"UCSICON") '(1 0 0))
(command "UCS" "e" old)
(setq p1 (trans (list (+ (car 
cen) (car dep))
(+ (cadr cen) 
(cadr dep))
(+ (caddr cen) 
(caddr dep)))
0 1)
p2 (trans (list (- (car 
cen) (car dep))
(- (cadr cen) 
(cadr dep))
(- (caddr cen) 
(caddr dep)))
0 1)
p3 (trans (polar cen
(+ (/ PI 2.0) 
(angle p1 p2))
(* 0.5 (cdr 
(assoc 40 (entget old))) (distance 
p1 p2)))
0 1)
)
(command "ellipse" p1 p2 p3)
(setq new (entget (entlast))
new (subst (cons 8 (cdr 
(assoc 8 (entget old)))) (assoc 
8 new) new))
(entmod new)
(entdel old)
(command "ucs" "p")
(mapcar 'setvar '("PELLIPSE" "OSMODE" 
"UCSICON") sav)
)
(alert "This is not a spline ellipse!")
)
(setq old (car (entsel "\n next ellipse -or 
none for exit ")))
)
(princ)
)

Edited by SLW210
Posted

Try this instead (I dug this out of the CADTutor archive):

 


;| Transforms a spline ellipse into a polyline ellipse
and brings it on the current layer
[email="mfuccaro@hotmail.com"]mfuccaro@hotmail.com[/email] AUGUST 2004
-------------------------------------------------------------
|;

(defun c:ell2p                                                          ; ELLipse TO Polyline
               (/ old cen p1 p1n p2n sc old_PELLIPSE old_OSMODE)
 (setq old (car (entsel "\n select ellipse to change ")))
 (while old
   (if (= (cdr (assoc 0 (entget old))) "ELLIPSE")
     (progn
       (setq cen          (cdr (assoc 10 (entget old)))
             p1           (cdr (assoc 11 (entget old)))
             p1n          (list (+ (car cen) (car p1))
                                (+ (cadr cen) (cadr p1))
                                (caddr cen))
             p2n          (list (- (car cen) (car p1))
                                (- (cadr cen) (cadr p1))
                                (caddr cen))
             sc           (cdr (assoc 40 (entget old)))
             old_PELLIPSE (getvar "PELLIPSE")
             old_OSMODE   (getvar "OSMODE")
             )
       (setvar "PELLIPSE" 1)
       (setvar "OSMODE" 0)
       (entdel old)
       (command "ELLIPSE"
                p1n
                p2n
                (polar cen
                       (+ (angle cen p1n) (/ PI 2.0))
                       (* sc (distance cen p1n))))
       (setvar "PELLIPSE" old_PELLIPSE)
       (setvar "OSMODE" old_OSMODE)
       )
     (alert "This is not an ELLIPSE")
     )
   (setq old (car (entsel "\n select ellipse or none for exit ")))
   )
 (princ)
 )

 

 

Type ELL2P at the command line, and hit enter.

Posted

I pasted the code into the VLIDE and cleaned it up and it works for me. Try copying this code and see if it works.

 

 

(defun c:e2p (/ old new sav cen dep p1 p2 p3)
 (setq old (car (entsel "\n select ellipse to change ")))
 (while old (if (= (cdr (assoc 0 (entget old))) "ELLIPSE")
     (progn
(setq sav (mapcar 'getvar '("PELLIPSE" "OSMODE" "UCSICON"))
      cen (cdr (assoc 10 (entget old)))
      dep (cdr (assoc 11 (entget old)))
)
(mapcar 'setvar '("PELLIPSE" "OSMODE" "UCSICON")'(1 0 0))
(command "UCS" "e" old)
(setq p1 (trans (list (+ (car cen)(car dep))
        (+ (cadr cen)(cadr dep))
        (+ (caddr cen)(caddr dep))) 0 1)
      p2 (trans (list (- (car cen)(car dep))
        (- (cadr cen)(cadr dep))
        (- (caddr cen)(caddr dep))) 0 1)
      p3 (trans (polar cen (+ (/ PI 2.0)(angle p1 p2))
         (* 0.5 (cdr (assoc 40 (entget old)))
     (distance p1 p2))) 0 1))
(command "ellipse" p1 p2 p3)
(setq new (entget (entlast))
      new (subst (cons 8 (cdr (assoc 8 (entget old))))
   (assoc 8 new) new))
(entmod new)
(entdel old)
(command "ucs" "p")
(mapcar 'setvar '("PELLIPSE" "OSMODE" "UCSICON") sav))
     (alert "This is not a spline ellipse!")
   )
   (setq old (car (entsel "\n next ellipse -or none for exit ")))
 )
 (princ)
)

Posted
Try this instead (I dug this out of the CADTutor archive):

 

Ahhh you beat me to it. Story of my life, a day late and a dollar short, lol.

Posted

If you set PELLIPSE = 1 when you draw an ellipse it will be a Polyline ellipse.

Posted

That one worked great! Thanks for the help!

 

Buuuut... this seems to be one of his previous versions of the same one in the thread I found. He seems to mention in the thread that these 2 (the previous to the version I was trying to load) had bugs... The new one, kept the ellipse to poly on the same layer it was on and stopped a UCS conflict.

 

It works though! So until it gives me issues, I will just convert it to the layer it was meant to be on.

 

Thank you again!

Posted
Ahhh you beat me to it. Story of my life, a day late and a dollar short, lol.

 

No worries; I did the exact same thing... CTRL+H and I, go way back. :)

 

I pasted the code into the VLIDE and cleaned it up ...
Posted

lfe011969 : I believe that is the newer code... As when I used it, it called for e2p to be used as opposed to ell2p, it also kept the line on the same layer it had been drawn in. THANKS!

 

SLW : Thank you for the input! I will use the CODE # (tags), also, I copied the code as it appeared in the forum. Although, I was not a member then. Maybe it shows distorted to encourage membership? ;)

 

RenderMan: Thanks again for the help!

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