2025-06-19 07:38 AM
I have a very simple script for a 2D object that creates a box with minimum dimension 1m, and total area of 3m².
it functions fine except it only seems to accept changes to the A parameter, where ideally i want both A and B to be defined (mainly so you can adjust any hotspot)
the parameters section is as below.
IF A < 1.0 THEN A = 1.0
PARAMETERS A = A
IF B < 1.0 THEN B = 1.0
PARAMETERS B = B
PARAMETERS B = 3/A
i've even tried changing the code to this, but didn't affect anything.
IF a < 1.0 then a = 1.0
IF b < 1.0 then b = 1.0
if glob_modpar_name = "a" then
b = a / 3
parameters b = b
endif
if glob_modpar_name = "b" then
a = b / 3
parameters a = a
endif
is there a more suitable code to allow either parameters to resize the object?
Solved! Go to Solution.
2025-06-20 03:47 AM
Yes, you could do that as well seeing as the maximum size would be 3m.
Then it could be simply ...
VALUES "A" RANGE [1.0,3.0]
VALUES "B" RANGE [1.0,3.0]
if GLOB_MODPAR_NAME = "A" then
B = 3.0/A
endif
if GLOB_MODPAR_NAME = "B" then
A = 3.0/B
endif
PARAMETERS A = A, B = B
You could also create a parameter for the area, if you want an adjustable maximum area.
Then just place that parameter everywhere you see 3.0
Barry.
2025-06-19
10:46 AM
- last edited on
2025-06-21
07:25 PM
by
Laszlo Nagy
Hi,
Try this,
if glob_modpar_name = "A" then
if A < 1.0 then A = 1.0
if A > 3.0 then A = 3.0 ! Area should be 3m2 so A should be < 3
B = 3.0 / A ! Calculate value of B
goto 1:
endif
if glob_modpar_name = "B" then
if B < 1.0 then B = 1.0
if B > 3.0 then B = 3.0! Area should be 3m2 so B should be < 3
A = 3.0 / B ! Calculate value of A
endif
1:
parameters A = A , B = B ! Set the values of A and B
2025-06-19 11:09 AM
Try this.
VALUES "A" RANGE [1.0,]
VALUES "B" RANGE [1.0,]
if GLOB_MODPAR_NAME = "A" then
B = 3.0/A
if B < 1.0 then
B = 1.0
A = 3.0
endif
endif
if GLOB_MODPAR_NAME = "B" then
A = 3.0/B
if A < 1.0 then
A = 1.0
B = 3.0
endif
endif
PARAMETERS A = A, B = B
Barry.
2025-06-20 03:36 AM
Cap the ranges to 3 given the set area with min dimension.
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 |
2025-06-20 03:47 AM
Yes, you could do that as well seeing as the maximum size would be 3m.
Then it could be simply ...
VALUES "A" RANGE [1.0,3.0]
VALUES "B" RANGE [1.0,3.0]
if GLOB_MODPAR_NAME = "A" then
B = 3.0/A
endif
if GLOB_MODPAR_NAME = "B" then
A = 3.0/B
endif
PARAMETERS A = A, B = B
You could also create a parameter for the area, if you want an adjustable maximum area.
Then just place that parameter everywhere you see 3.0
Barry.
2025-06-23 01:38 AM
Fantastic! thank you both very much.
The range with extra parameters for set area and minimum dimension would resolve a couple of objects for me.