Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

springs

Status
Not open for further replies.

aeroheroes

New member
Mar 31, 2002
2
How to draw springs in autocad?, How to write a vlisp program in acad to draw a spring?
 
Replies continue below

Recommended for you

Look at this post
thread555-13480 link to the lisp file returns an error
use this link
Then under downloads click on code archive navigate to 1997
then select the month of October. this will have the code you need to create a spring. It's actually a heilicoil lisp
but basiclly the same thing
Good luck
[shadeshappy]
 
Try this one

It not mine, I got from By Scott Hull at CADALOG.


(defun C:SPIRAL (/ #ANG #ANG-DT #ANG-TAN #COILS
#DIA #LST #OSMODE #PITCH #PT #PT-0 #PT-1 #RAD
#RES #SEGS #TAN-0 #TAN-1 #Z #Z-DT #Z-END
#Z-TAN *error*)

(defun *error* (%A)
(if #OSMODE
(setvar "osmode" #OSMODE))
(cond
((= %A "Function cancelled") nil)
(t (princ (strcat "\nerror: " %A "\007\n"))))
(princ))

(if (not V:SPIRAL-DIA)
(setq V:SPIRAL-DIA 1.0))
(initget 6)
(setq #DIA (getreal
(strcat &quot;\nDiameter <&quot; (rtos V:SPIRAL-DIA) &quot;>: &quot;)))
(if (not #DIA)
(setq #DIA V:SPIRAL-DIA)
(setq V:SPIRAL-DIA #DIA))
(if (not V:SPIRAL-PITCH)
(setq V:SPIRAL-PITCH 0.25))
(initget 6)
(setq #PITCH (getreal
(strcat &quot;\nPitch <&quot; (rtos V:SPIRAL-PITCH) &quot;>: &quot;)))
(if (not #PITCH)
(setq #PITCH V:SPIRAL-PITCH)
(setq V:SPIRAL-PITCH #PITCH))
(if (not V:SPIRAL-COILS)
(setq V:SPIRAL-COILS 8))
(initget 6)
(setq #COILS (getint
(strcat &quot;\nNumber of coils <&quot; (itoa V:SPIRAL-COILS) &quot;>: &quot;)))
(if (not #COILS)
(setq #COILS V:SPIRAL-COILS)
(setq V:SPIRAL-COILS #COILS))
(initget 1)
(setq #PT-0 (getpoint &quot;\nCenterpoint: &quot;)
#RES 16
#RAD (* #DIA 0.5)
#ANG-DT (/ (* 2 pi) #RES)
#ANG 0.0
#SEGS (* #COILS #RES)
#Z-DT (/ #PITCH #RES)
#Z 0.0)
(repeat #SEGS
(setq #PT-1 (polar #PT-0 #ANG #RAD)
#PT-1 (list (car #PT-1)
(cadr #PT-1)
(+ (caddr #PT-1) #Z))
#LST (cons #PT-1 #LST)
#ANG (+ #ANG #ANG-DT)
#Z (+ #Z #Z-DT)))
(setq #LST (reverse #LST)
#ANG-TAN (/ pi 500)
#Z-TAN (* 0.001 #PITCH)
#TAN-0 (polar #PT-0 (- #ANG-TAN) #RAD)
#TAN-0 (list (car #TAN-0)
(cadr #TAN-0)
(- (caddr #TAN-0) #Z-TAN))
#Z-END (caddr (last #LST))
#TAN-1 (polar #PT-0 #ANG-TAN #RAD)
#TAN-1 (list (car #TAN-1)
(cadr #TAN-1)
(+ #Z-END #Z-TAN)))
(setq #OSMODE (getvar &quot;osmode&quot;))
(setvar &quot;osmode&quot; 0)
(setvar &quot;cmdecho&quot; 0)
(command &quot;_.spline&quot;)
(foreach #PT #LST (command #PT))
(command &quot;&quot; #TAN-0 #TAN-1)
(setvar &quot;osmode&quot; #OSMODE)
(princ))

Feel free to contact me I'm working on spirals. You can reach me at k281969@hotmail.com
but keep your post here for mutual benefits.
Pardal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor