Mechanical Desktop

Reply
Active Contributor
jstarr-kimastle
Posts: 41
Registered: ‎06-01-2007
Message 1 of 5 (40 Views)

Set color to Layer & freeze

40 Views, 4 Replies
10-11-2007 09:03 AM
I'm trying to write a lisp routine where I can click on an item (all I get are ASSURFACE to work with) and it pulls the color off that item. Then it needs to select all entities with that color to a certain layer (I've been using DATA_01, DATA_02, etc.). Then I want to freeze that layer.

The problem I'm having is the select by color and set that group to a layer.

If you can help me I'd appreciate it. I'm using MDT 2007.

Here's what I have so far:
(DEFUN C:smileyfrustrated:1 ()
(COMMAND "UNDO" "M")
(PRINC "\nSELECT THE COLOR YOU WANT TO PUT ON LAYER DATA_01... ")
(SETQ GROUP (SSGET)); <-- I think I need help here
(COMMAND "CHPROP" GROUP "" "LA" "DATA_01" "")
(COMMAND "-LAYER" "F" "DATA_01" "")
(PRINC "\nTHESE ITEMS HAVE BEEN PUT ON LAYER DATA_01.")
(PRINC)
)

Thanks again,

Jason
*Jason Rhymes
Message 2 of 5 (40 Views)

Re: Set color to Layer & freeze

10-11-2007 09:59 AM in reply to: jstarr-kimastle
Maybe something in this lisp may help you.
Active Contributor
jstarr-kimastle
Posts: 41
Registered: ‎06-01-2007
Message 3 of 5 (40 Views)

Re: Set color to Layer & freeze

10-11-2007 11:19 AM in reply to: jstarr-kimastle
I've looked over the AMCOLOR.LSP and it looks like it sets a variable mycolor to 256 but I'm still not sure how to get all of a certain color by just picking an entity (in this case an ASSURFACE). This probably seems really easy to you but I'm lost. I know the property is set to 62.
The line is going to look something like this, right?
(setq group (ssget '(62 . XXX ) ) )
Once I get them I know how to set them to the DATA_01 layer and then freeze it.

This is frustrating. I feel like I'm really close to the answer.

J
*Jason Rhymes
Message 4 of 5 (40 Views)

Re: Set color to Layer & freeze

10-11-2007 02:28 PM in reply to: jstarr-kimastle
Try reposting in the AutoCAD customization newsgroup. That should be a
pretty easy lisp for someone there to write.
Active Contributor
jstarr-kimastle
Posts: 41
Registered: ‎06-01-2007
Message 5 of 5 (40 Views)

Re: Set color to Layer & freeze

10-11-2007 02:46 PM in reply to: jstarr-kimastle
Thanks, I'll do that.

J
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.