unearthed Posted April 26, 2022 Share Posted April 26, 2022 When I select an object (esp. polylines/polygons, lines) I often want to get the class name as text but VW makes this difficult as I have to get out go to navigator and select there (all very manual). I would have expected Properties to do this it but it has been forgotten there too. Is there a faster way? Quote Link to comment
Pat Stanford Posted April 27, 2022 Share Posted April 27, 2022 Would you consider a script? I think we could put the name into the clipboard so you can paste it wherever you want. Quote Link to comment
unearthed Posted April 27, 2022 Author Share Posted April 27, 2022 A script to do that would be amazing Pat, it would be very welcome. Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 27, 2022 Vectorworks, Inc Employee Share Posted April 27, 2022 Hi @unearthed, What is it you do with the text? If you want to display the name in an annotation, a Data Tag might be the best answer. Quote Link to comment
unearthed Posted April 27, 2022 Author Share Posted April 27, 2022 HI Matt, Most often to drop into a worksheet for calculations, also to drop into external text editor for various things. 1 Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 28, 2022 Vectorworks, Inc Employee Share Posted April 28, 2022 15 hours ago, unearthed said: HI Matt, Most often to drop into a worksheet for calculations, also to drop into external text editor for various things. I see. Then a script, as Pat suggested, would be best. Quote Link to comment
Pat Stanford Posted May 4, 2022 Share Posted May 4, 2022 Try this. I have not been able to test this on Windows, but it appears to do what is needed on Mac. This is a Python script, so go to the Resource Manager, New Resource, Script. Accept the Palette Name and give the script whatever name you want. Maybe ClassToClip. Set the Lanugaure pulldown at the top to Pythonscript. Paste all of the script below and click OK. Double click on the script in the palette to run the script. You can then paste the Class back into VW as a test or into another part of VW or another app. If you like it and it works for you we can convert this to a Plug-in Menu command and you can add it to your workspace and give it a keyboard shortcut or add it to the contextual right click menu. #Python script to put object class name on system clipboard #Written May 2022 for VW2022 #All clipboard parts written by @DomC on the Vectorworks Forums #Vectorworks specific line by @Pat Stanford #No rights reserved #No warranty expressed or implied #Use at your own risk #Test carefully before using on live data import math import os import subprocess import vs major, minor, maintenance, platform = vs.GetVersion() text = vs.GetClass(vs.FSActLayer()) def addToClipBoardWin(text): command = 'echo ' + text.strip() + ' | clip' os.system(command) def addToClipBoardMac(text): process = subprocess.Popen('pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE) process.communicate(text.encode('utf-8')) if platform == 1: addToClipBoardMac(str(text)) else: addToClipBoardWin(str(text)) 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.