Jump to content
twk

Size of Parameter/Record Field

Recommended Posts

Greetings,

 

Anyone know the maximum size of characters a Parameter/Record field can hold?

 

Needing a place to store a series of xyz co-ordinates from a user-defined polygon. And thinking to store it in a static text parameter of my pio.

There's no way to foreknow the number of vertices as its userdefined. But the location of each vertex is crucial to my calc.

 

Thanks

Share this post


Link to post

There is no limit on the size a text field BUT you must retrieve the value with GetRField instead of the PParameter constant . 

 

-Josh 

  • Like 1

Share this post


Link to post

No limit! very interesting, shall trial it out when at pc.

 

Thanks Josh

Share this post


Link to post

There should be no limit, but there still is though.... Don't know if it's because of the calls, or the actual data storage, but I have had the limit with a plugin I made this summer... It's still 256

Share this post


Link to post

You are limited to what displays in object info and what you can set in the plug-in's defaults, as well as what you can access via the PParameter constant, but SetRField and GetRField allow unlimited storage.  If in VS, any variables you use must be DYNARRAY OF CHAR and constants are still limited to 256 characters, so varName := 'Something longer than...256 characters'; will throw an error.

 

For example, place a callout object on the drawing, and select it.  Run the following script:

PROCEDURE MyScript;
VAR
	fieldVal :DYNARRAY OF CHAR;
	i			:INTEGER;
		
BEGIN
	fieldVal := '';
	FOR i:=1 TO 300 DO BEGIN		
		fieldVal := Concat( fieldVal ,i, Chr( 13 ) );
	END;
	SetRField( FSActLayer, 'Callout', 'Text', fieldVal );
	ResetObject( FSActLayer );

END;
Run(MyScript);

You will see the callout displays a string far greater than 256 characters.  Next run the following:

PROCEDURE MyScript;
VAR
	fieldVal :DYNARRAY OF CHAR;
		
BEGIN
	fieldVal := GetRField( FSActLayer, 'Callout', 'Text' );
	AlrtDialog( Concat( Len( fieldVal) ) );
END;
Run(MyScript);

You can see that fieldVal retrieves a string of 1092 characters.

 

-Josh

  • Like 1

Share this post


Link to post

@JBenghiat, I use SetRField for the plugin instance parameter, and if I put anything greater than 256, it's get truncated. (I use Python). So I guess the unlimited storage only counts for normal records....

  • Like 1

Share this post


Link to post

Thanks for the input guys, so far so good, following Josh's advice.

 

1. Have set up a plugin parameter as static text: __xypts; and generated xyz coordinates from the pio and stored it in this static text parameter.

2. Setup a the pio to draw a text object containing data from this hidden static text parameter, and all the data is getting read out beautifully.

 

forum_pio_parameter_fields.jpg

 

can't really go into what the pio does at the moment, but as you can see from the screen shot, all coordinate data is getting displayed from the hidden parameter. Characters I assume are well over 256.

 

This is using the vs.GetRField call and not the P<parmaname> method.

 

Share this post


Link to post

If you ever run into limits you might look at User Data, but I believe it's SDK only. Still you could write a VS function to handle your implementation.

Basically you can attach (structures of) data to any object handle which is very cool.

I have a junction object that can have unlimited legs, each leg info is dynamically added to the object handle without using a record.

 

If all you are saving are coordinates you might also consider dynamic controlpoints and or the combination with above.

This also opens the option of simply moving any of those points if the control handle is visible end enabled.

Share this post


Link to post
3 hours ago, twk said:

 

This is using the vs.GetRField call and not the P<parmaname> method.

 

 

Aha, so that could be the real problem! So P.... is cutting it off, and thus it's better to use GetRField for text fields... Hmmm. Need to test this and then add it as improvement to DLibrary!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×