Jump to content
fewer_98

Anyway to Change an Ellipse into a Polyline?

Recommended Posts

mgardiner

I notice that you can only select one ellipse at a time.

can this code be changed to select all and pick out the ellipses and change them?

Share this post


Link to post
Share on other sites
fuccaro

You need to pick the ellipse to change. The pickpoint is used to calculate the orientation of the ellipse. Without this point the program can not determine the UCS of the original ellipse and the new one will be aligned to the WCS.

To make the long story short: you need to pick the ellipse to transform. :(

Share this post


Link to post
Share on other sites
CarlB

Fuccaro,

 

Unless I miss something I don't see that you used the pickpoint. You used the 2 axis points, which can also be obtained from a "selection set" type of selection. (But then I'm not as familiar with the code as you are. But....it has been a long time since you wrote it so I'm sure its not fresh in your mind either) :)

 

Carl

Share this post


Link to post
Share on other sites
fuccaro
...it has been a long time since you wrote it so I'm sure its not fresh in your mind either

Carl

Well, you are right Carl; I am getting old.

Im am out of my time so I can not promisse a quick fix of the problem, but...

Share this post


Link to post
Share on other sites
CADIDAC

I saved the lsp file and loaded it succesfully, but when I type the file name into autocad, I get this; Unknown command "ELLIPSE2PLINE".

 

is there something I'm doing wrong?

Share this post


Link to post
Share on other sites
dbroada

as fuccaro doesn't appear to be online at the moment I'll have a stab. I think you should just type ELL2P to get going.

Share this post


Link to post
Share on other sites
CADIDAC

thank you very much. That was the exactly what I needed. I can write the code yet, but I enjoy using other peoples. Is it generally listed in the code what you have to type in to intiate the command?

Share this post


Link to post
Share on other sites
CADIDAC

does this not work in 2007?

Share this post


Link to post
Share on other sites
dbroada

(defun c:ell2p

is the line that defines the name of the routine you are creating. When you successfully load a LISP file you should have something like that echoed to the command line. Typing the part after the c: should start the command.

 

I have no idea if fuccaro's code will work on 2007. When he wrote it 2007 wasn't even about but most things in AutoCAD are backwards compatible so should. Check the command window (press F2) for any error codes and post them here. Somebody may be able to interpret them.

Share this post


Link to post
Share on other sites
CADIDAC

Hmm this is very strange, it worked in the computer lab on 2006 this morning but on my computer it won't work for 2006 or 2007. I have tried loading and reloading multiple times and each time is met with successful loading. All I recieve is this error when I hit F2:

 

Command: ell2p

Unknown command "ELL2P". Press F1 for help.

 

I can't find anything that I am doing that I wasn't earlier?

Share this post


Link to post
Share on other sites
dbroada

that usually means it isn't loading properly. What do you get on the F2 screen immediately after loading the file?

Share this post


Link to post
Share on other sites
CADIDAC

hmm, it is displaying this:

 

Command: _appload ellipse2pline.lsp successfully loaded.

 

 

Command: ; error: bad character read (octal): 0

Share this post


Link to post
Share on other sites
fuccaro

Cadidac

How do you save the lisp files on your computer? Copy from here the text and paste it in Notepad. Save with LSP extension.

Did you use Wordpad or some other application?

Share this post


Link to post
Share on other sites
New2CADmike

I think the lisp needs to be started by typing e2p not ell2p ...... look at post 16 after Fuccaro fixed the bugs..The defun line says e2p...earlier it said ell2p

Share this post


Link to post
Share on other sites
CADIDAC

I recopied it again but this time saved it using ansi encoding,( I am not sure what this means?), but it works now. Thanks a lot. When converting a segment of an ellipse, does this also turn it back into a full ellipse?

Share this post


Link to post
Share on other sites
fuccaro

In AutoCAD the ellipse arc concept is newer as my lisp. At the time I wrote that routine we had only full ellipses -booth in spline and in polyline format. This is why it doesn't handle the elliptical arcs. Sorry!

Share this post


Link to post
Share on other sites
thompagr

Thanks for posting solutions my friends

Share this post


Link to post
Share on other sites
caronteric
On 8/6/2004 at 2:10 PM, sp said:

Type in pellipse and set value to 1 first

15 years ago you knew it!, thanx bro

Share this post


Link to post
Share on other sites
tombu

This works with ellipse, ellipse arcs, lines, arcs, and circles.  For ellipse, ellipse arcs, and circles the polyline is placed on top preserving ellipses and circles.  Haven't used it in many years as I've grown fond of using lineweights instead of polyline widths.

; Ellipse or ellipse arc to polyline
; Written By: Peter Jamtgaard 8/1/2006
; https://forums.augi.com/showthread.php?43318-How-to-Change-elliptical-arcs-into-Polylines&p=531686&viewfull=1#post531686
; Modified by Tom Beauford to convert Lines, Arcs, and Circles as well.
; Menu item: ^P(or C:El2p (load "El2p.lsp"));El2p
;(defun C:El2p (/ El2p ss count)
(defun C:El2p (/ ss count)

(defun El2p (ent / sngIncrement sngPosition pedacept)
  (setq obj (vlax-ename->vla-object ent)
         EnTyp (cdr (assoc 0 (entget ent)))
  )
  (cond

   ((= EnTyp "ELLIPSE")
     (setq obj (vlax-ename->vla-object ent)
       sngIncrement (/ (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj)) 100.0)
       sngPosition 0.0
     )
     (command "ortho" "off" "pline")
     (repeat 101
       (command (vlax-curve-getpointatdist obj sngPosition))
       (setq sngPosition (+ sngPosition sngIncrement))
     )
     (command "")
   ); EnTyp = ELLIPSE

   ((= EnTyp "CIRCLE")
  (princ "\nEntity Type = ")(princ EnTyp)
     (setq obj (vlax-ename->vla-object ent)
     		ps (vlax-variant-value (vlax-get-property obj 'Center)); Center
     		center (vlax-safearray->list ps)		; Center
     		radius (vlax-get-property obj 'Radius)	; Radius
     		pt1 (polar center 0 radius)      	; start point for polyline
;     		pt2 (polar center 3.14159 radius)	; second point for pline arc
     		ELA (vlax-get-property obj 'Layer)		; layer
     		ELT (vlax-get-property obj 'Linetype)	; Linetype
     		ELS (vlax-get-property obj 'LinetypeScale)	; LinetypeScale
     		PltSty (vlax-get-property obj 'PlotStyleName)	; PlotStyleName
     		TruClr (vlax-get-property obj 'TrueColor)	; TrueColor
     )
;     (command "pline" pt1 "Arc" "CE" center pt2 "Close")
     (command "pline" pt1 "Arc" "CE" center "Angle" 180.0 "Close")
     (setq ent (entlast)
               obj (vlax-ename->vla-object ent)
     )
;     (vlax-dump-object obj)	; List object properties
     (vl-catch-all-apply 'vla-put-Layer (list obj ELA))
     (vl-catch-all-apply 'vla-put-Linetype (list obj ELT))
     (vl-catch-all-apply 'vla-put-LinetypeScale (list obj ELS))
     (vl-catch-all-apply 'vla-put-PlotStyleName (list obj PltSty))
     (vl-catch-all-apply 'vla-put-TrueColor (list obj TruClr))
   ); EnTyp = CIRCLE

   ((or(= EnTyp "ARC")(= EnTyp "LINE"))
     (setq pedacept (Getvar "peditaccept"))
     (setvar "peditaccept" 1)
     (command "_.pedit" ent "_exit")
     (setvar "peditaccept" pedacept)
   ); EnTyp = ARC or LINE
   (T(princ "\nEntity Type = ")(princ EnTyp))
 ); if (= (type ent) 'ENAME)
; (vla-delete objEllipse)
 (princ)
)

(princ "\nSelect Lines, Arcs, Circles,  Ellipses, and Ellipse Arcs: ")
  (setq count 0)
  (if (setq ss (ssget '((0 . "line,arc,circle,ellipse"))))
    (repeat (sslength ss)
      (el2p (ssname ss count))
      (setq count (1+ count))
    )
    (princ "\nNo modifyable objects selected!")
  )
 (princ)
 (princ "\nel2p done!")
); defun C:El2p

 

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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