Jump to content

Size of Parameter/Record Field


twk

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

Link to comment

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
Link to comment

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.

 

Link to comment

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.

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