TurboCAD Forums

Turbo Talk => General Discussion => Topic started by: dbottesi on January 24, 2019, 12:24:47 PM

Title: PPM script editor
Post by: dbottesi on January 24, 2019, 12:24:47 PM
Turbocad crashing any time I'm to use box in a script..as shown in the attachment.. trying to make a box without using 2d entity and thickness function.. the script shown in attachment was copied from turbocads user guide and only using it as an example..

My setup Windows 7 and Turbocad professional 21pro
Title: Re: PPM script editor
Post by: nikkipollard on January 24, 2019, 12:36:41 PM
I think you confused TC

It looks like you copied and pasted everything. The colours are a clue that things are  wrong.
There are example symbols that come with TC open one of them to see the expected format.
Or This might help get you started

a line with notes would start with a double backward sash they will be green and ignored by the program.
usually you will have an identifier followed by an equal sign then a recognized command - this would be light blue or the name of a macro - which would be dark blue.(box is a macro you need to write first) (macros are miniscripts  ignore them for now)
After the command there is a bracket, with a set of arguments - depending on the command- separated by comments.
anything PINK would be a mistake.

A typical command would be the Rectangle

R1 is the identifier
Rectangle is the command
the first number(500) is the size in the x direction
300 is the size in the Y direction
next is the x position
and the Y position

to see the rectangle you would need an Output command


If you want a rotated or thickened rectangle you need to add those commands before the Output command



here the rectangle "R1" will be rotated 45 degrees on the Z access at X,Y position 0,0 you will only see the rotated rectangle, To see both you need both R1 and R2 in the Output brackets


Instead of using numbers you can define parameters - which you would be able to change in the section info palette


W is the identifier you will use this as a reference in the program
Parameter is the command

the phrase in inverted commas is what you will see in the SI - all text is usually in inverted commas and will be brown

100 is the default size

and LINEAR is the type of input expected.

//so you will have something like this for a rotated  rectangle

RA=Parameter("rotation angle",100,LINEAR)

I hope this helps.

Title: Re: PPM script editor
Post by: dbottesi on January 24, 2019, 01:05:50 PM
Ok getting same thing if I write script like this

Output (B1)

See attachment ..
Title: Re: PPM script editor
Post by: Torfinn on January 24, 2019, 01:28:07 PM
You dont have the "Box" (ppm) so you need to make that one first before you call it up.
You can see its not a normal command by the color, it's darker blue than the rest of commands.
The box.ppm is inside the Helpfile

If you go down 1 level in the Helpfile there is an example of a 3Arch window you can copy and study, i'm pretty sure it will work "straigth out of the box", but you will need to save it before you can use it and later load it in to Library Palette and insert it from there.

I tested it and it works like a charm, paste it in below


H = Parameter("Window Height", 1200, LINEAR, Interval(400, 10000));
W = Parameter("Window Width", 2000, LINEAR, Interval(700, 10000));
Curvature = Parameter("Curvature", 40, LINEAR, Interval(0, 100));
elevation = Parameter("Window Eleveation", 700, LINEAR, Interval(0, 10000));
sash = Parameter("Window Sash", 30, LINEAR, Interval(0, 100));

W1 = W/3.0;
P00 = Point(0,0); P10 = Point(0, H); P11 = Point(W1, H); P12 = Point(2*W1, H); P13 = Point(3*W1, H); P03 = Point(3*W1, 0);
C1 = Point(0.5*(PointX(P10) + PointX(P11)), 0.5*(PointY(P10) + PointY(P11)) - Curvature);
C2 = Point(0.5*(PointX(P11) + PointX(P12)), 0.5*(PointY(P11) + PointY(P12)) - Curvature);
C3 = Point(0.5*(PointX(P12) + PointX(P13)), 0.5*(PointY(P12) + PointY(P13)) - Curvature);
contour = Polyline(P10, Arc0(PointX(C1), PointY(C1)), P11, Arc0(PointX(C2), PointY(C2)), P12, Arc0(PointX(C3), PointY(C3)), P13, P03, P00, P10);
contourZ = RotateX(contour, 90); ClipContour = SetProperties(contourZ, "#$AUX@_Contour" = 1, "PenColor"= 0x0000ff);
TS = RefPoint (W/2, 0, -elevation); Output(ClipContour, TS);
PL = Point(sash/2, H); PR = Point(W1 - sash/2, H); ArcWind1 = Polyline(Point(sash/2, 0),  Point(sash/2, H),  Arc0(PointX(C1), PointY(C1)),
     Point(W1 - sash/2, H), Point(W1 - sash/2, 0), Point(sash/2, 0)); ArcWindz1 = RotateX(ArcWind1, 90);
ArcWind2 = Move(ArcWind1, W1, 0, 0); ArcWindz2 = RotateX(ArcWind2, 90);
ArcWind3 = Move(ArcWind2, W1, 0, 0); ArcWindz3 = RotateX(ArcWind3, 90);
ArcWindz1D = Thickness(ArcWindz1, sash); ArcWindz1Surf = SetProperties(ArcWindz1D, "Solid" = 0);
ArcWindz2D = Thickness(ArcWindz2, sash); ArcWindz2Surf = SetProperties(ArcWindz2D, "Solid" = 0);
ArcWindz3D = Thickness(ArcWindz3, sash); ArcWindz3Surf = SetProperties(ArcWindz3D, "Solid" = 0);
contourZ3D = Thickness(contourZ, sash); contourZ3DSurf = SetProperties(contourZ3D, "Solid" = 0);
res1 = BooleanSubtract(contourZ3DSurf, ArcWindz3Surf);  res2 = BooleanSubtract(res1, ArcWindz2Surf);  res3 = BooleanSubtract(res2, ArcWindz1Surf);


Title: Re: PPM script editor
Post by: Torfinn on January 24, 2019, 01:36:56 PM
And that is maybe a lot for the first attempt, but it will show you what you can do With ppm's.
What you should do is to read all section about ppm inside the helpfile, start on top and work yourself true it.
When you are finish, start at the top again and try to make all or at least most of the examples shown, some work, some dont, and dont waste your time on trying to use a Block, that one dont work in ppm v1 like we have in TC ;)

Title: Re: PPM script editor
Post by: dbottesi on January 24, 2019, 01:55:12 PM
Ok think I'm getting it now..box doesn't insert the same way as creating 3d entity directly like sphere and cone..will have to study further to get a better understanding..been going through user guide much like you've explained.. coming along ok so far with some of the basics.. lot more to learn though
Title: Re: PPM script editor
Post by: Torfinn on January 24, 2019, 04:06:17 PM
Yes, thats correct, the Box dont exist inside the list of commands we can use, but there are an example that show how to make it.

That Box.ppm should normally not work like a stand alone ppm, so we put it a folder we call Macro or wathever we want :)
The only thing that is important is that it is in the same "Level" as the main ppm file or 1 step down from it.
So …/ My Dokument/ Symbols/ Macro will not work, but …/ My Dokument/ Symbols/ My Symbols/ Macro will, as it is 1 step down from where i have my executing ppm's in …/ My Dokument/ Symbols/ My Symbols

And that is what we see on the color change in commands, if it is a original (blue) or if it is something we have made( dark blue), and if we type wrong, TC think this is something we have made and the color will be dark blue, so by that we know if there is a typo in it.

The benefit of this is that we can make many Macro/ ppm's and re-use them in our executing ppm's, by that we save time and Space as ppm's have a filesize limit, it was 36 Kb, but i think to remember they changed it to 72 Kb.

Title: Re: PPM script editor
Post by: nikkipollard on January 24, 2019, 08:46:26 PM
The other thing to do - which helped me a lot is read the older posts in the PPM section. Lots of tips there.
In the beginning I cut and pasted code from other peoples PPMs and modified them to do what I wanted.
 And I asked a lot of questions - Torfinn knows a lot and is a big help!
Title: Re: PPM script editor
Post by: dbottesi on January 24, 2019, 09:52:34 PM
Here's my first attempt at making script after a little practice.. just having a little fun with it really..might think of it as stud wall or spindle spacing.. allowing for adjustment to the first stud..still needs some work as layout doesn't come out correctly.. needing to add stud to end.

// Total Length
T=Parameter("Total Length",48,LINEAR);
// Stud Spacing
// First stud rectangle
// First Stud spacing
FS=Parameter("First Stud Spacing",12,LINEAR);
// Last Stud
// Stud copy
S=Parameter("Stud Spacing",12,LINEAR)
// stud to lest
AD=Parameter("Add Studs to end",0, LINEAR)
Title: Re: PPM script editor
Post by: Torfinn on January 25, 2019, 01:00:34 AM
Thats good as a first ppm :)
I dont understand why you want to add extra studs in the end, outside the wall's length.
I guess AD is for how many studs extra you want, then it dont need LINEAR as that will add "in" to the value when you take it in to your Library Palette.

You maybe want to look at the Mod command  for how to end the studs at the end of a wall

Title: Re: PPM script editor
Post by: dbottesi on January 26, 2019, 04:12:35 PM
Last stud was more of a bandaid in hopes of coming up with something better . you could set 0  for no stud or 1 as a filler..my problem was when having  say a 11 ft wall w/ 2ft spacing  it would leave a gap of 3ft between 2nd too n last stud..
Title: Re: PPM script editor
Post by: Torfinn on January 26, 2019, 05:44:59 PM
Yes, that is what it will be as long as you have a start value for the 2nd stud and then a total length that dont match the spacing between the other studs.
You could add the last one seperate and take away 1 in the "pattern", but still there will be some wall total size that will not fit perfect, or you could make them Equal at both ends if you drop the start value on the 2 stud, but then again, not all walls start with the same distance to the second stud, so maybe 2 ppm's will be neded to make it for a full building.

Title: Re: PPM script editor
Post by: nikkipollard on January 26, 2019, 10:07:26 PM
for curtain walls
 I have a parameter which gives a spacing distance
 spac=Parameter ("spacing",700,LINEAR)

another a parameter where you can choose how you want to space the mullions (or studs in your case).
ST=Parameter ("spacing type","max",TEXT,Set("max","fixed"))
Either "max" or "fixed",(you can have a  "min" too)
  and another parameter ,which only works with the fixed option, where you choose the alignment of the extra space.

AL=Parameter ("alignment","centred",TEXT, Set("left","right","centred"))
"left" "right" or "centred"

in the program I have a sum which works out the number of Mullions I need
another calculation that would work out what the spacing would be if I used the "max" option
 Use the IF command to to tell the program which spacing figure to use depending on the chosen parameter.

Use those parameters to draw and copy the mullions

Then use a similar sytem to move the  group according to the alignment parameter.