Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layer Freeze Lisp

Status
Not open for further replies.

SavedByGrace2003

Technical User
Feb 22, 2005
3
0
0
US
Hi!

I have written a lisp routine that will freeze a selected entity's layer by using entsel (which turns off the base layer) or by using nentsel (which turns off the sub-object layer).

For instance, if a block is created on layer "0" and placed on layer "1", using entsel will turn off layer "1", and using nentsel will turn off layer "0".

I want to write a program that will compare if there are 2 different layers that could be turned off then choose which one is supposed to be turned off..

thanks in advance for your help!

God Bless,
Andy
 
You could look at the type of entity selected with "entsel" and if an insert have the user pick again using the "nentsel". To avoid the double pick, maybe use "nentsel" as the standard object selection, and have the routine select object at same pick point using (ssget PtPick), then compare layer names of entities and see if you need to give user a choice.
 
thanks for your reply!

i think we are on track with the ssget ptpick method... however, i am having trouble formatting the code so it grabs the point and puts it back in the ssget function. Could you please post the correct syntax?

here is the code i am working with:

(setq Ent (cdr(entsel "Select an entity on the layer to be frozen: ")))
(setq Entr (ssget '(Ent)))

as you can see, i'm not sure about the ssget syntax. Your help would be appreciated!

God Bless,
Andy
 
Try the folowing:

(setq PtPick (cadr(entsel "Select an entity on the layer to be frozen: ")))
(setq Entr (ssget PtPick))
 
i appreciate your help in this, however i can't seem to get it right... i'm not sure how to extract the layer information using the ssget function..

i thougth about trying to use something like

(setq Ent (nentsel PtPick))

to try to use the nentsel just like the ssget function,
but to no avail.. do you know how to do either of these? I do ok at lisp, but i have not had much experience extracting entity data from objects...

Thanks again

God Bless,
Andy
 
I thought I should have included one more step....:)

The ssget function returns a selection set. To get the entity name you use the function "ssname". To get the name of the first entity, use:
(setq Ename (ssname Entr 0));;
(setq Layname (cdr (assoc 8 (entget Ename))))

HTH!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top