Jump to content

Offset x units and move the offseted objects to y layer


Recommended Posts

Posted

Hi

 

I want to compose autolisp to Offset x units and move the offseted objects to y layer.

 

Thanks

Shay

Posted

this thread is over my understanding as im totaly new to autolisp (but i do have expirience in other languages)

 

ive come across this code but i hardly understand it

 

i add comments wtih questions

 


(defun c:test (/ n ss p e); 1. what the switch / means?

(if
   (and (setq n (getdist "\n Specify the Offset Distance 
:"));2.what the use of "and" 
here?

(setq
          ss (ssget 
"_+.:S:L" '((0 . "*POLYLINE,*LINE,CIRCLE,ELLIPSE")));3. select all 
polys,line,circle,elipse andd  put them in ss 
variable?

)
        (setq p (getpoint "\n 
Specify point :"))
   )

(progn
      (command "_.offset" n ss "_non" p 
"");4.offset all shapes?
      (setq e 
(entlast))
      (if (tblsearch "LAYER" 
"cover");.5???
        (command 
"_.chprop" e "" "_layer" "cover" 
"");.6???
      )

)
    (princ)
 )
 (princ)
)

 

Thanks

S

Posted

1 set local variables so not left in meory (a b / c d e) a b stay as variables in memory

2 use and as a test for user input

3 select all objects

4 offest all objects

5 check layer cover exists if not make

6 make layer see 6

7 (princ) at end exit quitely get messages other wise on screen

8 ss selection set can be anything you like "mylist"

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...