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

Get user string, check to see if any layers in drawing match user-input

23 REPLIES 23
SOLVED
Reply
Message 1 of 24
bhull1985
1029 Views, 23 Replies

Get user string, check to see if any layers in drawing match user-input

Hello everyone, I am attempting to tackle a new project.

I'm writing a small routine to enable layer toggles based off of a few characters inputted by a user, such as:

 

Laymod "IFC" thaw

 

would be the user execution command, and within that I want this program to search for any matches within the list of returned layers in the drawing to what's in the double-quotes, in the example above, it would return any or all layers that have the string "IFC" within them.

 

I've been able to construct the layer list, and have set vars for the layers to be an argument of the subfunction required to toggle the layers.

 

What I need some assistance with is the string matching portion of this routine, that would search the table of layers and return any matches to the user input....if anyone would assist me in this i would be grateful.

 

Thanks and cheeeeeeers!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
23 REPLIES 23
Message 21 of 24
mid-awe
in reply to: Kent1Cooper

Just my two cents:

Instead of: (getkword "\nChoose layer control {Freeze/Thaw/On/oFF/Lock/Unlock/eXit}:")

Use: (getkword "\nChoose layer control [Freeze/Thaw/On/oFF/Lock/Unlock/eXit]:")
using brackets instead will provide a quick-n-easy menu from which to pick.

Message 22 of 24
Kent1Cooper
in reply to: mid-awe


@mid-awe wrote:
....
Instead of: (getkword "\nChoose layer control {Freeze/Thaw/On/oFF/Lock/Unlock/eXit}:")

Use: (getkword "\nChoose layer control [Freeze/Thaw/On/oFF/Lock/Unlock/eXit]:")
using brackets instead will provide a quick-n-easy menu from which to pick.

Cool!  I've got access to Acad2014 at times [right now], but most of the time only to 2004, which doesn't work that way, so that was news to me.

Kent Cooper, AIA
Message 23 of 24
mid-awe
in reply to: Kent1Cooper

🙂 I have been fortunate to have had access to '08, I believe it was added then, don't quote me 😉

 


And by the way, you can also do - (getkword "\nChoose layer control [Freeze/Thaw/On/oFF/Lock/Unlock/eXit] (this is a comment that will display only after interaction): <On>")

 

I'm glad to share.

Message 24 of 24
bhull1985
in reply to: mid-awe

Ah yes, this was a function of initget/getkword that I was not aware of!

Upon selection of the layer control (in 2012) it gives a small popup box that we can actually use the up/down arrow keys to cycle through the available options for modifying layers.

 

Has anyone tried this program? It's fairly intuitive and is just meant to be useful in the places that the expresstools layer controls lack. Simply gives a list of the layers in the drawing just before asking for the layer control to be applied. I'm going to do some testing with long-string layer names such as those used in complex 3d piping models with nested xrefs and so on and so forth, some of the layer names might as well be BOM descriptions they hold so much info, so when the layertable pastes itself onto the screen for easy selection, this may have adverse effects by spamming the screen down. I'll have to see how it acts in larger drawings, but for me at least in testing small dwgs, it works fine.

 

Anyways, thanks for the help with this guys as always suggestions are appreciated and followed through on!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!

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

Post to forums  

Autodesk Design & Make Report

”Boost