Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get layer & Set layer

4 REPLIES 4
Reply
Message 1 of 5
MatteoJames
187 Views, 4 Replies

Get layer & Set layer

Hi all, I'm creating a lisp in which I select a block with ssget and inserts other blocks with the same name in some certain points.

How do I get the layer, color and line type from the original block and set it the same on all the other blocks it inserts?

Matteo
4 REPLIES 4
Message 2 of 5
M_Hensley
in reply to: MatteoJames

This will get you the layer of a selected object:

(setq layr (cdr (assoc 8 (entget (car (entsel))))))

Then switch the current layer to the object's layer:

(setvar "clayer" layr)

Then do your inserting.
Message 3 of 5
Anonymous
in reply to: MatteoJames

> {quote:title=MatteoJames wrote:}{quote}Hi all, I'm creating a lisp in which I select a block with ssget and inserts other blocks with the same name in some certain points.
>
> How do I get the layer, color and line type from the original block and set it the same on all the other blocks it inserts?
>
> Matteo {color:#ff6600}
{color} {color:#ff6600}You can do with 'COPY' command in AutoCAD.
No need programming.{color}
Message 4 of 5
MatteoJames
in reply to: MatteoJames

I was waiting for this answer...
I know it whould be easy but my lisp calculates the exact position based on the block and some points.

Second thoughts... Insted of using (COMMAND "_-INSERT" ..... ) I could use (COMMAND "_-COPY" ..... )
I'll se if I can make it fit in my program.

Matteo
Message 5 of 5
MatteoJames
in reply to: MatteoJames

Thanks M_Hensley, That's what I was looking for, gonna study on it 'cause I don't understand it all yet, I'm still at the begining of my LISP programming.

Matteo

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost