News:

Please remember to do a search before you ask a question!

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

PPM Scripting: IF for use in Rectangle argument Coordinates

Started by Alvin Gregorio, February 24, 2024, 07:28:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alvin Gregorio

Just for my own cognitive gymnastics-- Please see the question in the attached image.
And/or input on why it doesn't work.

Units(1[mm]);

PS=Parameter("Paper Size","A0",TEXT,
  Set("A0","A1","A2","A3","A4"));
PO=Parameter("Paper Orientation",TEXT,
  Set("Portrait","Landscape"));

A0=(841,1189);
Df=(16,9);

If=IF(PS=="A0",A0,Df);

R=Rectangle(If);

Output(R);
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Torfinn

The Rectangle ppm is written so you have to give 2 arguments, one for x and one for y, if you do that it will work
I don't understand the Df, as whatever you choose except A0 will give you Df, but maybe you have a plan for it later

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

sauerkraut2018

Hello,

could it work with "Array"?

e.g.

A0=Array(Point(0,0),Point(1189,0),Point(1189,841),Point(0,841));
...
R0=Polyline(A0);
Output(R0);

#-----
Very low knowledge of English - I ask for indulgence - Thanks
Currently installed
TurboCAD Professional 32-bit V.17.2.77.1
TurboCAD 2016 ProPlatinum 64-bit V23.2-61.2 engl.
TurboCAD 2021 Platinum 64-bit V28.0 B.82.3 de.
#-----

nikkipollard

#3
You could do this



L1= IF(PS=="A0",1189,841)
W1= IF(PS=="A0",16,9)
L= IF(PO == "Portrait",W1,L1)
W= IF(PO == "Portrait",L1,W1)

Frame = Rectangle(L,W,L/2,W/2)



An Array might work But I seem to remember having problems with using Arrays in conditional statements.


Or take a look at the bolt example found here
C:\Program Files\IMSIDesign\TCW2021\Symbols\PPM\EN\Bolt

I like my system Because it means I can use those values throughout the script.
If I wanted to put my name in the bottom left corner. I can use L and W without needing to recalculate them.

Note the Rectangle function has 2 optional Parameters, after width and height, for the x and y location of the rectangle.

Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Torfinn

I agree with Nikki, use a Database for it, then you only need to select the Paper size afterwards
I use that on all my steel profiles, as they are similar, just some small differences here and there, but the shape is the same

Torfinn
V20, V21, 2015 > 2024  Platinum
Deluxe 2015/ 16/ 19
RedSDK enabled
Windows 10 Home Premium (20H2/ 19042.1083) 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB

Alvin Gregorio

Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)