problem increased or decreased parameter

Теги:

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

Вложения (2)

Type: image/png
Загружено 486 раз
Size: 15,93 KiB
Type: application/octet-stream
Загружено 1369 раз
Size: 5,29 KiB

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

Вложения (1)

Type: image/png
Загружено 475 раз
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).

Вложения (1)

Type: image/png
Загружено 453 раз
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

Вложения (2)

Type: image/png
Загружено 498 раз
Size: 45,33 KiB
Type: image/png
Загружено 475 раз
Size: 28,91 KiB

https://campus.allplan.com/ uses cookies  -  More information

Accept