Initial commit
This commit is contained in:
70
downloaded/Ellipse2pline.lsp
Normal file
70
downloaded/Ellipse2pline.lsp
Normal file
@@ -0,0 +1,70 @@
|
||||
; Ellipse or ellipse arc to polyline
|
||||
; Written By: Peter Jamtgaard 8/1/2006
|
||||
; Modified by Tom Beauford to convert Lines, Arcs, Splines, and Circles as well.
|
||||
; Menu item: ^P(or C:El2p (load "El2p.lsp"));El2p
|
||||
(defun C:El2p (/ El2p ss count)
|
||||
(defun El2p (ent / sngIncrement sngPosition pedacept)
|
||||
(setq obj (vlax-ename->vla-object ent)
|
||||
EnTyp (cdr (assoc 0 (entget ent)))
|
||||
)
|
||||
(princ "\nEntity Type = ")(princ EnTyp)
|
||||
(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")
|
||||
(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")
|
||||
(setq ent (entlast)
|
||||
obj (vlax-ename->vla-object ent)
|
||||
)
|
||||
(vlax-dump-object EOBJ) ; List object properties
|
||||
(vl-catch-all-apply 'vla-put-Layer (list EOBJ ELA))
|
||||
(vl-catch-all-apply 'vla-put-Linetype (list EOBJ ELT))
|
||||
(vl-catch-all-apply 'vla-put-LinetypeScale (list EOBJ ELS))
|
||||
(vl-catch-all-apply 'vla-put-PlotStyleName (list EOBJ PltSty))
|
||||
(vl-catch-all-apply 'vla-put-TrueColor (list EOBJ 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, Splines, Circles, Ellipses, and Ellipse Arcs: ")
|
||||
(setq count 0)
|
||||
(if (setq ss (ssget '((0 . "line,arc,spline,circle,ellipse"))))
|
||||
(repeat (sslength ss)
|
||||
(el2p (ssname ss count))
|
||||
(setq count (1+ count))
|
||||
)
|
||||
(princ "\nNo modifyable objects selected!")
|
||||
)
|
||||
(princ)
|
||||
); defun C:El2p
|
||||
Reference in New Issue
Block a user