J-LYLE
16th Mar 2005, 08:19 pm
ok ive made some adjustments to the previous posted lisp(thanks for your help Paul) and i wanted to add a couple of more things.
1. I want to turn the whole thing into a block with the block name coming from the user input that created it in the first place ie "Enter Radius of elbow" -12 "Enter size Pipe"-4 then blk name 4p12 or 4-12 or something like that.
2. i want to prompt the user for rotation around insertion point. I think i can get this maby if i can figure out how to make it a block then just ill just do (command "rotate" p "" d1 pickpoint)? right or something close?
(defun c:elb()
(setq d1 (getpoint "\n Pick point start of elbow:"))
(setq d2 (getdist "\n Enter Radius of elbow:"))
(setq d4 (getdist "\n Enter size Pipe:"))
(setq os (/ d4 2))
(setq p1 (polar d1 0 os))
(setq p2 (polar d1 pi os))
(setq bp1(polar p1 (* pi 0.5)(* d4 2)))
(setq bp2(polar p2 (* pi 0.5)(* d4 2)))
(setq cp (polar bp2 0 (+ d2 os)))
(setq tp1 (polar cp (* pi 0.5)(- d2 os)))
(setq tp2 (polar tp1 (* pi 0.5)d4))
(setq p3 (polar tp1 0 (* d4 2)))
(setq p4 (polar tp2 0 (* d4 2)))
(command "arc" "ce" cp tp1 bp1)
(command "arc" "ce" cp tp2 bp2)
(command "pline" bp2 p2 p1 bp1 "")
(command "pline" tp2 p4 p3 tp1 "")
(princ)
)
1. I want to turn the whole thing into a block with the block name coming from the user input that created it in the first place ie "Enter Radius of elbow" -12 "Enter size Pipe"-4 then blk name 4p12 or 4-12 or something like that.
2. i want to prompt the user for rotation around insertion point. I think i can get this maby if i can figure out how to make it a block then just ill just do (command "rotate" p "" d1 pickpoint)? right or something close?
(defun c:elb()
(setq d1 (getpoint "\n Pick point start of elbow:"))
(setq d2 (getdist "\n Enter Radius of elbow:"))
(setq d4 (getdist "\n Enter size Pipe:"))
(setq os (/ d4 2))
(setq p1 (polar d1 0 os))
(setq p2 (polar d1 pi os))
(setq bp1(polar p1 (* pi 0.5)(* d4 2)))
(setq bp2(polar p2 (* pi 0.5)(* d4 2)))
(setq cp (polar bp2 0 (+ d2 os)))
(setq tp1 (polar cp (* pi 0.5)(- d2 os)))
(setq tp2 (polar tp1 (* pi 0.5)d4))
(setq p3 (polar tp1 0 (* d4 2)))
(setq p4 (polar tp2 0 (* d4 2)))
(command "arc" "ce" cp tp1 bp1)
(command "arc" "ce" cp tp2 bp2)
(command "pline" bp2 p2 p1 bp1 "")
(command "pline" tp2 p4 p3 tp1 "")
(princ)
)