Jump to content

Assigning parameter to DYNARRAY issue


LarryO

Recommended Posts

It would appear that assigning a parameter to a dynarray of char is not possible. My parameter PSizeH4L is up to 16 characters long from a predefined pop-up list.

The assignment := in following doesn't seem to pass a value:

VAR

StudLength:DYNARRAY[]OF CHAR;

BEGIN

StudLength:=PSizeH4L;

DELETE(StudLength,1,6);

MESSAGE('Length= ',Studlength);

END;

BUT the following does work

VAR

StudLength:ARRAY[1..16]OF CHAR;

TempDynArray:DYNARRAY[]OF CHAR;

BEGIN

StudLength:=PSizeH4L;

TempDynArray:=StudLength;

Delete(TempDynArray,1,6);

StudLength:=TempDynArray;

MESSAGE('Length= ',Studlength);

END;

Also is there some reason that

ALLOCATE TempDynArray[1..16];

crashes VW2013 when used in a point plugin object?

Thanks.

Link to comment
  • Vectorworks, Inc Employee

DYNARRAY[]OF CHAR will automatically allocate itself. It's probably crashing because they system and you are both trying to control the space allocation.

I did a quick test in 2015 and I did not see any issues assigning a parameter value to a Dynarray of Char.

tempshape : Dynarray[] of Char;

tempshape := pShape;

AlrtDialog(tempshape);

I'm not doing any character manipulation but the simple assignment works correctly in 2015.

Link to comment

Thanks Kevin.

It must be some quirk in VW2013. The work around will have to do. I'll just need to remember if I have a similar situation in the future. I took 3-4 hours to investigate thinking I made some kind of mistake, even though the complete script compiles without error. With the exception of attempting to allocate the variable some memory before its first use. That crashed VWs as soon as I closed the script window.

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