Jump to content

Anyway to Change an Ellipse into a Polyline?


fewer_98

Recommended Posts

  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

  • fuccaro

    12

  • CADIDAC

    6

  • CADTutor

    5

  • fewer_98

    5

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 year later...

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

hmm, it is displaying this:

 

Command: _appload ellipse2pline.lsp successfully loaded.

 

 

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • 2 years later...
  • 9 years later...

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

 

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