need help with a lsp routine

I have written the following maco, but need it in a lisp routine. I also need the lisp routine to loop, so that I can continue selecting lines
till I'm ready to stop.
[Beams2]^C^C^Po;12;\\;change;l;;p;la;fn-beam;;
This macro offsets a selected line 12" and changes the new line to a specific layer.
Can someone help me with this?
Thanks, jojo
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

ok, why can't it be this easy?
(defun C:otl () (command "offset" "12") (command "chprop" "l" "" "la" "fn-beam" "") (princ) )
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Because you want it to loop. You have to set up a WHILE with a criterion that will exit when you want to.
(defun C:otl (/ n) (setvar "cmdecho" 1) (while (not n) (if(eq a nil)(exit)) (command "OFFSET" 12 pause pause "") (setq c (entlast)) (command "CHPROP" c "" "LA" "1" "") ) (princ) )
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Ooops. Replace "fn-beam" for "1" in the CHPROP line. I tested it using a drawing with a layer "1".... If you allowed user input to set the offset, you might get more use out of it, jojo.
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks for the tweak...I'm setting this one up for the engineer, who does not want options. Click and go.
I really do appreciate your help..My boss is an "instant gratification" kinda guy, and I am no "lisp queen". ;-)
jojo

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Micheal...got time to look at this? it returns an error. I changed the name, and the layer to fn-beam, and that is all.
I loaded it in appload, then typed "offbeam" but it does not work...any ideas? Thanks, jojo
(defun C:OFFBEAM (/ n) (setvar "cmdecho" 1) (while (not n) (if(eq a nil)(exit)) (command "OFFSET" 12 pause pause "") (setq c (entlast)) (command "CHPROP" c "" "LA" "fn-beam" "") ) (princ) )
Command: OFFBEAM ; error: quit / exit abort

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Sorry just delete the (if(eq a nil)(exit)) line. I should have commented it out. It was a leftover from another version.
MichaelB www.michaelbulatovich.ca

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Thank you SO MUCH!!! It worked like a charm!
jojo
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Take a penny, leave a penny ; )
--


MichaelB
www.michaelbulatovich.ca
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Can someone help me edit this? I need it to offset 12" and I need the layer to be fn-beam, not current. Thanks, jojo
; From the desk of Paul Standing ; Routine will offset set objects to the current layer ; Offset_to_layer v 1.0 march 25 1995
(defun C:Off_to_lay() (setvar "cmdecho" 0) (setq c_layer (getvar "clayer") last (getvar "offsetdist")) (prompt "\nOffset distance or through" ) (setq dist (getdist)) (if (or (= dist nil)(= dist "")) (setq dist last) ) (setq obj (entsel "\nSelect object to offset:")) (setq pick_pt (car(cdr obj))) (setq ent (car obj)) (setq side_pt (getpoint "\nside to offset")) (command "offset" dist pick_pt side_pt "") (setq ent1 (entlast)) (setq ptlst (entget ent1) b (assoc 8 ptlst) c (cons 8 c_layer) d (subst c b ptlst)) (entmod d) (princ) )
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.