a month ago
Hi,
This might be a simple question, but I've not been able to find anything that helps me.
What I would like is quite simple - make A and B have different preset values that can be toggled.
Say I want to make a rectangle, but I want it to have preset dimensions selectable from a list. In my head it should work like this, but it doesn't. Any suggestion would be welcome.
2D
Rect2 0,0,A,B
END
PARAMETERS:
VALUES "size" "min", "medium", "max"
IF "size" = "min" THEN
PARAMETERS A=2
PARAMETERS B=2*2
ENDIF
IF "size" = "medium" THEN
PARAMETERS A=3
PARAMETERS B=3*3
ENDIF
IF "size" = "max" THEN
PARAMETERS A=5
PARAMETERS B=5*5
ENDIF
Solved! Go to Solution.
a month ago
Sorry, I just copied & pasted your script.
Should be
IF size = "min" THEN
A=2
B=2*2
PARAMETERS A=A, B=B
ENDIF
Without the quotes around the size variable.
Barry
a month ago
And something like that ?:
VALUES "size" "min", "max"
LOCK "A", "B"
IF GLOB_MODPAR_NAME ="size" and size = "min" THEN
A=2
B=2*2
PARAMETERS A=A, B=B
ENDIF
IF GLOB_MODPAR_NAME ="size" and size = "max" THEN
A=5
B=5*5
PARAMETERS A=A, B=B
ENDIF
a month ago
First I would ...
LOCK "A", "B"
So they can not be changed by the user.
Then in your parameter script you should always set the value of the parameter first and then set the actual parameter.
So ...
IF "size" = "min" THEN
A=2
B=2*2
PARAMETERS A=A, B=B
ENDIF
Barry.
a month ago - last edited a month ago
a month ago
Hi Barry,
I tested it too, but every rect2 is always 1.00/1.00 and not of the A and B size..... !?
With Lock "A" and "B"... doesn't matter.....
a month ago
Sorry, I just copied & pasted your script.
Should be
IF size = "min" THEN
A=2
B=2*2
PARAMETERS A=A, B=B
ENDIF
Without the quotes around the size variable.
Barry
a month ago
And something like that ?:
VALUES "size" "min", "max"
LOCK "A", "B"
IF GLOB_MODPAR_NAME ="size" and size = "min" THEN
A=2
B=2*2
PARAMETERS A=A, B=B
ENDIF
IF GLOB_MODPAR_NAME ="size" and size = "max" THEN
A=5
B=5*5
PARAMETERS A=A, B=B
ENDIF
a month ago
What does a VALUES{2} command do when used with A or B? I have never tried it with any of the 3 base dimensions. You could then have a dropdown that tells you your values for each option without needing to open the settings dialogue.
Ling.
AC22-28 AUS 3110 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win11 | R5 2600 | 16GB | GTX1660 |
a month ago
Thanks for the reply to both you and @Barry Kelly !
Can't believe it was something as simple as unnecessary quote marks breaking the script, but I'll take heart that I at least was on the right track.
What's the added benefit of adding this to the script?
IF GLOB_MODPAR_NAME ="size" and size = "max" THEN
a month ago
Good suggestion, that is actually more suitable for my intended use (parking space object with different A & B dimensions based on a variety of parameters).
This script works:
VALUES{2} "size" 2.0, "min",
5.0, "max"
VALUES{2} "width" size*2, "minwidth",
size*5, "maxwidth"
LOCK "A", "B"
A=size
B=width
PARAMETERS A=A, B=B
But I would ideally like VALUES{2] for B to be governed by VALUES{2] of the A-dimension. I'm not sure if that is possible? I can't seem to find the right parameter types to use.
VALUES{2} "size" 2.0, "min",
5.0, "max"
VALUES{2} "width" size*2, "minwidth",
size*5, "maxwidth"
LOCK "A", "B"
IF size= "max" THEN
width = "maxwidth"
ELSE
width = "minwidth"
ENDIF
A=size
B=width
PARAMETERS A=A, B=B