Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

coils in autodesk

Status
Not open for further replies.

caddahkter

Technical User
Oct 8, 2003
2
US
does anyone know how to draw a 3D coil in autodesk 2004? i have been trying for days and cannot figure it out. please help its driving me nuts!!!!!
 
Try the program below. It works wonder for me.
Thank the Author. Hope it helps.

Also, check out this web link:

*********************************************************

;;; A.Dudek
;;; 3DSPIRAL.LSP
;;; Copyright (C) 1993 by Autodesk, Inc.
;;;
;;; Permission to use, copy, modify, and distribute this software
;;; for any purpose and without fee is hereby granted, provided
;;; that the above copyright notice appears in all copies and that
;;; both that copyright notice and this permission notice appear in
;;; all supporting documentation.
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;; DESCRIPTION
;;;
;;; This is a programming example.
;;;
;;; Designed and implemented by Kelvin R. Throop in January 1985
;;;
;;; This program constructs a spiral. It can be loaded and called
;;; by typing either "spiral", "3dspiral" or the following:
;;; (cspiral <# rotations> <base point> <horiz growth per rotation>
;;; <points per circle> <start radius>
;;; <vert growth per rotation>).
;;;
;;;
;;; Revision 3/9/95 Anthony Dudek
;;; Fixed problem of not drawing a full 360 degree helix when using only one
;;; rotation of 3dpolyline
;;;

(defun myerror (s) ; If an error (such as CTRL-C) occurs while this command is active...
(if (/= s &quot;Function cancelled&quot;)
(princ (strcat &quot;\nError: &quot; s))
)
(setvar &quot;cmdecho&quot; ocmd) ; Restore saved modes
(setvar &quot;blipmode&quot; oblp)
(setq *error* olderr) ; Restore old *error* handler
(princ)
)

(defun cspiral (ntimes bpoint hfac lppass strad vfac / ang dist tp ainc dhinc dvinc circle dv)

(setvar &quot;blipmode&quot; 0) ; turn blipmode off
(setvar &quot;cmdecho&quot; 0) ; turn cmdecho off
(setq circle (* 3.141596235 2))
(setq ainc (/ circle lppass))
(setq dhinc (/ hfac lppass))
(if vfac (setq dvinc (/ vfac lppass)))
(setq ang 0.0)
(if vfac
(setq dist strad dv 0.0)
(setq dist 0.0)
)
(if vfac
(command &quot;_3dpoly&quot;) ; start spiral ...
(command &quot;_pline&quot; bpoint) ; start spiral from ;base point and...
)
(repeat ntimes
;;;
;;; section of revised code

(if (= ntimes 1) ; if the number of
;rotations is 1
(repeat (1+ lppass) ; then calculate points ;one extra time to allow
; for the missing polyline segment at the end of
; the rotation
(setq tp (polar bpoint (setq ang (+ ang ainc))
(setq dist (+ dist dhinc))
)
)
(if vfac
(setq tp (list (car tp) (cadr tp) (+ dv (caddr tp)))
dv (+ dv dvinc)
)
)
(command tp) ; continue to the next point...
);close inner repeat
;;;
;otherwise
(repeat lppass
(setq tp (polar bpoint (setq ang (+ ang ainc))
(setq dist (+ dist dhinc))
)
)
(if vfac
(setq tp (list (car tp) (cadr tp) (+ dv (caddr tp)))
dv (+ dv dvinc)
)
)
(command tp) ; continue to the next point...
);close inner repeat
);close if
);close main repeat
(command &quot;&quot;) ; until done.
(princ)
);close defun

;;;
;;; Interactive spiral generation
;;;

(defun C:SPIRAL (/ olderr ocmd oblp nt bp cf lp)
(command &quot;.undo&quot; &quot;group&quot;)
(setq olderr *error*
*error* myerror)
(setq ocmd (getvar &quot;cmdecho&quot;))
(setq oblp (getvar &quot;blipmode&quot;))
(setvar &quot;cmdecho&quot; 0)

(initget 1) ; bp must not be null
(setq bp (getpoint &quot;\nCenter point: &quot;))
(initget 7) ; nt must not be zero, neg, or null
(setq nt (getint &quot;\nNumber of rotations: &quot;))
(initget 3) ; cf must not be zero, or null
(setq cf (getdist &quot;\nGrowth per rotation: &quot;))
(initget 6) ; lp must not be zero or neg
(setq lp (getint &quot;\nPoints per rotation <30>: &quot;))
(cond ((null lp) (setq lp 30)))
(cspiral nt bp cf lp nil nil)
(setvar &quot;cmdecho&quot; ocmd)
(setvar &quot;blipmode&quot; oblp)
(setq *error* olderr) ; Restore old *error* handler

(princ)
(command &quot;.undo&quot; &quot;end&quot;)
)

;;;
;;; Interactive spiral generation
;;;

(defun C:3DSPIRAL (/ olderr ocmd oblp nt bp hg vg sr lp)
(command &quot;.undo&quot; &quot;group&quot;)
(setq olderr *error*
*error* myerror)
(setq ocmd (getvar &quot;cmdecho&quot;))
(setq oblp (getvar &quot;blipmode&quot;))
(setvar &quot;cmdecho&quot; 0)
(initget 1) ; bp must not be null
(setq bp (getpoint &quot;\nCenter point: &quot;))
(initget 7) ; nt must not be zero, neg, or null
(setq nt (getint &quot;\nNumber of rotations: &quot;))
(initget 7) ; sr must not be zero, neg, or null
(setq sr (getdist bp &quot;\nStarting radius: &quot;))
(initget 1) ; cf must not be zero, or null
(setq hg (getdist &quot;\nHorizontal growth per rotation: &quot;))
(initget 3) ; cf must not be zero, or null
(setq vg (getdist &quot;\nVertical growth per rotation: &quot;))
(initget 6) ; lp must not be zero or neg
(setq lp (getint &quot;\nPoints per rotation <30>: &quot;))
(cond ((null lp) (setq lp 30)))
(cspiral nt bp hg lp sr vg)
(setvar &quot;cmdecho&quot; ocmd)
(setvar &quot;blipmode&quot; oblp)
(setq *error* olderr) ; Restore old *error* handler
(princ)
(command &quot;.undo&quot; &quot;end&quot;)
)
(defun C:3s ()
(C:3dspiral))
;;;
(princ &quot;\n\tC:SPIRAL and C:3DSPIRAL loaded. &quot;)
(princ &quot;\n\tStart 3DSPIRAL command with 3S&quot;)
(princ)
 
I once spent far, far to long drawing a coil with as 3d polyline path and a circle object. I then extruded the circle around the path.

It looks rubish and you can not use a spline but what do you expect for an outdated package that cost upwards of 3 grand?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top