Jump to content

click on class object and get name of class as txt


Recommended Posts

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?

Link to comment

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))

 

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
Reply to this topic...

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