Jump to content
Sign in to follow this  
orlando Teixeira

Object specific data extract (kind of pio list of pat's script)

Recommended Posts

Hello everyone

i found Pat's thread about listing objets pio:


i tryied it in 2011 and it worked fine.

is it possible to do something similar but

1) extract for example IDPREFIX, height , weight and opening of an window or door

2) create an individual report which if the window or door changed the worksheet changed too

the ideia here is to "simplify" when trying to do window and door mapping ( in portuguese Mapa de V?os)

When simplifyng i mean by separating every window type (allready defined in id prefix and label) individually

I can do it using worksheets by hand but its time consuming...

any ideas ? (hope i cleard out everything because my inglish isnt very good)

Share this post

Link to post

You could do something similar to my script, but I don't think you really want to.

What you want is to create a Database row in a worksheet. The criteria will be something like Record Door is present.

You would then use my script to get the proper field names from the Door object so you can write formulas in each column of the database header.

Once you have this setup, if you change a door or add/delete a door and recalculate the worksheet you will have the most current information.

Share this post

Link to post

hello pat

well thats about it. Perhaps i am being kind of noob but grabing your idea and

1)extract idprefix and label of the object

2) create an worksheet that

a) record door is present

b) idprefix is "x" (for example)

ok, so how can i do this lololol

Dont work too much with vectorscript (every 1 year maybe)


Share this post

Link to post

I don't think I would use Vectorscript for this.

Since a Worksheet is a Resource, once you set it up once you can use the Resource Browser to bring it into any drawings that need it.

Create a new worksheet

Click and hold on one of the how headers (number). From the menu that pops up set it to be a Database row and put in the criteria to only get the objects you want. For a door list, the easiest is Record Door Exists.

This should give you a bunch of sub rows (4.1, 4.2 and so on), one for each object that meets the criteria.

To then set up the columns to display the data you need click in the database header row (4 not 4.1, 4.2...) Enter the formula you want to display in that column. This could be something built in like =C (to display the class of the door), or something you get from running my script and seeing what you need to access the information in the Door parameter record ='Door'.'Width'.

Repeat with each column until you have all the information you need in the columns. Put the titles in the row above the database (row 3 if you have the database in row 4).

All of the above could be scripted, but it will actually take you longer to write the script than to create the worksheet, especially since you will need to look up and enter all of the record.field names manually into the script.

Share this post

Link to post

Hello again pat

Thx, as i am trying to learn to script and i find very hard to find information for someone who is allmost a complete outsider i tend to try and do stuff like this.

Thx anyway for your information i will return to my worksheet's :)

Share this post

Link to post

If you want to do it just for experience you certainly can do so.

You would use the SetWSCellFormula command to store the formulas into the individual cells.

SetWSCellFormula(WSH,1,1,1,1,Concat('Parameter Fields for PIO: ',S1));

WSH is a handle to the worksheet

1,1,1,1 is the range of cells that gets the formula. in this case only A1.

The Concat part is the actual formula/data you want in the cell. If you want it to be a formula you have to start it with an equals sign =

To set the database criteria you use a SetWSCellFormula with a column of zero


Here is something off the Vectorscript mail list from 2006 that may help.

Or another way to write this is:

DBCrit := Concat('=Database(((L= ', chr(39), Lname ,chr(39), ' )&

(T=Symbol) ))');

The chr(39) converts to an actual in line quote mark before and after

the Lname.

The original code worked fine on layers without spaces in the layer

name, but failed if there were spaces.

Charles method is correct and certainly works, but my eyes cross on

trying to tell the difference between double and triple quotes. It is

hard to miss the chr() in the middle of the concat.

Also, Charles, is there any reason that the criteria generator always

(in my opinion) adds an extra set of parens around any criteria you

create? (((L='Sheet Layer-1') & (T=SYMBOL))) is the code created by

the VS Editor criteria generator. I don't think the outermost parens

are needed.



Patrick Stanford

Vectortasks Training Seminars for VectorWorks

The PodCAD podcast - The podcast for the VectorWorks community


On Oct 2, 2006, at 9:21 PM, Charles Chandler wrote:

You just needed triple quotes in your

function concat() {

[native code]


statement, so that once evaluated, there would still be a single

quote in the string.

Also, enclose each piece of the criteria in its own parentheses,

and then enclose all of them in one more set.


Procedure WSSymLayer;


WS : Handle;

WSimage : Handle;

LName,DBCrit : STRING;


WS := CreateWS('test',2,2);

LName := GetLName(ActLayer);

DBCrit := Concat('=DATABASE(((L=''', Lname, ''' )&(T=SYMBOL)))');





WSimage := CreateWSimage(ws,0,0);

ShowWS(WSImage, true);

SetWSColumnOperators(WS,2,0,0,0,1,1,1) ;

RecalculateWS( WS ) ;





From: VectorScript Discussion List on behalf of GA

Sent: Mon 2006-10-02 18:33


Subject: Worksheet database Criteria

Hi Everybody,

Perhaps someone help me out:

In the next script i'm trying to get a worksheet on the active

layer with

all the symbols of the active layer, but the criteria of the

database set in

the worksheet can't be set to the one i want...



Share this post

Link to post

Hello Pat,

Thx i have now joined the general vectorscript mailing group.

Now, a very basic question:

i was trying to adapt your last post to make an worksheet that listed all the spaces present in the layer.

It gives me error, but i used the criteria from vectorworks criteria.

like this:

WS := CreateWS('test',2,2);
LName := GetLName(ActLayer);
DBCrit := Concat('=DATABASE((R IN ['Space']))');

what am i doing wrong ?

thx in advanced

Share this post

Link to post

Reread the quoted section above about nesting quotation marks inside strings.

Try this like to set the criteria.

DBCrit := Concat('=DATABASE((R IN [',chr(39),'Space',chr(39),']))');

The CHR(39) converts to a quotation mark when the concat runs. This gives you the quotes you need in the criteria string but still allows you to use quote marks around your litteral strings in setting the criteria as well.

Share this post

Link to post

hello pat

ok, gotta nock myself against a wall.

Starters sufers a lot to understand basics :)

thx againg pat i will try this l8ter

p.s. by the way i allready asked this in the mailing list but do ya know any way to find computer's language ?

i know i know i out of my league he!he!he!

Share this post

Link to post

On a somewhat related note?

I'm trying to create a Report returning space names and areas, but only of those space objects that match a certain occupancy type (to make separate worksheets for each department).

Now, for a regular report, Vectorworks does a fine job of creating a database header ='Space'.'Name' and another ='Space'.'Area'

What I need is to merge this with the conditional statement (('Space'.'Occupancy Type'='XXXX')). I tried several combinations of the above formulas to no avail and the manual is of little help in this case. What is the proper way to do it?

Share this post

Link to post

Good Morning,

i am just a noobie and perhaps i didnt understand the question but "Pedro P. Palazzo" question cant be resolved using classes?

i mean if he uses different classes to differe from each other can't his question be answered ? or even using "id prefix" to distinguish ?


"Trying to learn something everyday"

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.

Sign in to follow this  


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