Jump to content
Sign in to follow this  
justin1974

Getting PIO info to Record Fields

Recommended Posts

Can someone show me an example script of how to get information from a PIO to record fields.

example:

PIO draws a rectangle.

Creates a record "rectangle" with fields 'width' & 'depth'

feild info is linked to rectangle so when size of rectagle is chagned feilds update.

Thanks

Share this post


Link to post

Justin,

Each parameter on a PIO is already automatically stored as a field at a record attached to each instance of the PIO, you can find this record using:

GotPIO := GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand);

{GotPIO is a boolean (true/false) variable I invented just to allow me to use the GetCustomObject function, it stores 'true' if it suceeds.}

You can see those records when you perform a Custom Selection looking for a Record/Field value, or when you create a Report.

Create your rectangle PIO or insert some NNA PIOs and have a look at the Custom Selection and Create Report commands at the Organise menu.

[ 02-23-2003, 07:32 PM: Message edited by: Alexandre B A Villares ]

Share this post


Link to post

Once you've got a PIO's record you can even set one of it's parameters value from inside it:

IF GotPIO THEN SetRField(objectHand, Getname(recordHand), ParameterName, Num2StrF(ParameterNewValue));

For example, if a boolean parameter PSquare is true, make it set pH to pW...

Please note that when you set a parameter from inside the PIO it's new value is only noticed at the next redraw, so I would recommend setting a second pair of intermediate variables to do the drawing.

[...]

W:=pW;

H:=pH;

IF pSquare & GotPIO THEN BEGIN

SetRField(objectHand, Getname(recordHand), 'H' , Num2StrF(W));

H:=W;

END;

Rect (0,0,W,H);

{not Rect(0,0,pW,pH)}

HTH,

Alexandre

Share this post


Link to post

Okay

When using the REPORT function my PIO records are there, but the Resourses folder of the document, nor the Data Tab (on Object Info) show this record format.... Why?.

When I use a VW PIO the Data Tab and Resourse Folder show the record format.

I can do what I need from the report functions, but as matter of interest how do I make the record formats show in the Data tab and see record in resources?.

Share this post


Link to post

I think it is by design that those records are hidden from the normal interface, note that they 'are' the PIOs parameters and should not be changed carelessly...

[ 02-25-2003, 06:53 PM: Message edited by: Alexandre B A Villares ]

Share this post


Link to post

hello justin,

something i've done in the past is to set an external record to the object from within the pio script.

you should run a GetCustomObjectInfo at the start of your pio script:

result:=GetCustomObjectInfo(name,oh,rh,wh);

NewField('Plug In Record','Plug In Field','Value',4,0);

SetRecord(oh,'Plug In Record');

SetRField(oh,'Plug In Record','Plug In Field',Paramater Value);

just remember that you need to convert the paramater value to a string before you assign the field to the object.

hope this helps,

-jason

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.

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.

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