stapelbergp Posted August 15, 2014 Share Posted August 15, 2014 (edited) Good day everyone. I have only started with LISP programming a few hour ago. I want the following to happen with my LISP: create a circle, extrude the circle create a helix on the previous extrusion delete the 1 solid from the other to create a screw thread. I managed to create the circle and extrude it but I'm not sure how to start with the helix in the same LISP. and then the solid subtraction. Any help would be appreciated. here is the code that I have: (defun c:circ() (setq bp (getpoint "pick basepoint of circle:")) (setq rad (getint "enter radius of circle:")) (command "circle" bp rad"") (command "extrude" "all") (setq hel (getpoint "pick basepoint of helix:")) (setq rad1 (getint "enter radius of helix:")) (setq toprad (getint"enter top rarius of helix:")) (setq height (getpoint"specify height of helix:")) (command "helix" hel rad1 toprad height"") ) Edited August 16, 2014 by stapelbergp Quote Link to comment Share on other sites More sharing options...
GP_ Posted August 15, 2014 Share Posted August 15, 2014 To get started... (defun c:test ( / bp rad height cyl hel d p1 p2 p3 p4) (setq bp (getpoint "pick basepoint:")) (setq rad (getdist "\nenter radius:")) (setq height (getdist "specify height:")) (command "_cylinder" bp rad height) (setq cyl (entlast)) (command "_helix" bp rad rad height) (setq hel (entlast)) (setq d (* rad 0.1)) (setq p1 (polar bp (* pi 0.25) d)) (setq p2 (polar bp 0 (* d (sqrt 2.0)))) (setq p3 (polar bp (* pi 1.75) d)) (setq p4 (polar bp 0 (sqrt (/ (* d d) 2)))) (command "_pline" "_non" bp "_non" p1 "_non" p2 "_non" p3 "_c") (setq square (entlast)) (command "_sweep" square "" "_b" "_non" p4 hel) (setq thread (entlast)) (command "_subtract" cyl "" thread "") (entdel hel) (entdel square) (princ) ) Quote Link to comment Share on other sites More sharing options...
stapelbergp Posted August 15, 2014 Author Share Posted August 15, 2014 (edited) Thanks for the help. Much appreciated!!! Is there a way to give the user the option to select what shape is gonna be swept along the helix? Edited August 15, 2014 by stapelbergp Quote Link to comment Share on other sites More sharing options...
stapelbergp Posted August 15, 2014 Author Share Posted August 15, 2014 (edited) Here is my current code: (defun c:circ ( / bp rad height cyl hel d p1 p2 p3 p4) (setq bp (getpoint "pick basepoint:")) (setq rad (getdist "\nenter radius:")) (setq height (getdist "specify height:")) (setq height1 (getdist "specify height:")) (setq turns (getdist "specify turns:")) (command "_cylinder" bp rad height) (setq cyl (entlast)) (command "_helix" bp rad rad height1 turns) (setq hel (entlast)) (setq d (* rad 0.1)) (setq p1 (polar bp (* pi 0.25) d)) (setq p2 (polar bp 0 (* d (sqrt 2.0)))) (setq p3 (polar bp (* pi 1.75) d)) (setq p4 (polar bp 0 (sqrt (/ (* d d) 2)))) (command "_pline" "_non" bp "_non" p1 "_non" p2 "_non" p3 "_c") (setq square (entlast)) (command "_sweep" square "" "_b" "_non" p4 hel) (setq thread (entlast)) (command "_subtract" cyl "" thread "") (entdel hel) (entdel square) (princ) ) Edited August 16, 2014 by stapelbergp Quote Link to comment Share on other sites More sharing options...
Snownut Posted August 15, 2014 Share Posted August 15, 2014 Please use code tags the # sign in the menu above the text window when you are entering a post, makes it much easier for others to understand... Quote Link to comment Share on other sites More sharing options...
stapelbergp Posted August 16, 2014 Author Share Posted August 16, 2014 Good evening all. Can anyone assist me with my lisp code? how do I give the user the option to select the shape to be swept along the spiral? and how do I get it on the Z axis? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.