I need 2 lisps to streamline a workflow, hope there is someone who can help...
1. Cylinder from Line
Command: CL
CYLINDER FROM LINE Select Line or specify [Radius] ,<265.0>:
(The lisp saves the last used Radius for the session and draws a cylinder of saved radius with centre line along the line)
2. Cylinder from 2 Points
Command: CTP
CYLINDER FROM 2 POINTS Select First Point or specify [Radius] ,<265.0>:
Select Second Point:
(The lisp saves the last used Radius for the session and draws a cylinder of saved radius with centre line from one point to the other)
Anyone keen for the challenge?
Do a Search for "tube" and/or "cylinder" and you'll find a lot of threads, some of which may well do exactly what you want already. One of them probably contains this, that I did a while back [I haven't plowed through to find which one]:
(defun C:TUBE (/ ss ent)
(initget (if *tubedia 6 7)); no 0, no negative, no Enter on first use
(setq *tubedia
(cond
((getdist
(strcat
"\nDiameter of Tubular Cross-Section(s)"
(if *tubedia (strcat " <" (rtos *tubedia) ">") ""); offer default only on subsequent use
": "
); strcat
); getdist
); User-gives-distance condition
(*tubedia); Enter for default on subsequent use
); cond
); setq
(prompt "\nTo make tubular extrusions along paths,")
(setq ss (ssget '((0 . "*POLYLINE,LINE,ARC,CIRCLE,ELLIPSE,SPLINE"))))
(repeat (sslength ss)
(setq ent (ssname ss 0))
(command
"_.ucs" "_ZA"
(vlax-curve-getStartPoint ent)
(mapcar '+
(getvar 'lastpoint)
(vlax-curve-getFirstDeriv ent (vlax-curve-getStartParam ent))
); mapcar & UCS
"_.circle" "0,0" (/ *tubedia 2)
"_.ucs" "_previous"
"_.extrude" (entlast) "" "_path" ent
); command
(ssdel (ssname ss 0) ss)
); repeat
); defun
It works on lots of entity types, whether you use it on any other than Lines or not. It does remember the User's diameter and offers it as a default on subsequent use. Are you capable of editing it to ask for the Radius instead of the Diameter, and to make a version that asks for two points instead of the selection of an object?
I used this routine on my project and it works great! Thank you very much