LISP: 3D Spiral

Post new topic   Reply to topic

View previous topic View next topic Go down

LISP: 3D Spiral

Post by architech on Thu Nov 13, 2008 10:20 pm

To do what you ask, you need to approach this like doing handrails for a stair.
You do 36 inch posts and place them in a circle, then pull each post up 7 or 9 inches in the air ... just like climbing a spiral stair.
Then do a "3DPOLY" and snap to each endpoint of the top post.
Now draw a circle in "FRONT VIEW" ... so change the UCS as needed.
Now do the "EXTRUDE" command along the path.
Instant spring! Or handrail ....
.
.
.
.
.
Or you can try this LISP found at XANADu.
Attached is the 3DSpiral.LSP
Hope that helps.

http://www.mediafire.com/file/yyqjwdymolm/3DSPIRAL.zip

_________________
...Smile, the work will always be there but you don't have to be...

architech
Admin

Number of posts: 399
Age: 39
Location: East Coast
Registration date: 2008-11-08

View user profile

Back to top Go down

Re: LISP: 3D Spiral

Post by architech on Thu Nov 13, 2008 10:21 pm

Originally Posted by Farzad

The following autolisp program adds a coomand named "H3" to drawing session. It requests you the center, radius, pitche, no. of revolutions, and no. of steps in each revolution to create a 3d helix. If you use the created 3dpoliline as an extrusion path, it will rotate the section around the path. So it is suitable for circular sections. To create 3d helical models with non-circular sections, you have to use the Autodesk Mechanical Desktop or some other parametric modeling applications.
;;;;; Farzad
;;;;; Jan 27 2003
(defun C:h3(/ c r p n nr ps pb pe Beta dBeta z dz vertex )
(setq c (getpoint "\n Center : "))
(setq r (getdist c "\n Radius : "))
(setq p (getdist "\n Pitch : "))
(setq n (getreal "\n No. of revolutions : "))
(setq nr (getint "\n No. of steps in each round : "))
(setq ps '((0 . "POLYLINE") (100 . "AcDbEntity") (67 . 0) (100 . "AcDb3dPolyline") (66 . 1) (10 0.0 0.0 0.0) (70 . Cool (40 . 0.0) (41 . 0.0) (210 0.0 0.0 1.0) (71 . 0) (72 . 0) (73 . 0) (74 . 0) (75 . 0)))
(setq pb '((0 . "VERTEX") (100 . "AcDbEntity") (67 . 0) (100 . "AcDbVertex") (100 . "AcDb3dPolylineVertex") (10 0.0 0.0 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (70 . 32) (50 . 0.0) (71 . 0) (72 . 0) (73 . 0) (74 . 0)))
(setq pe '((0 . "SEQEND")))
(entmake ps)
(setq z 0.0)
(setq dz (/ p nr))
(setq dBeta (/ (* 2 pi) nr))
(setq Beta 0.0)
(while (<= Beta (* n (* 2 pi)))
(setq vertex (list (+ (car c) (* r (cos Beta)))
(+ (cadr c) (* r (sin Beta)))
(+ (caddr c) z)
)
)
(setq pb (subst (append '(10) vertex) (assoc 10 pb) pb))
(entmake pb)
(setq z (+ z dz))
(setq Beta (+ Beta dBeta))
)
(entmake pe)
(princ)
)

_________________
...Smile, the work will always be there but you don't have to be...

architech
Admin

Number of posts: 399
Age: 39
Location: East Coast
Registration date: 2008-11-08

View user profile

Back to top Go down

Re: LISP: 3D Spiral

Post by architech on Thu Nov 13, 2008 10:22 pm

Hi architech,
Here trick to create 3d spring,it have two system creating spring
1).Manual system (look at attach file)
2).Program system,look this below



; ccs is stand for Create Coil Spring
; Design by : Adesu <Ade Suharna>
; Email : mteybid@yuasabattery.co.id
; Homepage : http://www.yuasa-battery.co.id
; Create : 24 March 2005
; Program no.: 219/03/2005
; Edit by : Adesu 13/05/2005 1).
; Kevin Nehls 16/05/2005 2).
; Adesu 11/07/2005 3).
; 04/08/2005 4).remove render ("2).")
; 03/09/2005 5).remove ssadd,el3,isolines
; 19/09/2005 6).add error system


(defun c:ccs (/ *error* om lay seg ang cnt rad pit len leng x y z point el p1
rads el1 el2)
(setq *error* myer) ; 6).
(setq om (getvar "osmode")) ; 5).
(setvar "osmode" 0)
(setq lay (getvar "clayer"))
(if
(/= lay "SPRING")
(command "_layer" "m" "SPRING" "c" 1 "" "")
)
(setq seg 36) ; in one circle become 36 part
(setq ang (/ (* 2 pi) seg)) ; (* 2 pi) in radian = 360
(setq cnt 0)
(setq rad (getdist "\nENTER NEW RADIUS<10>: ")) ; 3
(if (= rad nil)(setq rad 10))
(setq pit (getreal "\nENTER NEW PITCH<3>: ")) ; 3
(if (= pit nil)(setq pit 3.0))
(setq len (getdist "\nENTER LENGTH OF SPRING<25>: ")) ; 3
(if (= len nil)(setq len 25))
(setq leng (fix (/ len pit)))
(command "_vpoint" "r" 315 25 "")
(command "_3dpoly")
(repeat leng
(repeat (1+ seg)
(setq x (* rad (sin (* cnt ang))))
(setq y (* rad (cos (* cnt ang))))
(setq z (* cnt (/ pit seg)))
(setq point (list x y z))
(command point)
(setq cnt (1+ cnt))
)
)
(command "")
(setq el (entlast)) ; 1).
(setq p1 (polar (list 0 0 0)(* pi 0.5) rad)) ; 1).
(command "_zoom" "d" "")
(setq rads (getdist "\nENTER RADIUS OF WIRE<1.25>: ")) ; 3).
(if (= rads nil)(setq rads 1.25))
(cond ((= rads pit)(setq rads (* pit 0.45)))
((> rads pit)(setq rads (* pit 0.45)))
((> rads (/ pit 2.0))(setq rads (* pit 0.45)))
) ; 3).
(command "_circle" p1 rads) ; 1).
(setq el1 (entlast))
(if (not (member "geom3d.arx" (arx))) ; 1).
(arxload "geom3d")) ; 1).
(rotate3d el1 "y" p1 "r" 0 90) ; 1).
(setq el2 (entlast))
(command "_extrude" el2 "" "p" el) ; 1).
(command "_zoom" "e" "")
(command "_erase" el "") ; 1).
(command "_regen")
(command "_shademode" "g") ; 3).
(setvar "osmode" om)
(setq *error* nil) ; 6).
(princ)
)
(defun myer (msg) ; 6).
(setvar "osmode" om)
(setq att "***Resetting system variable was done***")
(princ att)
)

_________________
...Smile, the work will always be there but you don't have to be...

architech
Admin

Number of posts: 399
Age: 39
Location: East Coast
Registration date: 2008-11-08

View user profile

Back to top Go down

Re: LISP: 3D Spiral

Post by architech on Thu Nov 13, 2008 10:24 pm

From Adesu

http://www.mediafire.com/file/nmwhk5yygxq/How to create 3d spring.zip

_________________
...Smile, the work will always be there but you don't have to be...

architech
Admin

Number of posts: 399
Age: 39
Location: East Coast
Registration date: 2008-11-08

View user profile

Back to top Go down

View previous topic View next topic Back to top


Permissions of this forum:
You cannot reply to topics in this forum