Can ellipses convert to polylines?

Can ellipses convert to polylines?

Anonymous
Not applicable
75,785 Views
37 Replies
Message 1 of 38

Can ellipses convert to polylines?

Anonymous
Not applicable

Is there a method of converting ellipses to polylines?

Accepted solutions (2)
75,786 Views
37 Replies
Replies (37)
Message 21 of 38

fg
Enthusiast
Enthusiast

I can’t comment on sachimraos’ method since ellipses are already closed. There are easier methods though - 

if you offset an ellipse a fixed distance you get a spline.  If you offset that back in the other direction you then get a spline with the original dimensions.  If you PEdit this spline it will ask you to convert.  Here you have two options which is controlled by the PLINECONVERTMODE variable:

if PLINECONVERTMODE is set to 0, then Acad will convert to poly line line segments

if PLINECONVERTMODE is set to 1 the Acad will convert to poly line arcs.

 

the only drawback to this is that you still get prompted for precision, and even at the lowest precision you get lots of segments or arcs.  This is great for a lot of CAM processes, but not for simplified/elegant/easy to use drawings or “human” manufacturing processes.  For greatly reduced number of arcs, I recommend and refer everyone to the spl2pl.vex routine mentioned earlier

0 Likes
Message 22 of 38

Kent1Cooper
Consultant
Consultant

@fg wrote:

I can’t comment on sachimraos’ method since ellipses are already closed. ....


Not necessarily.  You can make a partial Ellipse [or Elliptical arc] directly within the ELLIPSE command using the Arc option, or you can TRIM or BREAK a closed Ellipse -- either way, the partial or open Ellipse is still an Ellipse.

Kent Cooper, AIA
0 Likes
Message 23 of 38

Anonymous
Not applicable

What do you mean in Step 1? An ellipse is already a closed object ? Where is the line drawn to and from ?

 

>>>

Step 1: Close the ellipse by drawing a LINE

Step 2: Use JOIN cmd and select the ellipse and line and Press Enter.

Now it will be in SPLINE form.

Step 3: In drop down of spline , Convert Spline to Polyline.

Step 4: BREAK the drawn line from Polyline using BREAK cmd and Delete the drawn Lines.

Hence Conversion of Ellipse to polyline will be achieved.

<<<

0 Likes
Message 24 of 38

Anonymous
Not applicable

I have mentioned trimmed ellipses

For example: Sometimes while importing and converting drafted drawings in autocad for sketches, we may find some fillet radius in ellipse instead of arcs. (say as trimmed ellipse or open ellipse or partial ellipse)

You might know that ellipse always makes spline when joined with other lines even when our intention is to make polyline.

Hope I reached u rightly.

Glad to make corrections if I am wrong. 

0 Likes
Message 25 of 38

BenCads
Enthusiast
Enthusiast

I do not see the "EXisting Object" option. How'd you get there?

0 Likes
Message 26 of 38

cadffm
Consultant
Consultant

Hi,

you want to convert an ellipse to a wobblyLine?

Start command WPL

and you can see: Path type [new Line(single)/Arc/Circle/Pline(2D)/3dpoly/Spline/Ellipse, or EXisting/PRevious/Redo]

Now, TYPE IN: EX<enter>

 

The program will not work in other languages than englisch and you can not select this option via mouse,

but it should work if you type-in EX for the path type.

Sebastian

0 Likes
Message 27 of 38

Kent1Cooper
Consultant
Consultant

@BenCads wrote:

I do not see the "EXisting Object" option. How'd you get there?


Kent1Cooper_0-1649434703388.png

Or, if you have dynamic input on [F12]:

Kent1Cooper_0-1649435126936.png

Kent Cooper, AIA
0 Likes
Message 28 of 38

Kent1Cooper
Consultant
Consultant

@cadffm wrote:

... you can not select this option via mouse, ....


I certainly can, either in the Command line or [with dynamic input on] in the in-screen pull-down.

Kent Cooper, AIA
0 Likes
Message 29 of 38

cadffm
Consultant
Consultant

Hi Kent,

check MY post, we don't compare the same situation or program(version).

But I am away from PC, I will take a look later, or tomorrow or next week 😄

Sebastian

0 Likes
Message 30 of 38

Kent1Cooper
Consultant
Consultant

@cadffm wrote:

you want to convert an ellipse to a wobblyLine?

....

The program will not work in other languages than englisch ....


It won't be wobbly if, as instructed, you set the displacement percentage [the wobbliness factor] to 0.

 

In the EXisting-object option it would work in other-language versions, though it prompts only in English.  I can make a very small correction to have it work in other-language versions in the options to draw the path inside the command [which was the one place without the _ prefix on a command name to make it work in other languages].

 

The one posted at the link in Message 16 is not the latest version anyway -- I had since changed it to [possibly among other things] account for versions after 2015 [or so] not liking (command) functions in *error* handlers.  Since I may as well post the updated one here for that reason, I've now also made that other small correction in the attached, which should work in other-language versions in all cases [though it still prompts only in English].

Kent Cooper, AIA
Message 31 of 38

Kent1Cooper
Consultant
Consultant

@cadffm wrote:

.... we don't compare the same situation or program(version). ....


It turns out you're right -- the one at that link is really old, and I was using a newer version with that options prompt corrected.  Use the one I just posted instead of the one at the link in Message 16.

Kent Cooper, AIA
0 Likes
Message 32 of 38

cadffm
Consultant
Consultant

Hi,

still on a tiny mobile phone, I took a lok.

I was right with the impossible mouseclick because of the linked (old) version, okay.

 

International:

Again, I am not in front of my PC/Acad, but:

One command without an underline, yes

but your new Version still use the english sel-method in SSGET  instead of the international, or?

 

If I am wrong: Sorry, Forum and Lisp files on a 4,6" Smartphone aren't the best choice LOL

and if I am wrong with ssget: **** happens, sometimes I am wrong if i try by rote instead of testing 1:1 first.

 

International SSGET sel-method "_:S" instead ":S"

 

 

Sebastian

0 Likes
Message 33 of 38

cadffm
Consultant
Consultant

@Kent1Cooper 

Back at my PC, some hints more - of course you know it and the code is quit old.

 

- the "layer locked?" test isn't well (= (cdr (assoc 70 (tblsearch "layer"...)))) 0)

  (= 4 (logand dxf70 4) would work but we don't need it, ssget selection method :S:L would do the Job

 

- ssget :S or better _:S for international use allows to select multiple objects, but WPL edit just one from the selection set

  would be nice to run thru all selected objects, or limit the selection to one object ":S+." or ":S:E"   {international "_:S+." or "_:S:E" }

 

- The minimum-segment check is wrong, in case you hit enter to re-use tha last value

   (< segtemp 2) => (< *wplseg* 2)

 

 

 

PS: I used in the past a ~2012 version of your program (surely, I edit all what needed & I want, but still your smart tool: Thank you!)

 

 

Sebastian

0 Likes
Message 34 of 38

gabriel.alaka
Explorer
Explorer

This works like a charm.

0 Likes
Message 35 of 38

TomBeauford
Advisor
Advisor

Try this:

; 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
64bit AutoCAD Map & Civil 3D 2023
Architecture Engineering & Construction Collection
2023
Windows 10 Dell i7-12850HX 2.1 Ghz 12GB NVIDIA RTX A3000 12GB Graphics Adapter
0 Likes
Message 36 of 38

fg
Enthusiast
Enthusiast

I appreciate the effort made here - thanks.  To be honest though I do not see what this method gives one that my method above does not.  Moreover, if you want an ellipse constructed of arcs this does not seem to do that.

 

What would be really wonderful would be a lisp routine which not only gave this option but also allowed the user to either set the level of precision they desire or the number of arcs they desire with a preview of  how much discrepancy there is.

 

To be honest I do most of my curve refinement in Rhino these days precisely because of these limitations...

0 Likes
Message 37 of 38

mrcasper
Explorer
Explorer

Thanks. It's work perfect.

0 Likes
Message 38 of 38

mrcasper
Explorer
Explorer
Thanks. It's work perfect.
0 Likes