PDA

View Full Version : Polylines and ellipses



McNotashark
15th Sep 2005, 07:03 am
I am trying to add a portion of an ellipse to a polyline but it is not letting me.

I am running full 2004.

Another thing that bothered me was that in the properties dialogue box it would not tell me the perimeter of the ellipse.

CarlB
15th Sep 2005, 07:55 am
A workaround could be to close the area with an additional line/pline, then use "bpoly" to create a polyline over the ellipse segment.

I've seen a lisp to convert ellipses to polylines - let us know if you need it and can't find it.

McNotashark
20th Sep 2005, 03:21 am
That bpoly didn't work, but is genius, that will save me hours in the future, thanks.

Can somone please post that lisp so convert elipses to polylines?

and.. how to use a lisp... :oops:

thank you very much

Spageddie
20th Sep 2005, 04:53 am
8) Here you go....

Copy the following code into a text file and saveas PLELP.LSP
(Note: save it to the Support folder or another in your support paths)
then to load into autocad...
Type APPLOAD into the command prompt and in the dialog locate the LSP file you created and click open.

To run type PLELP in the command prompt, and it works pretty much like the standard ellipse command.

Code:

(defun
C:PLELP
(/ AN1 ANG ANS DEG DS1 DS2 INC NUM PST PSTT PT1 PT2 PT3 SPT STT)
;-----------;
(setvar "blipmode" 0)
(setvar "cmdecho" 0) ;---------;
(setq
PT1
(getpoint "\nSelect Center Point: ") ;select center point.
) ;_ end of setq
(initget 1)
(setq
PT2
(getpoint PT1 "\nFirst Axis Point: ") ;select first end point.
) ;_ end of setq
(setvar "blipmode" 0)
(initget 1)
(setq
PT3
(getpoint PT1 "\nSecond Axis Point: ") ;select second end point.
) ;---------;
(setq
ANG (angle PT1 PT2) ;angle of long axis.
DS1 (distance PT1 PT2) ;long axis length.
DS2 (distance PT1 PT3) ;short axis length.
INC 0 ;start point of full ellipse
NUM 360 ;number of increments.
DEG (/ (* pi 2.0) 360.0) ;one degree, in radians.
PST (+ (car PT1) (* (- DS1) (cos INC)))
;formula as found in DXF group codes
PSTT (+ (cadr PT1) (* (- DS2) (sin INC)))
;to determine points for an ellipse.
SPT (list PST PSTT) ;first xy point.
AN1 (angle PT1 SPT) ;angle from start point.
SPT (polar PT1 (+ AN1 ANG) (distance PT1 SPT)) ;add angle of axis.
INC (+ INC DEG) ;increase angle for next point.
) ;---------;
(command "_.pline" SPT) ;start poly
;---------;
(repeat NUM ;draw ellipse
(setq
PST (+ (car PT1) (* (- DS1) (cos INC))) ;
PSTT (+ (cadr PT1) (* (- DS2) (sin INC))) ;
SPT (list PST PSTT) ;
AN1 (angle PT1 SPT) ;
SPT (polar PT1 (+ AN1 ANG) (distance PT1 SPT)) ;
INC (+ INC DEG) ;next angle
) ;_ end of setq
(command SPT) ;continue pline
) ;end repeat
(command "c") ;close pline
(command "pedit" "last" "spline" "")
;--------;
(setvar "cmdecho" 1)
) ;end defun

McNotashark
20th Sep 2005, 05:22 pm
Thank you so much.

Now, how is this different than a normal ellipse? Other than being a polyline.
I am using this to export to a laser cutter; will this give me extra chatter? (Eg. is it a thousand little arcs?)

Thank you all

Spageddie
20th Sep 2005, 10:45 pm
:glare: Exporting to a laser cutter hey....Then yes will give extra chatter as the lisp basic traces over an ellipse creating a lot of node points and arcs in the process....

Give a try and see how you go with it

Geordie
20th Sep 2005, 10:50 pm
Instead of trying to add to a polyline create a REGION
then you can use "massprop" to get the Perimeter length & area

Spageddie
20th Sep 2005, 10:54 pm
:huh: if you list a pline you get that information anyway ?

Geordie
21st Sep 2005, 12:33 am
"if you list a pline you get that information anyway ?" Yes but with a region you have only 1 entity you lose all the extra node points