Sebastiaan Posted May 10, 2018 Share Posted May 10, 2018 Hi, I am posting this question about lighting instruments here, because I think this might more be a worksheet or scripting question than it is a Spotlight question. To make my 3d and 2d lighting labels more efficient, I would be really happy if it where possible to concatenate two fields into a user field of a Lighting instrument. The following fields I would like to concatenate: Universe and Adress into Userfield 1 Circuitname and Circuit Number into Userfield 2 The reason is that I would want my 3d labels to look exactly the same as my 2d labels. At this moment it is not possible to display fields next to each other in a 3d label. By concatenating and then displaying the userfields in my 3d label I would have workaround to fulllfill my desires. Also see screenshot of the desired end result. Would there be a worksheet formula that does this, like it can be done in excel? Or maybe a script can do this? I wouldn't prefer a solution that requires me to export it to another spreadsheet program and then import it again. Thank you in advance to anyone that is willing to share there knowledge on this. Quote Link to comment
Pat Stanford Posted May 10, 2018 Share Posted May 10, 2018 A script would be the easiest way, but least flexible. Would you want it to effect every light in the drawing/Layer/Class or only selected ones? A Worksheet could do this, but you would need to do a manual step to copy/paste the data from one column to the User Field column. But it would be more flexible in that you could decide which lights to do this for. And now we wait for @JBenghiat or @Sam Jones or one of the the Spotlight Gurus to tell us that it is easy if you just do these three steps. 😉 If you need help with the script or worksheets ask again. Quote Link to comment
Sam Jones Posted May 10, 2018 Share Posted May 10, 2018 Unfortunately, or fortunately, depending on how you look at these things, there is not a way that does not involve scripting. The script has already been written, but it is part of AutoPlot Tools for Spotlight. The command is one of many and is called "Copy Field to Field" and throws up the dialog below. There might be a VW version, but since I use AutoPlot, I haven't kept up. You would input this: This combines the fields, but it has to be run any time you make a change either in VW fields or LW fields. I usually save it for late in the game. Feel free to contact me if you have any questions about AutoPlot. Sam Samuel L. Jones E-mail: sjones@autoplotvw.com (310) 993-4172 (cell) Quote Link to comment
Sebastiaan Posted May 10, 2018 Author Share Posted May 10, 2018 14 minutes ago, Sam Jones said: Unfortunately, or fortunately, depending on how you look at these things, there is not a way that does not involve scripting. The script has already been written, but it is part of AutoPlot Tools for Spotlight. The command is one of many and is called "Copy Field to Field" and throws up the dialog below. There might be a VW version, but since I use AutoPlot, I haven't kept up. You would input this: This combines the fields, but it has to be run any time you make a change either in VW fields or LW fields. I usually save it for late in the game. Feel free to contact me if you have any questions about AutoPlot. Sam Samuel L. Jones E-mail: sjones@autoplotvw.com(310) 993-4172 (cell) Thank you! I didn’t know autoplot does this also! I Will try this tonight and think it will make my life happier. Thank you! Quote Link to comment
Sebastiaan Posted May 10, 2018 Author Share Posted May 10, 2018 So this a solution that works and I understand that is has to be rerun after each change. But what if I become greedy. And ask for something even faster. I only want these field to be concatenated, and I always want all of the instruments to be affected by the script. So for me a single script that only concatenates : Universe and Adress into Userfield 1 Circuitname and Circuit Number into Userfield 2 I already use delimiters when I number the instruments. If i had such a script combined with a keyboard shortcut, I could run the script after every change to the instruments. With the autoplot tool, however beautifull as it is, I have to go into the menu twice and change settings and run for the second fields to be concatenated. Would this require a lot of code or marionette scripting? I am a novice to scripting in VWX. I have done some Excel VBA so am willing to learn. Could somebody push me in a direction? @Pat Stanford Quote Link to comment
Sam Jones Posted May 10, 2018 Share Posted May 10, 2018 You could take a shot at it. I don't know Marionette. I don't know what's easy any more, but a personal script that has no variations would not involve much, and you would have to become familiar with the ForEachObject() procedure. You might do this instead. It only requires 2 keystrokes, 1 more than the solution you request. 1. In the workspace editor, assign a keystroke to the "Copy Field to Field" command. 2. In the "Copy Field to Field" dialog set it up as shown below. Be sure the "Make Default" button is checked. 3. Press OK. After that just hit the keystroke you assigned to the command and then hit enter. You don't have to select or check anything. Quote Link to comment
Sebastiaan Posted May 10, 2018 Author Share Posted May 10, 2018 14 minutes ago, Sam Jones said: You could take a shot at it. I don't know Marionette. I don't know what's easy any more, but a personal script that has no variations would not involve much, and you would have to become familiar with the ForEachObject() procedure. You might do this instead. It only requires 2 keystrokes, 1 more than the solution you request. 1. In the workspace editor, assign a keystroke to the "Copy Field to Field" command. 2. In the "Copy Field to Field" dialog set it up as shown below. Be sure the "Make Default" button is checked. 3. Press OK. After that just hit the keystroke you assigned to the command and then hit enter. You don't have to select or check anything. Yes this would Be fast if it was just two fields in to one, but I need 4 fields into two user fields. So I have to do it twice and on the second one I need to change the three drop down lists. So so indeed either it should be done just before printing, but then I need to swap all label legends as well. And maybe rearrange my 3D labels all over again. Or if I had one script to do this all at once then I could do this as I Number my instruments. Quote Link to comment
Sam Jones Posted May 10, 2018 Share Posted May 10, 2018 You caught me on a good day. Put the attached plug-in into the Plug-ins folder inside the 2018 folder (the user folder). Assign it to a menu in your workspace and give it a keystroke. The plug-in is not encrypted so you can open it in the Plug-In Manager and look at how it works. Let me know how it works for you. Sam Sebastian Swap.vsm 1 Quote Link to comment
Pat Stanford Posted May 11, 2018 Share Posted May 11, 2018 11 hours ago, Sebastiaan said: Would this require a lot of code or marionette scripting? I am a novice to scripting in VWX. I have done some Excel VBA so am willing to learn. Could somebody push me in a direction? @Pat Stanford Since Sam already wrote it you don't have to. I am certainly more proficient in Vectorscript than Marionette, but in My Not So Humble Opinion, Vectorscript will always beat Marionette when it comes to manipulating already existing objects. Especially if you are just working with attached data. I have not looked at Sam's script, but I am pretty certain I could do what you asked in less than 20 lines of code. Maybe less than 10. BUT depending on the number of lights you have, it might not be fast enough to run after every change. 10 lines of code x 1000 lights is still a lot to process. Quote Link to comment
Sam Jones Posted May 11, 2018 Share Posted May 11, 2018 28 lines of code actually, but that includes formatting and blank lines for clarity and the use of variable assignments that could be replaced with in line procedure calls also done for clarity. Quote Link to comment
Sebastiaan Posted May 11, 2018 Author Share Posted May 11, 2018 Thank you @Sam Jones & @Pat Stanford! I need to try and look at youR script tonight. I hope i can inderstand the script and learn from it. I believe indeed it Will be a combination of your script and a double set of Label Legends. (48 by then) Wouldn’t it be nice if VWX would listen to us and build a optional configurable direct link between fields? Then the change would be instant upon each mutation. Thank you you so much Sam! Glad I caught you on a good day. Quote Link to comment
Sebastiaan Posted May 11, 2018 Author Share Posted May 11, 2018 11 hours ago, Sam Jones said: 28 lines of code actually, but that includes formatting and blank lines for clarity and the use of variable assignments that could be replaced with in line procedure calls also done for clarity. Just tried your code in a drawing with approx 100 instruments and it feels instant! Now to remake my label legend and see what workflow fits best. Once again thank you so much. btw, I was able to understand and read your code well, I really should make time to dig into vwx scripting! Thank you once more, I am Happy! Quote Link to comment
Sam Jones Posted May 11, 2018 Share Posted May 11, 2018 Quote btw, I was able to understand and read your code well, I really should make time to dig into vwx scripting! You probably should, but beware of the quicksand. It will disguise itself as a 15 minute task that will be reduced to a 10 second task after you write the appropriate script. You will then spend the next 4 DAYS writing the script, debugging the script, refining the script, and debugging it again. Good luck. Sam Quote Link to comment
Sebastiaan Posted May 11, 2018 Author Share Posted May 11, 2018 16 minutes ago, Sam Jones said: You probably should, but beware of the quicksand. It will disguise itself as a 15 minute task that will be reduced to a 10 second task after you write the appropriate script. You will then spend the next 4 DAYS writing the script, debugging the script, refining the script, and debugging it again. Good luck. Sam I still remember all those evenings wrecking my head over my excel dimmer and PSU macro's. In the end it made my life a bit more magical😉 Quote Link to comment
Sam Jones Posted May 11, 2018 Share Posted May 11, 2018 Quote I still remember all those evenings wrecking my head over my excel dimmer and PSU macro's. In the end it made my life a bit more magical😉 Ah... so you know, but remember the sign above the door. "Abandon all hope ye who enter here." Quote Link to comment
Pat Stanford Posted May 12, 2018 Share Posted May 12, 2018 How much time should you spend automating something? Depends on how much time you save and how often you do it. https://xkcd.com/1205/ Quote Link to comment
Sam Jones Posted May 12, 2018 Share Posted May 12, 2018 If you only knew how much time it was going to take. My skill at underestimating that is Olympian Quote Link to comment
Sebastiaan Posted May 12, 2018 Author Share Posted May 12, 2018 1 hour ago, Sam Jones said: If you only knew how much time it was going to take. My skill at underestimating that is Olympian I thought it was all about the journey instead of the destination? Quote Link to comment
Pat Stanford Posted May 13, 2018 Share Posted May 13, 2018 I posted my rule about time estimating a couple of weeks ago. Take the amount of time you think it will take and double it. Then use the next higher unit of measure. 5 min -> 10 Hours 10 Hours -> 20 day 20 days -> 40 weeks 40 Weeks -> 80 months 80 monts -> 160 years. 😉😉 Quote Link to comment
Recommended Posts
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.