Emmanuel Delay Posted 9 hours ago Posted 9 hours ago (edited) Just sharing a simple script I just wrote, I don't have a question When drawing the hidden lines of stairs steps (the overlap of the lower step hidden under the step above) I thought: I would like to select all the steps; multi offset them; the offset lines should be selected and gripped, so that I can set them in a different layer (a layer with LType Hidden) ... But feel free to comment, improve, ... ;; Multi Offset. New objects get selected and gripped. ;; For example to make the hidden stairs steps... Select all (defun c:moff ( / sel ss pt3 i off_dst obj elast pickset1) (setq off_dst (getdist "\nOffset Distanct: ")) (setq pt3 (getpoint "\nOffset point: ")) (setq pickset1 (ssadd)) (princ "\nSelect objects: ") (setq ss (ssget)) (setq i 0) (repeat (sslength ss) (setq obj (ssname ss i)) (command "offset" off_dst obj pt3 "") (setq elast (entlast)) ;; (ssadd elast pickset1) (setq i (+ i 1)) ) ;; now grip the pickset (the newly made objects) (sssetfirst nil pickset1) ) Edited 9 hours ago by Emmanuel Delay 2 Quote
Nikon Posted 1 hour ago Posted 1 hour ago I would add: I'm not a lisp programmer... ; Original by Emmanuel Delay + additions (defun c:MuOffLay ( / ss pt3 i off_dst obj elast pickset1 old_dst str_prompt) ;; creating a new layer (if (not (tblsearch "LAYER" "OffsetLines")) (command "_-layer" "_make" "OffsetLines" "_color" "1" "OffsetLines" "") ) ;; memorizing the distance (setq old_dst (getenv "MULTIOFF_LASTDST")) (if old_dst (progn (setq str_prompt (strcat " Offset Distance <" old_dst ">: ")) (setq off_dst (getreal str_prompt)) (if (not off_dst) (setq off_dst (atof old_dst)) ) ) (setq off_dst (getdist " Offset Distance: ")) ) (setenv "MULTIOFF_LASTDST" (rtos off_dst 2 3)) (setq pt3 (getpoint " Offset point: ")) (setq pickset1 (ssadd)) (princ " Select objects: ") (setq ss (ssget)) (setq i 0) (while (< i (sslength ss)) (setq obj (ssname ss i)) (command "_.offset" off_dst obj pt3 "") (setq elast (entlast)) (command "_.chprop" elast "" "_la" "OffsetLines" "_color" "1" "") (ssadd elast pickset1) (setq i (1+ i)) ) (sssetfirst nil pickset1) (princ) ) Quote
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.