Jump to content
Matteo New

read out the class description in a worksheet

Recommended Posts


I want to set up a class-list for the office. I already have a script which creates a rectangle for every class of a new file, created from the office-template-document, so I am able to create a worksheet which contains every class-name in the document. When I want to add or delete classes I simply delete all rectangles and run the script again and I update the worksheet.

However we want to use the class descriptions for every class, too.


Is there a way to read out the class description and write it in the worksheet?

1) by reading it out directly in a worksheet (sth like =Classdescription)

2) within the script, for example by adding it to a record-format field for every object and reading out this record format from the worksheet afterwards.

3) any other idea?


thanks and best regards


Share this post

Link to post

It sounds possible.


The function to set the description for a class or layer is:


boolResult := SetDescriptionText (classHandle,tempDescriptionText);  (pretty sure this will work).


I think you could pull that from a record and make it work.


You could also use a worksheet.  Here's a simple one from last year that creates classes from selected cells in a worksheet.  I bet you could modify it to just get the names from column A and the descriptions from column B.



Share this post

Link to post

I prefer "GetDescriptionText". This command should "Get" me the DescriptionText from the Object Class, right?

Now I want to write it into a database field of the object (which I can access from a worksheet afterwards) right? Or am I completely wrong?

Share this post

Link to post

Yes, it is possible. I am liking the RunScript WS function more and more. Still needs some work, but it offers great potential.


Create a new Vectorscript named ClassDescrip and paste the following code into it.


Procedure ClassDescription;
{© 2017 Patrick Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}
{A Vectorworks 2017 worksheet script to return the Class Description}
{of each object in a worksheet database.}
{Run using the RunScript function in the worksheet}

var	S1:String;




Now add a column to your worksheet of classes. In the database header row add a formula of:




Answer the dialog box to allow the script to run and you should have the class descriptions you are looking for. 


Remember that the description can have multiple lines and you will probably need to manually adjust the Row Heights to make it look good.

  • Like 2

Share this post

Link to post

If this is something you are going to do often in multiple files, we can store the script in the User Folder so it can be shared between files instead of having to exist in every file.  If this is a one-time or occasional thing, storing the script in the file is the best option.

  • Like 1

Share this post

Link to post

Wow, that does work, indeed. I first got some errors, but, somehow I finally made it work.

Thanks :-)

Running scripts from worksheets could really be a powerful tool.

Share this post

Link to post

excuse me, Pat, but, where in the user folder do you suggest me to put this file?

userfolder/application support/Vectorworks/201x/Libraries/Defaults/ ???

Share this post

Link to post

Copy the script to a text editor (I personally like BBEdit, but anything that will save a plain text file will do. TextEdit will work fine on Mac). 


Save it using a name of ClassDescription.txt to:


/Users/Your User Name/Library/Application Support/VectorWorks/2017/Libraries/Defaults/Reports_Schedules


Then set the formula to add the code (120) for the location you have the saved the txt file.


=RUNSCRIPT(120, 'ClassDescription')



Before you enter and test the RunScript, save the file and any other open files you have. I have had a couple of crashes that I think are related to typos pointing to nonexistent files. I have submitted a bug report.



Share this post

Link to post

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.

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.


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...