četvrtak, 28. srpnja 2022.

LISP AutoCAD - Spline To Polyline Conversion

LISP AutoCAD - Spline  To  Polyline Conversion

1-- Copy/paste the code into Notepad. Save the file as spline2pline.lsp (in the support directory of AutoCad).
3--Open AutoCad, Menu: Tools->Load Application-> browse to spline2pline.lsp, click "Load", click "Close"
4--At the command line type: S2P
5--Have a nice day


;;;CADALYST 06/05 Tip2039: Spline2Pline.lsp Spline to Polyline Conversion (c) Lloyd Beachy
;; Spline2Pline.lsp (c) 2005 Lloyd Beachy
;; Routine to convert splines to plines
(Defun C:S2P (/ ss pt# cmdecho osmode clayer count ent lay lng pt-list cnt)
(vl-load-com)
(setq ss (ssget '((0 . "spline")))
pt# (getint "Enter number of segments <100>:")
cmdecho (getvar "cmdecho")
osmode (getvar "osmode")
clayer (getvar "clayer")
count 0 ;spline counter
);end setq
(if(null pt#)(setq pt# 100))
(setvar "cmdecho" 0)
(command ".undo" "begin") ;begin undo group
(setvar "osmode" 0)
(repeat(sslength ss) ;repeat for each spline
(setq ent (vlax-ename->vla-object (ssname ss count));change spline to vla-object
lay (vlax-get-property ent "layer") ;spline's layer
lng (vlax-curve-getDistAtPoint ent(vlax-curve-getEndPoint ent));length of spline
pt-list(list(vlax-curve-getStartPoint ent)) ;coords for start of spline
cnt 1.0 ;segment counter
);end setq
(repeat pt# ;repeat for each segment
(setq pt-list(cons(vlax-curve-getPointAtDist ent (* lng(/ cnt pt#)))pt-list));add segment's point to pt-list
(setq cnt(1+ cnt)) ;counter to next segment
);end segment repeat
(setq cnt 0) ;pline counter
(setvar "clayer" lay) ;match spline's layer
(command ".pline" ;start "pline" command
(repeat(length pt-list) ;repeat for each point
(command(nth cnt pt-list)) ;enter current point
(setq cnt(1+ cnt)) ;counter to next point
"" ;return value to close "pline" command
);end point repeat
);end command
(setq count(1+ count)) ;counter to next spline
);end spline repeat
(command ".erase" ss "")
(setvar "osmode" osmode)
(setvar "clayer" clayer)
(command ".undo" "end") ;end of undo group
(setvar "cmdecho" cmdecho)
(princ) ;exit quietly
);end C:S2P

AutoCAD - www.cadforum.cz

 AutoCAD - www.cadforum.cz

https://www.cadforum.cz/

CADforum Home

CAD Discussion

Tips & Tricks

AutoCAD tips
Inventor tips
Revit tips
CAM tips
CAD tipy (CZ)
CAD glossary
CAD product keys/SP
CAD formats
AutoCAD commands
AutoCAD variables
CAD converters
CAD videos
CAD programming (CZ)

Downloads
CAD freeware
Catalog of CAD blocks

CAD/BIM Blocks
AutoCAD DWG blocks
Revit RFA families
Inventor IPT parts
3D CAD models
DWG dynamic blocks
top brand libraries
AEC-data library
WATG library
LEGO library
PartCommunity
add block - upload

Converters

phys. units converter
map coords converter
CAD formats
STL2DWG converter
barcode generator
STL/OBJ/3DS viewer
IFC viewer
2D nesting
EN-CZ CAD glossary (CZ)
AutoCAD commands

CAD Videos

Web Links

SW Development

CAD Shop

LISP AutoCAD - CAD Utilities and add-ins - www.cadstudio.cz

 LISP AutoCAD - CAD Utilities and add-ins - www.cadstudio.cz

https://www.cadstudio.cz/en/download.asp?ccat=33

LISP AutoCAD - blog.draftsperson.net

LISP AutoCAD - blog.draftsperson.net

https://blog.draftsperson.net/

https://blog.draftsperson.net/category/autolisp/

LISP AutoCAD - cadalyst.com

LISP AutoCAD - cadalyst.com

https://cadtips.cadalyst.com/

https://cadtips.cadalyst.com/standard-blocks/steel-shapes-all-types-and-sizes

LISP AutoCAD - Useful lisp files

LISP AutoCAD - Useful lisp files

More than 30 lisp files, very useful, ready to download.

http://www.svebor.com/

http://www.svebor.com/lisp/

Name                Last modified      Size
3DF2PL.LSP    2010-06-03 21:38 2.0K
ARL.lsp    2014-01-27 15:18 1.4K
AUTODIM.LSP       2010-06-03 21:38 5.0K
AsmiTools_Ordi.lsp       2010-06-03 21:38 3.5K
CISTEXT.LSP       2010-06-03 21:38 1.3K
EXDWG.LSP       2010-06-03 21:38 203
FLAYER.LSP       2010-06-03 21:38 1.2K
Gtools2014.rar       2016-02-13 10:47 150K
IntelliJoin.LSP       2010-06-03 21:38 16K
OKVIR.LSP       2010-06-03 21:38 4.8K
PO2TXT.lsp       2010-06-03 21:38 495
SSETVAL__v100__Selec..> 2019-03-22 12:12 5.7K
Spline2Pline.lsp       2010-06-03 21:38 1.9K
Tailors.zip       2010-06-03 21:38 157K
VBORD.LSP       2010-06-03 21:38 5.8K
ZEZ.LSP       2010-06-03 21:38 379
acad_anny_table_to_e..> 2014-01-27 15:04 7.7K
chtext.lsp       2010-06-03 21:38 23K
cmark-krug na krajev..> 2019-03-18 09:35 406
cmark-tacka na kraje..> 2019-03-18 09:35 363
depends.vlx       2011-12-19 22:42 15K
flatten.lsp 2010-06-03 21:38 363
getlayouts.vlx       2010-06-03 21:38 12K
increment-copy-copyi..> 2019-03-18 09:35 615
lockallvp.vlx       2010-06-03 21:38 9.1K
mbi.rar       2010-06-03 21:38 3.7K
movtext.LSP       2014-05-20 08:31 1.6K
onall.lsp       2010-06-03 21:38 457
pline-3d-2d.lsp       2010-06-03 21:38 3.4K
pt2elv.lsp       2010-06-03 21:38 1.4K
thawall.lsp       2010-06-03 21:38 494
wro.lsp      2010-06-03 21:38 660