Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Spiral 1

Status
Not open for further replies.

ocloner

Computer
Feb 24, 2003
8
0
0
US
Is it possible to draw a true spiral in Acad. The spiral I'm trying to create is a polyline starting from a center point with a groove spacing of 5/32". I've done it with offset circles but that's not a true spiral. Any help on this would be greatly appreciated.
Thanks,
Ron
 
Replies continue below

Recommended for you

If you search this forum for "spiral" you will find some solutions. I forget how to paste in the threads so I can't put them here.
 
Good luck with a "flat spring" whenever using vanilla ACAD. Circles can be revolved around a Helix easily, but whenever you revolve another shape, it doesn't extrude correctly because the shape twists as it is extruded.
This will draw a helix path, you will need to draw the shape to extrude.


Code:
;  helcon.lsp 
;  mfuccaro@hotmail.com 

(defun C:Helcon() 
  (setq segs 40); segments/turn 
  (setq spin -1); -1=CW, 1=CCW 
  (setq ri (getreal "base radius ") rf (getreal "top radius ")) 
  (initget (+ 1 4)) 
  (setq h (getreal "elevation ")) 
  (initget (+ 1 2 4)) 
  (setq tu (getreal "turns ")) 
  (setq old (getvar "osmode")) 
  (setvar "cmdecho" 0)  
  (setq fi1 (/ (* 2 PI) segs) i 0) 
  (setq points (fix (* tu segs)) 
   h1 (/ h points) r1 (/ (- rf ri) points) 
   s (getpoint "center of base ") 
   end (list (car s) (cadr s) (+ h (caddr s)))) 
  (setvar "osmode" 0 ) 
  (command "line" s end "") 
  (command "chprop" "l" "" "c" 1 "") 
  (command "3dpoly") 
  (setq i 0) 
  (repeat (1+ points) 
    (setq fi (* i fi1) h (* i h1) r (+ ri (* i r1))) 
    (setq x (* r (cos fi)) y (* spin r (sin fi))) 
    (command (list (+ (car s) x) (+ (cadr s) y) (+ (caddr s) h))) 
    (setq i (1+ i))) 
  (command "") 
  (setvar "osmode" old))

Flores
 
THE WAY I WOULD DRAW A TRUE SPIRAL IS TO CALCULATE X,Y,Z POSITIONS OF SEVERAL POINT UNTIL A FULL PITCH IS DEVELOPED; THEN POLYLINE ALL THE POINTS; THEN ARRAY TO THE LENGTH NEEDED;THEN JOIN AND FIT THE POLYLINES.
 
Thanks for all the support. It gives me many ways to figure this out. By the way Chicopee was my home town up until about 6 years ago. Small world.
 
Ron --

Do you want to draw a Spiral? (Each circle is smaller than the previous one, like a piece of thread wrapped around a cone)
Or do you want to draw a Helix? (Each circle is the same size as the previous one, like a piece of thread wrapped around a cylinder.)

Hmmm . . . Rocky
 
To clarify, it would be like a groove in a record. With each succesive wrap having a consistent 5/32" gap. Thanks for all the responses.
 
Hi Ron,

;**************************************************************************
; SPIRAL.LSP
;
; Este progrma construye una espiral. Puede ser cargado y llamado
; introduciendo "spiral" o de la manera siguiente:
; (cspiral <num. rotaciones> <centro> <Crecimiento por rotacion>
; <puntos por rotacion>).
;
; Designed and implemented by Kelvin R. Throop in January 1985
;**************************************************************************

(defun cspiral (ntimes bpoint cfac lppass / ang dist tp ainc dinc circle bs cs)
(setq cs (getvar &quot;cmdecho&quot;)) ; save old cmdecho and blipmode
(setq bs (getvar &quot;blipmode&quot;))
(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 dinc (/ cfac lppass))
(setq ang 0.0)
(setq dist 0.0)
(command &quot;_pline&quot; bpoint) ; start spiral from base point and...
(repeat ntimes
(repeat lppass
(setq tp (polar bpoint (setq ang (+ ang ainc))
(setq dist (+ dist dinc))))
(command tp) ; continue to the next point...
)
)
(command) ; until done.
(setvar &quot;blipmode&quot; bs) ; restore saved blipmode
(setvar &quot;cmdecho&quot; cs) ; restore saved cmdecho
nil
)
;
; Interactive spiral generation
;
(defun C:SPIRAL ( / nt bp cf lp)
(initget 1) ; bp must not be null
(setq bp (getpoint &quot;\nCentro: &quot;))
(initget 7) ; nt must not be zero, neg, or null
(setq nt (getint &quot;\nNumero de rotaciones: &quot;))
(initget 3) ; cf must not be zero, or null
(setq cf (getdist &quot;\nCrecimiento por rotacion: &quot;))
(initget 6) ; lp must not be zero or neg
(setq lp (getint &quot;\nPuntos por rotacion <30>: &quot;))
(cond ((null lp) (setq lp 30)))
(cspiral nt bp cf lp)
)

;-------- Traduccion AUTODESK AG ESPANA (Barcelona, 419 36 29)-------------




Or

Lothar
 
This is the lisp as from the previous link , it is english for a better understood.



;; 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 &quot;AS IS&quot; 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 &quot;spiral&quot;, &quot;3dspiral&quot; 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)


Pardal
 
Be aware that "spiral" is not a specific shape, but there are different shapes of spirals, generated by different equations. Contrast your example with the kind in a snail's shell, where the spacing gets wider as you go out. Each is generated by different equations.

I think the short answer to your question, is no, a true spiral such as you describe can't exist in AutoCAD. A polyline is always made up of arcs and straight lines, and a spiral just isn't composed of arcs and straight lines. The radius of curvature continuously changes along the length. Ditto on on a helix, where the curvature doesn't change, but the plane of the curvature does.
 
Status
Not open for further replies.
Back
Top