Jump to content

Duplicating PIOs


Recommended Posts

I have the following script within a PIO. The purpose is to determine if the object being drawn is being created for the first time or just being redrawn.




{a new object is assumed to be on the active layer}

{so for a regenerated object, make its layer active}

IF bool2=FALSE THEN Layer(GetLName(GetLayer(Ohandle)));


The problem is when I duplicate the object using Duplicate Array...

The new (duplicate) object reads as existing (bool2=FALSE) and even though the object handle contains a valid value, GetLayer(Ohandle) returns zero.

Am I doing something wrong?



Link to comment


The problem is that duplicates are not read by vectorscript as new objects, they are placed at an undetermined place in the stacking order. They are also exact duplicates, so that as far as the object is concerned it was created when the original was created, and will always return FALSE for bool2.

Put Message(bool2) in your pio script to track this.

also, I used Message(GetLName(GetLayer(Ohandle))) and was able to get a valid layer name out of both the original and the duplicate, so I'm not sure what's going on there.

hope this is helpful,


Link to comment

Thanks Jason. Good to know about duplicates not being a new object.

Regarding Message(GetLName(GetLayer(Ohandle))), I got a new layer creation for the duplicate and 0 for Message(GetLayer(Ohandle)). I still might be doing something wrong but it points me in a different direction for the code.

Thanks for the help.

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.

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