News:

The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software can be used with TurboCAD.

Main Menu

Parametric Parts (via Parametric Part Script Editing)

Started by Alvin Gregorio, November 26, 2019, 09:20:59 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Torfinn

""
Where I am currently.
Still not working.
What does the Pink text tell me?
""
The Magenta color is to tell you that there are something wrong, normally some place before where the magenta start, in your case you did miss a ")" on Y1 line in the end, and by that everything after it will be wrong

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

Quote from: Torfinn on January 10, 2020, 04:54:01 AM
... in your case you did miss a ")" on Y1 line in the end, and by that everything after it will be wrong

Torfinn

Hello Torfinn.  Yes, the ) and ( are very difficult to visually ensure they are all there.
It would have been nice if the developers of the script editor would have included highlighting of the other parenthesis in a pair, when one is selected.

I realize that mistake-- and typographical and misspelling errors-- are probably the most common and frustrating issues when encountering PPM scripts that do not work.  It's very difficult to suss out those little things.

I have learned to count the ) and ( to try to ensure there are an even number of them.
______
I must have discovered that missing ), because the script I shared after that one-- the script in the Post just previous to yours-- does not have that error.
Can you look at that Post and script and its attached image and see if you can find what the issue is?
If you have time and are interested...

Thanks, Alvin
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)

Alvin Gregorio

I got it to work.  I changed my angle value from radians of .5235987756 to degrees of 30.

From my reading on the Help Documentation, I was under the erroneous understanding that when using trigonometric formulas in the PPM script editor (PPSE), radian values are to be used for angles in formulas.




// Here is a description of an equilateral Triangle

SL = Parameter("Side Length", 1, LINEAR);

Y1=((SL/2)*(tan(30)));//uses Degrees (if SL=1; Y1=.2886751346)
Y3=((SL/2)/(tan(30)));//uses Degrees (if SL=1; Y3=.8660254038)

Tri=Polyline(
Point((SL/2*-1),(Y1*-1)),//First point (lower/left)
Point(0,(Y3-Y1)),//Second point (top/peak)
Point((SL/2),(Y1*-1)),//Third point (bottom/right)
Point((SL/2*-1),(Y1*-1))//Fourth, closing, point (same as First;lower/left)
);

Output(Tri);
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)

Alvin Gregorio

It is a shame that Dimensions inserted with the "Associative..." option checked snapped to Parametric Symbols do not associate.
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)

Alvin Gregorio

I have improved my Parametric Symbol PPM script.
I have added a Parametric Reference Point; Default Value/location=0,0,0.




// Here is a description of an equilateral Triangle

//Triangle, basic
SL = Parameter("Side Length", 1, LINEAR);

Y1=((SL/2)*(tan(30))); //uses Degrees (if SL=1; Y1=.2886751346)
Y3=((SL/2)/(tan(30))); //uses Degrees (if SL=1; Y3=.8660254038)

//Reference Point
RPX=Parameter("RP X",0,LINEAR); //Triangle's Reference Pt. X coordinate
RPY=Parameter("RP Y",0,LINEAR); //Triangle's Reference Pt. Y coordinate
RPZ=Parameter("RP Z",0,LINEAR); //Triangle's Reference Pt. Z coordinate
P0=ParameterPoint(0,RPX,RPY,RPZ);

Tri=Polyline(
Point((SL/2*-1),(Y1*-1)), //First point (lower/left)
Point(0,(Y3-Y1)), //Second point (top/peak)
Point((SL/2),(Y1*-1)), //Third point (bottom/right)
Point((SL/2*-1),(Y1*-1)) //Fourth, closing, point (same as First;lower/left)
);

RP=RefPoint(Tri,P0);

Output(Tri,RP);
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

I just add extra ")" 's in the end, until the semicolon turns red, and then take away 1 ")" to make it black again if there is many of them.
In SD, ppm v2 as i call it, it will show/ get marked so we can see if it's correct or not, but ppm in TC is very old and dont have that function.

ppm is a symbol, and Dimensions will not associate with it before it's exploded, but then it's not a ppm anymore, so ...
But you can do like Nikki have done with some of here's ppm's, she draw the Dimension inside the ppm itself.
And in SD again, there they have a function that do it, but most likely TC will not understand that function, so it's not possible to use if we want to insert the symbol in TC, except if we save it as a dwg and insert the dwg in to TC, but that is then not a symbol so ...

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

Has anyone been successful in getting the Sweep function's rotation angle argument (the third, in that expression) to work-- without crashing TurboCAD?

In trying to create a "Triangular Mobius" PPM script, I have successfully created all of it, including the Output being the Sweep object.  I have even made the Output include RotateX the Sweep profile object and path so that it is 90°, rotated about the X axis (in Front View, it now looks as it would in Plan View, if not rotated).
The equilateral triangle sides' lengths and the sweep circle path diameter are the Parameters.

All I need now is to include that 120° twist-- rotation-- in the Sweep's rotation argument.
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)

Alvin Gregorio

Same thing (as just-previous post) here (script below).
This is for a very simplified test of the Sweep's rotation argument effectiveness.  It is not working.
Any input?



R=Rectangle(1,1);
Pth=Polyline(Point(0,0,0),Point(0,0,10));
P=Sweep(R,Pth,90);
Output(P);
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

Here Alvin

It will twist 360 degree for each *2, like in 2,4,6,8. ( 1 turn = PI *2 )

And if you have crashed TC when making a ppm, you want to check if there is left a Temp. x number and delete it before opening ppm Library again, as it may give you some "fun" if you have it.

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

Quote from: Torfinn on January 11, 2020, 03:22:23 PM
Here Alvin

It will twist 360 degree for each *2, like in 2,4,6,8. ( 1 turn = PI *2 )

And if you have crashed TC when making a ppm, you want to check if there is left a Temp. x number and delete it before opening ppm Library again, as it may give you some "fun" if you have it.

Torfinn

Radians.  That's FANTASTIC!  Thanks Torfinn.

How did you ever discover that?

What other things can you think of that require Radian input or result in Radian output for angles?

Again-- FANTASTIC!  Thanks Torfinn!

(is that the view out your window in Norway?)
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

Youre welcome.
Like i  at least one time and Nikki i believe many times have told, use the Macro recorder and see how it's written in the macro file after doing something, it give a lot of tip of how to write it in ppm's, sometimes it work, sometimes not.
Depend what you are doing i assume, normally i never do anything that is not related to a house or similar, as i cant use it later and then waste of time for me :)

About the background, nope, just a pic i found on net, i like the colors in it, especial the sky.
For the last weeks the view out of my windows are sort of grey ish, a very early fall this year maybe :)
The good thing about it is that temperature is above 0 degree, i hate snow, except on pictures where someone have written Merry Christmas and similar :)

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

Henry Hubich

"What other things can you think of that require Radian input or result in Radian output for angles?"

All of the "...by Law" tools: Surface by Law, Warp by Law, Offset by Law. Also the trig and inverse trig functions in the Calculator palette.

Henry H

Torfinn

I dont believe by law will work in a ppm Henry, but i have never try'd, so who knows.

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

John R

"What other things can you think of that require Radian input or result in Radian output for angles?"

I believe all the Angle properties in the TurboCAD Explorer use a Radian value instead of a Degree. It's been like that since the beginning.
John R.

V17—V21, 2015—2025
Designer, Deluxe, (Basic, Expert, Professional), Platinum
RedSDK enabled
Windows 11 Pro (25H2), 64-bit

Alvin Gregorio

Thanks Henry and Torfinn and John.
I'll keep that Radians option to the forefront of my mind when working with angles settings and values, etc.  Good to know.

Attached is what I've been working on.  It's a Triangular Mobius Parametric Symbol, including the script.
I never did get the SetProperties argument "PenWidth"=-1(ByLayer) to work.  At least I got the color to be "By Layer".
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

Hi Alvin

A ppm pencolor is Default by Layer , so you only need to change it if you want a different color than by Layer
In TC we can only set 1 Property at the time, so if we do it in several step it will work, incl pen width
I use Design Director to change Pen Width, and Color, color can also be changed directly in Menu Bar
See Attached, where i split them and take away color by Layer, i leave the line as you may want 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

Alvin Gregorio

Thank You Torfinn.  Happy Sunday!  Two big American football NFL (National Football League) games on today.  Yay!  I will be watching, as I did yesterday-- the other two.

Question:  In the PPM script I provided and you edited, what would be the Output argument if we wanted both ByLayer and PenWidth SetProperties, but had to place them with, as you say, different Identifiers?  So as to not end up with two instances of the almost-same symbol inserted.
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)

Alvin Gregorio

#117
Also Torfinn-- When I edit my script to follow yours, for the PenWidth, the result of the insertion does not have the PenWidth=ByLayer; though the argument for that is -3.  I notice in your screen-capture the same thing.

EDIT:  I notice now that even though the PPM symbol insertion has reported Pen Properties of 0, it is in fact ByLayer.  Which leads me to another issue/question:  How do we set a PPM script PenWidth so that it is an editable/change-able value without Exploding?  EDIT-2:  Same question regarding PenColor.
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

Hi Alvin

I wrote that in the reply, i use Design Director for change them both, but Color can also be changed in Menu Bar.

In attached i set Tri and Mobius to have different color's, both different from Layer color that is blue in this example.
There is only Layer 0 in the drawing
You can also overwrite Layer to something different than 0, but you will need to have that layer inside TC before running the ppm, else TC will put it in default 0.
The ppm will not make the layer if you dont have it.

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

Thanks Torfinn-- again.

So, basically, if we want multiple SetProperties, we need not only to do them individually, but also such that the definition of each is the Identifier of another?  Thereby allowing for Output of only one instance of that entity which the multiple SetProperties relate to.
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

Hi Alvin

Yes, that was what i try'd to show with arrows in the first picture.

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

Torfinn

I forgot to say, you can also put it all in 1 line, with multiple Setproperties, only me that like to seperate them, easyer to follow for me :)

Swp=Sweep(MTRP,RtC);

SwpSP1=SetProperties(SetProperties(
Swp,"$TWISTANGLE"=2.094395102393195, //the all-important 120° Twist
"PenColor"=1xff00),"PenWidth"=-3);

The point is that we can only change 1 property at the time in TC.

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

#122
Yes, much better.  Thanks Torfinn.

I assume what you meant by changing the inserted symbol's PenWidth via Design Director is that you change its Layer PenWidth.
I'm not fully a fan of that.  So:
____________________
What I just discovered is that if we set the SetProperties/"PenWidth" argument to -4 (By Block, I presume), it behaves as I would like-- fully change-able Pen Width values via the Property Toolbar, Properties, or Selection Info Palette.  Good stuff.
I will do that with PenColor, as well; and see if it works successfully.
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)

Alvin Gregorio

Quote from: Alvin Gregorio on January 12, 2020, 10:24:12 AM
...
What I just discovered is that if we set the SetProperties/"PenWidth" argument to -4 (By Block, I presume), it behaves as I would like-- fully change-able Pen Width values via the Property Toolbar, Properties, or Selection Info Palette.  Good stuff.
I will do that with PenColor, as well; and see if it works successfully.

"I will do that with PenColor, as well; and see if it works successfully."
    Does not work
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)

John R

John R.

V17—V21, 2015—2025
Designer, Deluxe, (Basic, Expert, Professional), Platinum
RedSDK enabled
Windows 11 Pro (25H2), 64-bit

Torfinn

Thanks John

PenColor works with -4 ( by Block) in HL/HL and Draft/ OpenGL.

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

#126
Now, after having spent a total of about 10 conscious* hours working with it, I feel I have a pretty good grasp on this PPM script-writing-in-TurboCAD thing.  I even pretty much know what I yet do not know.

But I have to say-- I'm not so sure it is superior to using Constraints and/or Part Tree, separately or in conjunction.  Different strokes for different folks, I guess.  I suppose there are cases where one or a combination of methods is superior to another or others.
For me, it's just not that much fun-- fairly tedious actually.  It's the intellectual curiosity of "did I get that correct?" and "what is the result of what I just typed?" that keeps it at all interesting and somewhat "fun".
_______
They say that seniors looking for a new career path ought to consider Coding.  I read advisement articles suggesting those late in their working years perhaps taking classes in software/application Code writing.  I can now see that probably isn't something I should pursue.
_______
*cannot discount the efficacy of the subconscious hours applied-- while watching Football on the telly, driving, walking, and during sleep
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

I agree and disagree :)

It has to be something useful that TC dont have, something you use often and even can sell.
My house ppm have now made me close to 20 000 us $, how many Project it did sell when i was still building houses i dont know.
Before v 2018, add framing to windows was a PITA, so saved a lot of time using the ppm.
Paneldoors with more than 4 leafs, very handy to, Samba Stair, and all the basic steel beams etc etc.

If you only make like the Mobius, waste of time.

Attached picture of some of my ppm's

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

I think you hit the nail on the head Torfinn.  I was going to add, before reading your post

     The main and most important thing I can't figure out about PPM script writing is how to make money from it.
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

It's about make something people want, that take time but quick with a ppm,
Most of the ppm i make is first for my self, i save time when using them, and by that make Money as i seldom work pr hour.
And if they seems to be useful for others to then sell the ppm, but where can be the issue.
And also it's not possible to encrypt them in TC, so that is an issue, copying.

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

Hello All.  I could use a little tutoring in my PPM script writing.

In the script below, which results in a torus, how can I

  • Set each of the OD Parameter values to not be allowed to be so large or small that it results in a self-interesting object error.
  • Sort the Parameters displayed in SI: OD,RD,ST.
Thanks for any help. With your help, I've been learning.


Units(1[mm])

OD=Parameter("Outside Diameter",10,LINEAR);
ST=Parameter("Wall Thickness",1,LINEAR);
RD=Parameter("Ring Outside Diameter",100,LINEAR);

TC=Circle(OD/2);
SC=Circle(RD/2-OD/2);
MvTC=Move(TC,RD/2-OD/2,0,0);
RtMv=RotateX(MvTC,90);
SwpTC=Sweep(RtMv,SC);
Shl=G3Shell(SwpTC,(RD,0,0),-ST);
SP=SetProperties(Shl,"PenColor"=-4,"PenWidth"=-4);

Output(SP);
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)

Henry Hubich

Quote from: Alvin Gregorio on January 14, 2020, 05:32:01 PM
Hello All.  I could use a little tutoring in my PPM script writing.

In the script below, which results in a torus, how can I

  • Set each of the OD Parameter values to not be allowed to be so large or small that it results in a self-interesting object error.
  • Sort the Parameters displayed in SI: OD,RD,ST.
Thanks for any help. With your help, I've been learning.


Units(1[mm])

OD=Parameter("Outside Diameter",10,LINEAR);
ST=Parameter("Wall Thickness",1,LINEAR);
RD=Parameter("Ring Outside Diameter",100,LINEAR);

TC=Circle(OD/2);
SC=Circle(RD/2-OD/2);
MvTC=Move(TC,RD/2-OD/2,0,0);
RtMv=RotateX(MvTC,90);
SwpTC=Sweep(RtMv,SC);
Shl=G3Shell(SwpTC,(RD,0,0),-ST);
SP=SetProperties(Shl,"PenColor"=-4,"PenWidth"=-4);

Output(SP);

Alvin, I know zip about PPM, but I used to do quite a bit of coding in Basic and C. Does PPM offer any kind of "If...Then" capability?

Henry H

Alvin Gregorio

Quote from: Henry Hubich on January 14, 2020, 05:46:06 PM
...

Alvin, I know zip about PPM, but I used to do quite a bit of coding in Basic and C. Does PPM offer any kind of "If...Then" capability?

Henry H

Yes.  For sure.  Maybe my subconscious will work on that path while I'm at the movies tonight.

Thanks for the input Henry
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

We have IF then else and we can have as many IF, Then as we want
xx = IF(X =Y,Then,Else);
And many basic commands will work in ppm. like  "" in Excel = nothing also work in ppm.

Alvin can use that to overrule the parameters
OD change to OD1 in example, then he dont need to re-write the rest of the ppm.

Something like this;
OD1=Parameter("Outside Diameter",10,LINEAR);
OD = IF( OD1 <= (RD/5),OD1,(OD1/5));

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

Good thinking Torfinn.  I will give it a try tomorrow.

Every time I try, and am wrong, TurboCAD Crash.  That's a nuisance; makes it take a while to use trial & error.
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

Thats the PITA Alvin :)
ppm is powerfull on TC's system, but if you are not sure if you do correct, remember to save the ppm before test run, you will remember it after several rewritings of the ppm ;):)
And also check if there are any Temp files inside the place you save the ppm, delete them if there are.

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

Quote from: Alvin Gregorio on January 14, 2020, 05:32:01 PM
Hello All.  I could use a little tutoring in my PPM script writing.

In the script below, which results in a torus, how can I

  • Set each of the OD Parameter values to not be allowed to be so large or small that it results in a self-interesting object error.

Nothing is working.  Whenever I enter a Parameter Value in SI that should result in a null return, and default back to the previous entry, the entry I entered remains, and ultimately TC Crashes.

Unlike, say-- an inserted Torus object.  If we change any of an inserted Torus' "parameters" such that it results in an unrealistic and non-generate-able object, we get a "Self intersecting... " error message; BUT also the "parameter" entry reverts back to what it previously was, the object does not get "de-selected" (as is the case with the PPM symbol), and TC does not Crash.

We need to be able to get our PPM script symbols to behave in the same way that inserted TC 3D Objects do, regarding entering erroneous Parameter values.
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)

Henry Hubich

Quote from: Alvin Gregorio on January 15, 2020, 08:37:05 AM
Quote from: Alvin Gregorio on January 14, 2020, 05:32:01 PM
Hello All.  I could use a little tutoring in my PPM script writing.

In the script below, which results in a torus, how can I

  • Set each of the OD Parameter values to not be allowed to be so large or small that it results in a self-interesting object error.


Nothing is working.  Whenever I enter a Parameter Value in SI that should result in a null return, and default back to the previous entry, the entry I entered remains, and ultimately TC Crashes.

Unlike, say-- an inserted Torus object.  If we change any of an inserted Torus' "parameters" such that it results in an unrealistic and non-generate-able object, we get a "Self intersecting... " error message; BUT also the "parameter" entry reverts back to what it previously was, the object does not get "de-selected" (as is the case with the PPM symbol), and TC does not Crash.

We need to be able to get our PPM script symbols to behave in the same way that inserted TC 3D Objects do, regarding entering erroneous Parameter values.

In the case of a Torus, you'd want the PPM to compare your requested parameters--whatever they may be--to see whether the tube radius is going to exceed the base radius, and if it is, then to change one of your requests to prevent this from happening. That's where you'd use the PPM equivalent of "If...Then."

Henry H

Torfinn

Here Alvin

I did take away PenColor as Default is by layer and you cant set 2 Properties in one go in TC.
Also remembered the Control in Library and SI palette you was asking about
ABC Control it and have to be the first Output, else it will not work, as it is a dummie

The line i add Control the RD to be min 3 times the OD dia, test it like it is here, it will not crash but will make 5 to 30 on RD
And then change RD to something that make sense for later use
*********************
Units(1[mm])

OD=Parameter("Outside Diameter",10,LINEAR);
ST=Parameter("Wall Thickness",1,LINEAR);
RD1=Parameter("Ring Outside Diameter",5,LINEAR);
//-----|--------  IF --------|Then|Else|
RD=IF(RD1>=(OD*3),RD1,(OD*3));

ABC =(OD,ST,RD1);//Control how i look like in Library
Output(ABC);// Must to be the first output for working

TC=Circle(OD/2);
SC=Circle(RD/2-OD/2);
MvTC=Move(TC,RD/2-OD/2,0,0);
RtMv=RotateX(MvTC,90);
SwpTC=Sweep(RtMv,SC);
Shl=G3Shell(SwpTC,(RD,0,0),-ST);
SP=SetProperties(Shl,"PenWidth"=-4);

Output(SP);
******************************

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

Thanks Henry, for the input.  That's definitely a "parameter" to keep in mind.

Thanks for the PPM script edit Torfinn.  It's closer.  But still has issues.
Values entered and/or displayed in SI info Parametric Symbol section do not always correlate with the inserted symbol object's dimensions.
This could be confusing to a user.

But, getting closer... On the right track.

I will have another go at it.
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

#140
If you want you can add some txt in to be displayed if the RD is to small comperred to the OD, and then only show the txt, not the ring.
Try it like this and then change RD1 to 21 ++ and see the difference

Torfinn
********************
Units(1[mm])

OD=Parameter("Outside Diameter",10,LINEAR);
ST=Parameter("Wall Thickness",1,LINEAR);
RD1=Parameter("Ring Outside Diameter",2,LINEAR);
// |-    IF    -|Then|Else|
RD=IF(RD1>=(OD*2.001),RD1,(OD*2.001));

ABC =(OD,ST,RD1);//Control how it look like in Library
Output(ABC);// Must to be the first output for working

TC=Circle(OD/2);
SC=Circle(RD/2-OD/2);
MvTC=Move(TC,RD/2-OD/2,0,0);
RtMv=RotateX(MvTC,90);
SwpTC=Sweep(RtMv,SC);
Shl=G3Shell(SwpTC,(RD,0,0),-ST);
SP=SetProperties(Shl,"PenWidth"=-4);
SP2 = IF(RD1 >=(OD*2.001),SP,TXT);


TXT = SetProperties(Move(Text("Radius Outside Diameter is to small ", Fnt, Fsty),0,0),"PenColor"= 252,3,3);
Fnt  = TextFont(0,(OD*5),0,"Arial");
Fsty = TextStyle(LEFT, TOP,ITALIC);

Output(SP2);

Edit;
Typo, i dont think People care how i look like in Library, most likely they will never see me there at all :))
"ABC =(OD,ST,RD1);//Control how i look like in Library" 👍
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

Quote from: Torfinn on January 15, 2020, 11:43:30 AM
If you want you can add some txt in to be displayed if the RD is to small comperred to the OD, and then only show the txt, not the ring.
Try it like this and then change RD1 to 21 ++ and see the difference

Torfinn

That is a good addition.

Thanks Torfinn.  I'm learning.  I hope others that are following along are learning also.  Main thing is-- PPM script writing is not that difficult to learn once once sets their mind to it and gives it some focused effort.  And has Torfinn and Nikki* and others there to help. :)

_______
*We haven't heard from Nikki in a while.  Her Profile says she was last active January 5th.  I hope all is well and okay with her.  Let's hope she is just on vacation.
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)

Alvin Gregorio

#142
I got a giggle every time I encountered your warning message Torfinn.

I've changed it a little bit here:


Units(1[mm])

OD=Parameter("Outside Diameter",10,LINEAR);
ST=Parameter("Wall Thickness",1,LINEAR);
RD1=Parameter("Ring Outside Diameter",2,LINEAR);
// |-    IF    -|Then|Else|
RD=IF(RD1>=(OD*2.001),RD1,(OD*2.001));

ABC =(OD,ST,RD1);//Control how i look like in Library
Output(ABC);// Must to be the first output for working

TC=Circle(OD/2);
SC=Circle(RD/2-OD/2);
MvTC=Move(TC,RD/2-OD/2,0,0);
RtMv=RotateX(MvTC,90);
SwpTC=Sweep(RtMv,SC);
Shl=G3Shell(SwpTC,(RD,0,0),-ST);
SP=SetProperties(Shl,"PenWidth"=-4);
SP2 = IF(RD1 >=(OD*2.001),SP,GrpTxt);


TXT = SetProperties(Move(Text("Ring Outside Diameter is too small.", Fnt, Fsty),0,0),"PenColor"= 252,3,3);
TXT2 = SetProperties(Move(Text("What were you thinking? :-)", Fnt, Fsty2),0,0),"PenColor"= 16711680);
MvTxt2=Move(TXT2,0,-(RD/4),0);
Fnt  = TextFont(0,(RD/4),0,"Arial");
Fsty = TextStyle(CENTER,MIDDLE,ITALIC);
Fsty2 = TextStyle(CENTER,MIDDLE,BOLD);
GrpTxt=Group(TXT,MvTxt2);

Output(SP2);
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

Yes it's possible to have some fun with it also Alvin :)
In the TXT there is actually a move command, but it's set to 0,0 in that one as it should not show if the ring is ok and put out.

I have similar in my Excel house calc , a quick calc for complete standard house, all different groups, so it take me 3 min to give a price.
In that one i can set floor to be wood/ beams or concrete at the same time, but if i do that i get a message
"What the f...., how are you planning to do that, stupid or what !!" :))

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

nikkipollard

Quote from: Torfinn on January 14, 2020, 09:52:34 PM
Thats the PITA Alvin :)
ppm is powerfull on TC's system, but if you are not sure if you do correct, remember to save the ppm before test run, you will remember it after several rewritings of the ppm ;):)
And also check if there are any Temp files inside the place you save the ppm, delete them if there are.

Torfinn

occasionally when TC crashes because of a ppm there is a  file Temp0.ppm in that folder. Sort of a back up of the ppm.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

nikkipollard

Quote from: Torfinn on January 12, 2020, 09:01:18 AM
Hi Alvin

I wrote that in the reply, i use Design Director for change them both, but Color can also be changed in Menu Bar.

In attached i set Tri and Mobius to have different color's, both different from Layer color that is blue in this example.
There is only Layer 0 in the drawing
You can also overwrite Layer to something different than 0, but you will need to have that layer inside TC before running the ppm, else TC will put it in default 0.
The ppm will not make the layer if you dont have it.

Torfinn

I have started to use a text parameter for layer. Mainly to reduce the number of layers in my template file.
It is easy to change the layer without changing the script or exploding the symbol.

lay=Parameter("Layer","blue",TEXT)
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Torfinn

Hi Nikki

Good to see you here again, and a very good ide'a, as in my House ppm there is used 9 different layers, and the Layers has to be there before insert the symbol, else everything is on layer 0 and we cant control what we want to see, all or nothing kind of thing.

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

nikkipollard

Thank You
I had a fantastic (freezing for me) holiday on your side of the world.
Thank You for the twist angle property - it is new to me.
For some reason I am getting a pitch on the twist - strange results
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Torfinn

Then you see what we struggle with on this time of the year :))

I have been lucky this winter, only 2 times as i remember i need scrape of ice on carwindow before drive.
Daytime temp 3-10 degree, and very "grey" and windy, but as long i dont need to drive/ walk in this white stuff i'm happy :)

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

nikkipollard

Quote from: Alvin Gregorio on January 14, 2020, 12:03:23 PM

     The main and most important thing I can't figure out about PPM script writing is how to make money from it.

I don't think it is easy to make money from ppm now - maybe in the future


as Torfinn says it speeds up repetitive tasks - there are a lot of tedious repetitive things in architectural drafting.
I think the saying is "Work smarter not harder"
I have persevered because
one of the important requirements for BIM is parametric objects.
Our architectural objects are parametric but they are not easy to customise this makes designing with them difficult.
PPMs created by me for me think like me and work the way I work.,  When they don't it is my fault and I can fix it without waiting for customer support.
I can add objects that are available in other BIM applications to my library without spending a small fortune
although I can download BIM objects from the internet they never look great in TC line drawings.
There are people who make money writing scripts for other BIM applications I  probably fool myself into thinking that the concept is similar and if I ever upgraded to one of those software types it would be a smaller learning curve.


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