Support Forum

problem increased or decreased parameter

Schlagworte:
  • 2012

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

Anhänge (2)

Typ: image/png
486-mal heruntergeladen
Größe: 15,93 KiB
Typ: application/octet-stream
1585-mal heruntergeladen
Größe: 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

Anhänge (1)

Typ: image/png
475-mal heruntergeladen
Größe: 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).

Anhänge (1)

Typ: image/png
453-mal heruntergeladen
Größe: 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

Anhänge (2)

Typ: image/png
498-mal heruntergeladen
Größe: 45,33 KiB
Typ: image/png
475-mal heruntergeladen
Größe: 28,91 KiB