Jump to content
Developer Wiki and Function Reference Links ×

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:

"http://techboard.nemetschek.net/ubbthreads.php?ubb=showflat&Number=112259"

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)

Link to comment

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.

Link to comment

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.

Link to comment

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

SetWSCellFormula(WSH,2,0,2,0,MyCriteriaGoHere);

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.

Regards,

Pat

Patrick Stanford

Vectortasks Training Seminars for VectorWorks

The PodCAD podcast - The podcast for the VectorWorks community

vwseminar@coviana.com

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.

Cheers!

Procedure WSSymLayer;

Var

WS : Handle;

WSimage : Handle;

LName,DBCrit : STRING;

Begin;

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

LName := GetLName(ActLayer);

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

SetWSCellFormula(WS,1,1,1,1,LName);

SetWSCellFormula(WS,2,0,2,0,DBCrit);

SetWSCellFormula(WS,2,1,2,1,'=S');

SetWSCellFormula(WS,2,2,2,2,'=1');

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

ShowWS(WSImage, true);

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

RecalculateWS( WS ) ;

ReDrawAll;

End;

Run(WSSymLayer);

________________________________

From: VectorScript Discussion List on behalf of GA

Sent: Mon 2006-10-02 18:33

To: VECTORSCRIPT-L@LISTS.NEMETSCHEK.NET

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

thanx

GA

Link to comment

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']))');
SetWSCellFormula(WS,1,1,1,1,LName);
SetWSCellFormula(WS,2,0,2,0,DBCrit);
SetWSCellFormula(WS,2,1,2,1,'=(Space.Name)');
SetWSCellFormula(WS,2,2,2,2,'=(Space.Area)');

what am i doing wrong ?

thx in advanced

Link to comment

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.

Link to comment
  • 2 weeks later...

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?

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