problem increased or decreased parameter

Balises:

Hello,

I have a problem that I can't solve

I have a parameter for increased or decreased by 1 unit at a time dialog box.

But it does not work it increases or decreases the parameters of 2 units. !?!?

Do you have an idea of the problem?

tkt
Olivier1

Script settings:
IF GLOB_UI_BUTTON_ID = 1 THEN PARAMETERS test = test + 1
IF GLOB_UI_BUTTON_ID = 2 THEN PARAMETERS test = test - 1

Script dialog box:
I_BUTTON I_FUNCTION , "-" , 5 , 80 , 30 , 20 , 2
I_INFIELD "test" , 50 , 80 , 30 , 20
I_BUTTON I_FUNCTION , "+" , 90 , 80 , 30 , 20 , 1

Administrateur forum : Allplan.leforum.eu

http://allplan.leforum.eu

Olivier1

Pièces-jointes (2)

img
Capture.PNG
Type: image/png
Téléchargé 484 fois
Size: 15,93 KiB
Type: application/octet-stream
Téléchargé 737 fois
Size: 5,29 KiB
1 - 5 (5)
  • 1

Hi,

I have no problem with your SmartPart.
By clicking at "+" the value of "test" is increased.
But if you want to use "test" in the script, the it can fail! Why?
"test" without anything inside a script means always the VARIABLE "test".
You have only access to PARAMETER-values with "PARAMETERS"-Command!
Each PARAMETER is copied into a variable at beginning of each script execution.

So in your script PARAMETER "test" is modified, but the VARIABLE "test" not!
It's important to modify the PARMETER and VARIABLE synchronously by

test=test+1
PARAMETERS test=test

Another problem can be, that Parameter-Script is executed more than one time!
If the IF-criteria matches, then test can incresed twice!
(The GLOB_UI_BUTTON_ID goes to "0" after a parameter-script execution!)

Regards
Jörg

Pièces-jointes (1)

img
variable_vs_parameter.png
Type: image/png
Téléchargé 471 fois
Size: 55,94 KiB

Hello Nemo and thank you for the quick reply.

Strange... my script works poorly on the 2012-1-1 version (not a day), but works well on the 2013 version... just be a bug?

Thanks for the tips on variables and parameters, with your correction that little well avoid problems research.

I take it to be noted that since 2013, keyboard shortcut "Ctrl + >" or "Ctrl + <" for "smartparts" was more functioning.
A shortened yet very useful to guide the "smartparts".

Administrateur forum : Allplan.leforum.eu

http://allplan.leforum.eu

Olivier1

The reason for this error is the following setting being activated: auto-update based on value list, which,personally,I don't know what is used for. This happened since a allplan 2012 update for smartpart (which was made to solve some problems with smartparts inserted in doors or windows).

Pièces-jointes (1)

img
smsettings.png
Type: image/png
Téléchargé 450 fois
Size: 28,28 KiB

Hi,

the behaviour was indeed an error in 2012. It rises only, when the mentioned option was activated.
The setting has the following benefit:
If you have a little script like this (see grid_script.png) for rasterization of length values.
After changing the grid space from "0.001" to "0.1" , it can be, that some values become invalid
(e.g. ref_x = 1.123)
With activated option "Auto-Update based on value list", these values are corrected, so that they match the limits from VALUES-Command (see option.png).

Regards.
Jörg

Pièces-jointes (2)

img
grid_script.png
Type: image/png
Téléchargé 494 fois
Size: 45,33 KiB
img
option.png
Type: image/png
Téléchargé 470 fois
Size: 28,91 KiB
1 - 5 (5)
  • 1

https://campus.allplan.com/ utilise des cookies  -  Plus d'informations

Accepter