Jump to content

current layer change


hokie555

Recommended Posts

Hello everyone,

Here's my problem: I'm building a lisp routine that inserts a block along a line and I want the block to be placed on the layer that the line is on +1 (The route I'm taking is just to change the current layer before insertion instead of changing the block attribute. If it's easier for you to do it the other way that's fine. Also, all layers are numerical). For example, if the line is on layer 2, I want the block to be placed automatically on layer 3. Below is my failed attempt. Can anyone help? Thank you.

 

 

(setq linelayer(assoc 8 ent2))

(setq blocklayer (+ (atoi linelayer) 1)

(setq blocklayer (itoa blocklayer))

(setvar "clayer" blocklayer)

Link to comment
Share on other sites

Thank you sir for responding. still no luck though. comes back with:

 

error: AutoCAD variable setting rejected: "clayer"

(8 . "2")

 

fyi the line is on layer 2

Link to comment
Share on other sites

From error it doesn't seem like you fixed the right line. The following should work, if 'ent2' is the line "entget" list.

 

(setq linelayer (cdr (assoc 8 ent2)))

(setq blocklayer (+ (atoi linelayer) 1)

(setq blocklayer (itoa blocklayer))

(setvar "clayer" blocklayer)

 

-----edit------

oops, OK, glad you got it.

Link to comment
Share on other sites

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