Jump to content
  • 2

Custom selection (save/recent options)


Ross McLee

Question

Love the custom selection tool.

 

It would be greatly improved if:

  1. It kept your last used criteria - sometimes you need to repeat the process to achieve what you want to do
  2. Allow to save the criteria for future use (a bit like select similar tool)
  3. BONUS option - When selecting criterial the lists are filtered. E.g. I am looking for devices in ConnectCAD, which have 0 power values, so i filter on DEVICES but still need to trawl through hundreds of properties for doors, windows, walls etc just to find the properties of Devices

 

Thanks,

R

  • Like 1
Link to comment

9 answers to this question

Recommended Posts

  • 0
  • Vectorworks, Inc Employee

Great suggestion, Ross!

For now, you might explore the Vectorworks worksheet feature which supports criteria searches and can be saved, pulled up when needed and you can directly select and edit the object listed in each line as well as view and sort by any desired field values like power values. I know it's not what you are asking, but this would provide the same functionality albeit in a different format...

  • Like 2
Link to comment
  • 0

@Pat Stanford, My first delve into Vectorscripts and this worked pretty well. Thank you. I have made a few scripts already now 🙂

I am going to regret asking but... Is there a 'simple' way of prompting the user (me) to select/enter just one of the search criteria via an input pop-up?... 

I am trying to select all ConnectCAD devices who's name is X, but X changes each time, and scrolling through the parameter values in the custom select tool is very time consuming to find the .device.name field. The script would be a shortcut to that I guess.

 

Thanks as always,

R

 

 

Link to comment
  • 0

Try this and see if it does what you want.

 

A few points.

1. You may want to add a DSelectAll if you always want to select only a single object.

2. The funky Concat line is required because you can use a single properly constructed string as criteria, but you can't use a sting as part of a criteria.

3. In order to put the single quotes required in the Criteria String while also using single quotes as necessary to define the stings required as part

of the Concat string, I have chosen to use the ASCII equivalent CHR(39) for each single quote required in the Criteria string. Other people use

three single quotes, I find that harder to read.

4. The ability to retain the search strings between runs could be added also.

Procedure SelectByDeviceName;
{March 5, 2021}
{©2021 Patrick Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}

{No Warranty Expressed of Implied. Use at your own risk.}

{displays dialog box asking for the name of the device to select}
{and then selects the device with that device name.}
{the CHR(39) in the Concat enter single quotes where needed in the}
{criteria string while the single quotes in the Concat line}
{separate the strings inside the concat line.}

Var	S1, S2:	String;

Begin
	S1:=StrDialog('Enter Device Name', S1);
	S2:=Concat('(INSYMBOL & INVIEWPORT & (PON=',Chr(39),'Device',CHR(39),') & (',CHR(39),'Device',CHR(39),'.',CHR(39),'name',CHR(39),'=', CHR(39),S1,CHR(39),'))');
	SelectObj(S2);
End;

Run(SelectByDeviceName);

 

  • Like 2
Link to comment
  • 0

@Pat Stanford,

I realise this is really easy stuff for you, but I appreciate the taime you have taken out to help me.

I can read the script and understand how it works, but wouldn't have known where to start. I might venture further and try modifying it a bit once I am more familiar with the whole scripting thing.

 

But this works just as I wanted.

 

Thanks again,

R

Link to comment
  • 0
10 hours ago, Ross McLee said:

@Pat Stanford,

I realise this is really easy stuff for you, but I appreciate the taime you have taken out to help me.

I can read the script and understand how it works, but wouldn't have known where to start. I might venture further and try modifying it a bit once I am more familiar with the whole scripting thing.

30+ years of almost anything make it "easy" ;-)

 

That's why I post a lot of the scripts that I do. So that others can at least see how I have solved a problem and hopefully be able to adjust that solution to meet their specific needs.

 

This one had two tricky bits. First knowing that if you have a script that uses variables you have to use the Procedure / Run around the whole thing and you have to declare the variables. Second, knowing that you can use a single String variable as a criteria, but can't use a string as a piece of a criteria.

 

Once you know those two items, the rest is just details.

 

And as you get into scripting, remember to be stubborn. Don't let the computer beat you. It might take brute force, but you can make it do pretty much anything that you want it to do.

Link to comment

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
Answer this question...

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