Jump to content

Plugin runs twice


Recommended Posts

Hi All,

Wondering if anyone can help with this question. If I make a linear plugin object then the script runs twice, and if I make a rectangular plugin object then the script runs 3 times. This is regardless of whether I have "developer mode" turned on or off.

 

The script is simply:

import vs

vs.AlrtDialog('test')

 

Does anyone know the solution? Thanks.

Link to comment

This is normal behavior for PIOs. I don't remember all the details, but we have discussed this before.

 

Basically, the script runs when the object is placed and then again when the object is reset. I am not certain what the third run for a rectangular PIO is.

 

I THINK that if you make an event enabled PIO (much, much more complicated) then you can catch the different events sent for the different runs and only run the parts of the script (including parts that have zero code) that need to be run at that time.

 

Sorry. HTH.

Link to comment

Thanks Pat.

 

I am currently writing a plugin where the user will draw a line or rectangle then, based on the dimensions of the line or rectangle, a dialogue box will appear with various checkbox options that the user can select. There will then be information placed on the drawing depending on what the user selects. I have achieved all of this, except that the dialogue box appears twice when the line is initially drawn. Do you know if there's a workaround for this? Thanks.

Link to comment

@michaelk has a script where he checks the time and if the script runs again within a certain number of seconds does something different (or doesn't do something, I can't remember).  You could do something like that.

 

Or maybe play with VSTGetEventResult and see if that gives different values on each run.

 

GetEvent might be what you want.

 

Take a look at this thread where michaelk asked almost the same questions a few years ago and @MullinRJ provided a good answer.

 

 

  • Like 1
Link to comment

So if the event is the same, then something like Michaels time check might be the only solution.

 

Or modify the PIO so that it does not automatically open the dialog box and have the user make those settings in the OIP or via a dialog box opened by a button in the OIP. You could even add a "new" flag field so that the dialog box opens when the object is placed but then check and if it has already opened once then does not open again.

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