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

Reply to
jojo
Loading thread data ...

ok, why can't it be this easy?

(defun C:otl () (command "offset" "12") (command "chprop" "l" "" "la" "fn-beam" "") (princ) )

Reply to
jojo

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) )

Reply to
jojo

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) )

Reply to
Michael Bulatovich

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.

Reply to
Michael Bulatovich

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

Reply to
jojo

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

Reply to
jojo

Sorry just delete the (if(eq a nil)(exit)) line. I should have commented it out. It was a leftover from another version.

MichaelB

formatting link

Reply to
Michael Bulatovich

Thank you SO MUCH!!! It worked like a charm!

jojo

Reply to
jojo

Take a penny, leave a penny ; )

Reply to
Michael Bulatovich

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.