News:

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

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.

Darrel Durose

Quote from: Torfinn on December 25, 2019, 02:54:28 AM
And when there are some people that look at this tred :)
Something to do during the Christmas holiday's, see Attached
I know it's possible, but i dont know how to, and it's for an ppm, so use a calculator or similar with a feature for it dont help :)
I need how to write it in simplest way.

Torfinn

A good brain teaser and I nearly gave up... I hope this is useful Torfinn as I have made a calculator in MS Excel (zipped up below) which works well using only the three variables to get the dimensions you need for X1, X2, X3.

Hopefully studing the spreadsheet formulas you can easily convert it to PPM.... It turned out easier than I thought once I got my head into gear..
Daz...
V2020 & V2022 Plat 64bit, Lenovo P72 Laptop, Window 10 Pro for Workstations, Intel Xeon E-2186 CPU @ 2.90 Ghz (6 cores/12 threads), 64GB RAM, Nvidia P5200 c/w Max=Q Design GPU, Display UHD 3840x2160 pixels
TurboCAD user since V3 and Turbocad 3D V1.

Alvin Gregorio

Quote from: Darrel Durose on December 25, 2019, 08:32:31 AM
A good brain teaser and I nearly gave up... I hope this is useful Torfinn as I have made a calculator in MS Excel (zipped up below) which works well using only the three variables to get the dimensions you need for X1, X2, X3.

Hopefully studing the spreadsheet formulas you can easily convert it to PPM.... It turned out easier than I thought once I got my head into gear..

Merry Christmas Darrel!

Will that formula work if cells B4 & B5 are variables?
To calculate a variable radius, as shown below.

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)

Darrel Durose

Quote from: Alvin Gregorio on December 25, 2019, 08:47:05 AM
Quote from: Darrel Durose on December 25, 2019, 08:32:31 AM
A good brain teaser and I nearly gave up... I hope this is useful Torfinn as I have made a calculator in MS Excel (zipped up below) which works well using only the three variables to get the dimensions you need for X1, X2, X3.

Hopefully studing the spreadsheet formulas you can easily convert it to PPM.... It turned out easier than I thought once I got my head into gear..

Merry Christmas Darrel!

Will that formula work if cells B4 & B5 are variables?
To calculate a variable radius, as shown below.

Merry Christmas Alvin!
B4 & B5 are variables!.... You can unprotect the sheet (Not password locked) if you cannot enter a value...
Daz...
V2020 & V2022 Plat 64bit, Lenovo P72 Laptop, Window 10 Pro for Workstations, Intel Xeon E-2186 CPU @ 2.90 Ghz (6 cores/12 threads), 64GB RAM, Nvidia P5200 c/w Max=Q Design GPU, Display UHD 3840x2160 pixels
TurboCAD user since V3 and Turbocad 3D V1.

Darrel Durose

Quote from: Alvin Gregorio on December 25, 2019, 08:47:05 AM

To calculate a variable radius, as shown below.

Added what you mentioned for calculating the radius and also the B to C Dimension required for the value.... see attached and the updated Excel file below:
Daz...
V2020 & V2022 Plat 64bit, Lenovo P72 Laptop, Window 10 Pro for Workstations, Intel Xeon E-2186 CPU @ 2.90 Ghz (6 cores/12 threads), 64GB RAM, Nvidia P5200 c/w Max=Q Design GPU, Display UHD 3840x2160 pixels
TurboCAD user since V3 and Turbocad 3D V1.

Henry Hubich

Quote from: Torfinn on December 25, 2019, 04:26:02 AM
Hi Tim

Yeah, but how :)

Torfinn

Torfinn, given any one of the X's, it's straightforward to write an expression for each of the other two. This results in three sets of expressions, the relevant one depending upon which X is known. Is this what you want?

Henry H

Torfinn

Thanks for looking in to it Alvin
There are no other known values, an i have found that we need to/ can do it with equations, but i dont get it, what they show :)
But i see Darrel have something so need to look at that, maybe thats the answer.

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

Quote from: Darrel Durose on December 25, 2019, 08:32:31 AM
Quote from: Torfinn on December 25, 2019, 02:54:28 AM
And when there are some people that look at this tred :)
Something to do during the Christmas holiday's, see Attached
I know it's possible, but i dont know how to, and it's for an ppm, so use a calculator or similar with a feature for it dont help :)
I need how to write it in simplest way.

Torfinn

A good brain teaser and I nearly gave up... I hope this is useful Torfinn as I have made a calculator in MS Excel (zipped up below) which works well using only the three variables to get the dimensions you need for X1, X2, X3.

Hopefully studing the spreadsheet formulas you can easily convert it to PPM.... It turned out easier than I thought once I got my head into gear..

Thanks Darrel
That was spot on, and sort of like normal, my "friend" Radians :)
I can use the calc more or less directly in the ppm, only change cellnumber to a "name"
Thanks again :), then i have only one more to deal with this Christmas holiday.

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

Quote from: Henry Hubich on December 25, 2019, 11:33:34 AM
Quote from: Torfinn on December 25, 2019, 04:26:02 AM
Hi Tim

Yeah, but how :)

Torfinn

Torfinn, given any one of the X's, it's straightforward to write an expression for each of the other two. This results in three sets of expressions, the relevant one depending upon which X is known. Is this what you want?

Henry H

Thanks for looking in to it Henry, Darrel solved it Perfect.
I dont know any of the X, if i know one it would have been easy.

And the fun fact is, it's the roof at your home that give me the ide'a to make a ppm that could calculate/ draw this shape.
Only i want a twist on it, as i did not want to know any of the X values to start with, normally we will know one of them when we build a roof like this.
Back then we talk about options to make Gambrel roof in TC, so i made a ppm about it, and you also mention how the roof's look like in your area, your roof.

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

Darrel Durose

Quote from: Torfinn on December 25, 2019, 12:21:47 PM

Thanks Darrel
That was spot on, and sort of like normal, my "friend" Radians :)
I can use the calc more or less directly in the ppm, only change cellnumber to a "name"
Thanks again :), then i have only one more to deal with this Christmas holiday.

Torfinn

Great, worth the effort then!
Daz...
V2020 & V2022 Plat 64bit, Lenovo P72 Laptop, Window 10 Pro for Workstations, Intel Xeon E-2186 CPU @ 2.90 Ghz (6 cores/12 threads), 64GB RAM, Nvidia P5200 c/w Max=Q Design GPU, Display UHD 3840x2160 pixels
TurboCAD user since V3 and Turbocad 3D V1.

Alvin Gregorio

I just started working on the "inverse" of/with Darrel's spreadsheet.
If-- the Radius (cell B14) is the known/input, solve for: Lengths Lines AB, AC, CB; and distances X1, X2, X3.

Unless someone else has already accomplished this or wants to give it a go.
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 December 25, 2019, 04:39:29 PM
I just started working on the "inverse" of/with Darrel's spreadsheet.
If-- the Radius (cell B14) is the known/input, solve for: Lengths Lines AB, AC, CB; and distances X1, X2, X3.

Unless someone else has already accomplished this or wants to give it a go.

I guess we need another known or two.
For instance, that AB chord length can be anywhere.  I guess that AB chord length can be assigned a value of say...  R*1.5  (hmmm.... makes me wonder...  what if that AB chord length were R*2; that'd be an easy way of really wrapping my head around 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)

Henry Hubich

#61
Quote from: Alvin Gregorio on December 25, 2019, 04:39:29 PM
I just started working on the "inverse" of/with Darrel's spreadsheet.
If-- the Radius (cell B14) is the known/input, solve for: Lengths Lines AB, AC, CB; and distances X1, X2, X3.

Unless someone else has already accomplished this or wants to give it a go.

Turned out to be easier than I'd expected...

x1=.3407R
x2=1.122R
x3=.2385R
AB=1.4627R
AC=.4158R
BC=1.1471R

BTW, I did this mathematically, but you could construct the setup in TCad, using a Radius of (say) 1.0, and then simply measure the other lines. (I did this to check my math.)

Henry H

Alvin Gregorio

Quote from: Henry Hubich on December 25, 2019, 06:20:23 PM
Quote from: Alvin Gregorio on December 25, 2019, 04:39:29 PM
I just started working on the "inverse" of/with Darrel's spreadsheet.
If-- the Radius (cell B14) is the known/input, solve for: Lengths Lines AB, AC, CB; and distances X1, X2, X3.

Unless someone else has already accomplished this or wants to give it a go.

Turned out to be easier than I'd expected...

x1=.3407R
x2=1.122R
x3=.2385R
AB=1.4627R
AC=.4158R
BC=1.1471R

BTW, I did this mathematically, but you could construct the setup in TCad, using a Radius of (say) 1.0, and then simply measure the other lines. (I did this to check my math.)

Henry H

Thanks Henry.  I also did it in TCAD using Constraints.  And used what that shows to get the "ratios".  But that didn't "prove" them; however, it did indicate that all your maths were correct. (with incongruencies starting in about the 10,000th-decimal-place positions; but I think that is due to some Precision levels in all that I and perhaps you, via the math, were doing).

The only thing I know about trig-- other than all the angles add to 180° and a2+b2=c2-- I know via this Forum, those nice simple trig formulas PDFs that Nikki shared with us a while back, and my brilliant nephew years ago telling me about SOHCAHTOA.
So I want(ed?) to do the math, for exercise.  For solving Torfinn's first question, and my later question that you answered.   My brain was too fuzzy yesterday.  And I need to start getting serious about finding an income.

I hope you had a Merry Christmas
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 is the ppm Alvin, if you want it, also added a different way to calculate the circle radius, based on the parameters given and adjusted where it stand so it fit the 3 point we get from the parameter and Darrel's calc of A, B, C point.
Sagitta = Arrow heigth

Btw Henrys way not work correct, so dont use it in a ppm, it's not accurate.

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 December 26, 2019, 09:56:45 AM
Here is the ppm Alvin, if you want it, also added a different way to calculate the circle radius, based on the parameters given and adjusted where it stand so it fit the 3 point we get from the parameter and Darrel's calc of A, B, C point.
Sagitta = Arrow heigth

Btw Henrys way not work correct, so dont use it in a ppm, it's not accurate.

Torfinn

Thanks for your work on this Torfinn
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

My formulas were a reply to Alvin's challenge to find all the other dimensions when the radius is known, and if they're wrong I'd appreciate being shown where the error is.

If the problem is to find the radius when the dimension AB is known, the formula is
R=AB/(2*cos(43°))=.6837*AB

Henry H

Torfinn

Hi Henry

I was not talking about that, how to find the R, but the list of numbers you put up;
x1=.3407R
x2=1.122R
x3=.2385R
AB=1.4627R
AC=.4158R
BC=1.1471R
This numbers are not accurate IMO, and the ratio will change depending on V1 and V2, so not useful, unless i missunderstand something about how to use them, i multiplied them with R, see Attached.
They are only correct ( nearly, depend on decimals i assume ) if the rest angle is 43, and by that not good to use in a ppm where the rest angle most likely will change, and is the benefit of a ppm.
So only a full calculation will give the correct answer every time/ every angle, and i use min 6 decimals in Precision
AB is always known.
So i say, dont use them as they are not accurate, and i still think so, maybe if there was min 6 decimals ?
It's always best to do a full calculation.

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

Hi, Torfinn. Hope you had a great Christmas.

I plead guilty to not quoting a high a Precision. I had actually used a 10-digit hand calculator for the computations but rounded off the results to 4 decimal places.

The 43-degree angle will not change if the 35-degree and 12-degree angles don't change. I'll post a proof later this evening if possible.

Henry H

Torfinn

Thanks Henry

I hope you have the same the full holidaytime to, i still have nearly a week left :)

You dont need to prove that it dont change, i know that, and it's proven already in the 2 different picture i Attached, 1 where the V2 was set to 9 degree, but used the 43 numbers, very wrong result
The reason i put it out was to show how little it takes to get a real mess if use uncorrect numbers, not always easy to see where the fault is, and by that waste a lot of time.
And if Alvin used this he would not got correct result, so i tell him not use them.
In pic 2 the V1 and V2 give 43 as rest, and like i wrote, i assume it is the decimals that give a little bit wrong result there.

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

#69
Attached is a little Constraints thing I did, just to help me "prove" (sorta) what we're doing.

It started out as something else, that I have Saved, where I was working out all the Trig formulas so I could grasp all this, which I haven't yet devoted the focus time to doing so.

Anyway...  If the attached is of any use to anyone...

[EDIT]:  Changed file to slightly different revision.  Made Point-C Coincident Constraint with Circle.
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: Torfinn on December 26, 2019, 04:39:31 PM
Thanks Henry

I hope you have the same the full holidaytime to, i still have nearly a week left :)

You dont need to prove that it dont change, i know that, and it's proven already in the 2 different picture i Attached, 1 where the V2 was set to 9 degree, but used the 43 numbers, very wrong result
The reason i put it out was to show how little it takes to get a real mess if use uncorrect numbers, not always easy to see where the fault is, and by that waste a lot of time.
And if Alvin used this he would not got correct result, so i tell him not use them.
In pic 2 the V1 and V2 give 43 as rest, and like i wrote, i assume it is the decimals that give a little bit wrong result there.

Torfinn

Hey, I'm retired, so I have the rest of my life left!

Henry H

Henry Hubich

Quote from: Alvin Gregorio on December 26, 2019, 05:09:57 PM
Attached is a little Constraints thing I did, just to help me "prove" (sorta) what we're doing.

It started out as something else, that I have Saved, where I was working out all the Trig formulas so I could grasp all this, which I haven't yet devoted the focus time to doing so.

Anyway...  If the attached is of any use to anyone...

[EDIT]:  Changed file to slightly different revision.  Made Point-C Coincident Constraint with Circle.

Nicely done, Alvin. I was wondering why you used Constraints, because one can do essentially the same thing by rescaling the whole shebang. But your approach is much more elegant because it allows the user to plug a new dimension in directly instead of having to calculate a scaling factor.

I wonder if there is a way to dimension a constrained drawing such as yours and then constrain just one dimension--and later on, remove that constraint and constrain another dimension instead.

Henry H

Torfinn

Quote from: Alvin Gregorio on December 26, 2019, 05:09:57 PM
Attached is a little Constraints thing I did, just to help me "prove" (sorta) what we're doing.

It started out as something else, that I have Saved, where I was working out all the Trig formulas so I could grasp all this, which I haven't yet devoted the focus time to doing so.

Anyway...  If the attached is of any use to anyone...

[EDIT]:  Changed file to slightly different revision.  Made Point-C Coincident Constraint with Circle.

And now you only have left to "translate" it to a ppm :)

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

#73
Well that was easy math. ;)

I just change my Constrained Circle Radius Variable to 1, and all the Associative Dimensions updated to give me the math.
I added associative hypotenuse Parallel Dimensions-- [C-A] & [C-B].

But I feel like that's cheating; and I really don't learn or practice much.

In fact, I am that point where one is completely lost and foggy and forgot what the heck the first question was and where one was headed and what path was thus far traveled... :o :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)

Alvin Gregorio

#74
Quote from: Alvin Gregorio on December 24, 2019, 10:05:09 AM
How do we make a Circle Parameter allowable Value infinite?



Units(1[mm]);

CR=Parameter("Radius",5,❓(❓,❓));
C = Circle(CR,0,0);

Output(C);

Though I love the math, and the geometry-- I keep promising myself that I was going to get adept at simple trigonometry; I missed this class in high school, and in my +56 years, I've still not put any real focus to it-- I think the question that first led us down the latest path was the question I posted above.

I guess the simple answer to that is:

Units(1[mm]);

R=Parameter("Radius",1,LINEAR,GreaterThan(0));

C=Circle(R);

Output(C);

_________________
Or just:

Units(1[mm]);

R=Parameter("Radius",1,LINEAR);

C=Circle(R);

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

#75
I belived you want to drag it after insert, hence the ParameterPoint.
You dont need Grater than 0, if it's less there are no radius, but even then it's possible to set it should be -10 in example.
TC will insert it with 10, but if you try to change the parametervalue after insert to -12 it will crash, do it a couple of times and TC crash/ Lock and you will need to kill TC to stop it :)
So Grater than 0.1 is legal in example.
Normally we also want to control where to insert it.
C = Circle(R,10,25);  Edit; oops, 10,25,R   :)
Always think from 0,0

It have nothing to do with age or school, as long as you can think, read and write ;)

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 December 26, 2019, 06:46:09 PM
Quote from: Alvin Gregorio on December 24, 2019, 10:05:09 AM
How do we make a Circle Parameter allowable Value infinite?



Units(1[mm]);

CR=Parameter("Radius",5,❓(❓,❓));
C = Circle(CR,0,0);

Output(C);

Though I love the math, and the geometry-- I keep promising myself that I was going to get adept at simple trigonometry; I missed this class in high school, and in my +56 years, I've still not put any real focus to it-- I think the question that first led us down the latest path was the question I posted above.

I guess the simple answer to that is:

Units(1[mm]);

R=Parameter("Radius",1,LINEAR,GreaterThan(0));

C=Circle(R);

Output(C);

_________________
Or just:

Units(1[mm]);

R=Parameter("Radius",1,LINEAR);

C=Circle(R);

Output(C);

Alvin somewhere in this thread I posted formula sheets, the trig one is taken from a revit forum. It is really basic but it helps me. With the triangle as a reference you find the  2 values you know and use the formula to find the value you want.
https://forums.turbocad.com/index.php/topic,26243.msg150564.html#msg150564
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

#77
Quote from: nikkipollard on December 28, 2019, 07:49:20 PM
Alvin somewhere in this thread I posted formula sheets, the trig one is taken from a revit forum. It is really basic but it helps me. With the triangle as a reference you find the  2 values you know and use the formula to find the value you want.
https://forums.turbocad.com/index.php/topic,26243.msg150564.html#msg150564

Yes, Thank You Nikki.  Also, somewhere on This thread I posted an acknowledgement and appreciation for those simple trig formulas.  I have them saved right on my Desktop.  Those are very helpful and definitely make me confident in the simple trig stuff.  SOHCAHTOA.
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

Does the "Box" Function work in PPM scripting?
Or do we have to use a "Polyline" Function?

Creating a simple Box, I used the script below.  It does not work.

X = Parameter("X",10,LINEAR);
Y = Parameter("Y",5,LINEAR);
Z = Parameter("Z",5,LINEAR);

Bx = Box(0,0,0,X,Y,Z);

Output(Bx);

______
The Help Documentation published this script for creating a Box with four Fillet edges.  It does not work either.

L = Parameter("Length", 5, LINEAR);
W = Parameter("Width", 3, LINEAR);
H = Parameter("Height", 1, LINEAR);
R = Parameter("Radius",0.5);
g0 = Box(0,0,0,L,W,H);
g1 = G3Fillet(g0, Array(Point(L/2, 0, 0), Point(0, W/2, 0),
Point(L/2, W, 0), Point(L, W/2, 0)),
Array(R, R, R, R, R, R, R, R));
Output(g1);
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

Box is not a legal command in TC, you will need to make it first.
If you use normal color when writing ppm's you will see that Box wil get a dark blue color, but Circle in example have a blue color.
That means it think Box is a external coimmand, i typical use it as a Macro file, but you can preset it directly in the ppom also, and then Call it with the command you wrote.
My Box look like this, and is made based on one of the examples in Helpfile;
Input(x0,y0,z0,x1,y1,z1);
R = Rectangle(x1-x0, y1-y0,
(x0+x1)/2, (y0+y1)/2);
T = Thickness(R, z1-z0);
Output(Move(T, 0, 0, z0));

Then you Call it with the line you have wrote in your ppm file, and give it start and end values
"
Bx = Box(0,0,0,X,Y,Z);
"

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

#80
Quote from: Torfinn on December 30, 2019, 08:07:23 AM
Hi Alvin

Box is not a legal command in TC, you will need to make it first.
If you use normal color when writing ppm's you will see that Box wil get a dark blue color, but Circle in example have a blue color.
That means it think Box is a external coimmand, i typical use it as a Macro file, but you can preset it directly in the ppom also, and then Call it with the command you wrote.
My Box look like this, and is made based on one of the examples in Helpfile;
...

Then you Call it with the line you have wrote in your ppm file, and give it start and end values
"
Bx = Box(0,0,0,X,Y,Z);
Torfinn

Okay.  I understand.  Thanks Torfinn.
-
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

One thing I am learning about this PPM script writing stuff is
YOU CAN'T GET ONE CHARACTER WRONG.  Not one.  Not a ) or a ( missing or misplaced, or forget a ; or a missed or incorrect character typo.
"Parmeter" is not the same as "Parameter"; "Poliline" is not "Polyline", ...

Dang computer isn't able to read my mind, when I make innocent imperfections.
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

Here is my simplified Box script (without pesky imperfections or typos).
   Since units are not specified, it is Imperial/English Units (inches); the reported Sizes and default Parameters will get changed a multiple of 25.4 when inserted into a Metric Drawing.  One can add the "Units(1[mm])"; Function below the "//Simple Box" Comment if one wants to insert into a Metric Drawing without the change occurring.



//Simple Box

X = Parameter("X",10,LINEAR);
Y = Parameter("Y",5,LINEAR);
Z = Parameter("Z",5,LINEAR);

Rct = Rectangle(X,Y);

SwpPth = Polyline(Point(0,0,0),Point(0,0,Z));

Swp = Sweep(Rct,SwpPth);

Output(Swp);
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, but if you add the Units----- line you can just put // in front of it and in become a comment
mm or in     force it to a spesific system, but it is default to inch
The number 1 on that line is the scale factor.

and if you add the "Input( X,Y,Z)", it becomes a Macrofile. then you dont need to write all lines that every time you need a Box, and you can drop  the XYZ in that file as it will get that info from the mainfile you use it in next time
B = Box(0,0,0,X,Y,Z);
is much more easy to use in other files, and if you move it also you have control over where a corner of the Box is inserted, instead of center.

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 December 30, 2019, 10:29:58 AM
Yes, but if you add the Units----- line you can just put // in front of it and in become a comment
...
Torfinn

Thanks Torfinn.  I understand.  I think if one works with this PPM script writing all day every day for about 5 days, one would pretty much have a good handle on it.

It's doing it intermittently that causes forgetfulness and errors.  Need to stay focused while learning/practicing.

Below is an even simpler Box script.  Per an example Nikki provided, it assigns a Thickness to a Rectangle, all on one line; no Sweep.



//Simple Box

//Units(1[mm]);

X = Parameter("X",10,LINEAR);
Y = Parameter("Y",5,LINEAR);
Z = Parameter("Z",5,LINEAR);

Rct = Thickness(Rectangle(X,Y),Z);

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

#85
Can someone tell me why the Parametric Symbol that is inserted via the attached PPM script seems to have the Fillets on the wrong edges.
Per the G3Fillet definitions, it seems to me that the Fillets should be on the two top edges that are not filleted.

I have Workplane set to By World, before the insertion.

[EDIT]:  I think I know why:  In PPM scripts, "Rectangle" will always be located at center-of-extents=0,0,0; unless Moved in the script.  The defined G3Fillet Points apply to the Modelspace Workplane, not the inserted Rectangle.
Is that correct?

    [EDIT 2]:  Yep, that is why.  I just tested. I now attached another script where all is as expected.
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. and if you add 2 more values you can control where it is inserted, in this example where the lower left corner is.
You dont set a refpoint to it, so by that it will be inserted at 0,0, with the 2 extra values you set the corner to 0,0.

And my Box do exactly the same as Nikki's ppm pluss i also use Move in it, as at the time i made it i did not know i could just add the extra 2 values on the rectangle, but it work perfect, so why change a winning horse kind of thing :)

What i basically try to tell you is add the Input(X,Y,Z);, and delete or // the Parametervalue's ( Nikki dont take them away, TC show an error, but it will still work ), and you have a Macro file
And next time you need a Box in any other ppm you want to make it will be very simple;
B = Box(0,0,0,X,Y,Z);
Output(B);
The XYZ can have different names in another ppm, TC want it's value, what we call it is not so important for TC
Under is a example of using my Box, and after that an example of adding the extra values to move your Box

And the sweep i only use on curved Objects, else Thickness as that is normally the fastes thing to do.
***********************
//Another Box

//Units(1[mm]);

A = Parameter("Apple",10,LINEAR);
B = Parameter("Banana",5,LINEAR);
G = Parameter("Grape",5,LINEAR);
// And whatever else you need in a different ppm.

Bo = Box(0,0,0,A,B,G);

Output(Bo);
***********************************
//Simple Box

//Units(1[mm]);

X = Parameter("X",10,LINEAR);
Y = Parameter("Y",5,LINEAR);
Z = Parameter("Z",5,LINEAR);

Rct = Thickness(Rectangle(X,Y,X/2,Y/2),Z);

Output(Rct);

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 December 30, 2019, 12:26:52 PM
Yes. and if you add 2 more values you can control where it is inserted, in this example where the lower left corner is.
...

Torfinn

Thanks Torfinn.  Can you share with me/us another very simple PPM script that uses your "Another Box" PPM (Macro) as a Function.
But maybe just complicated enough that the Identifiers are not the same, to the extent possible.
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 just did with the "Another Box", where i use fruitname instead of X,Y,Z ( A,B,G )
It will use my Box that i put out here earlier in this tread today
If you copyNpaste Another Box in to the editor, and also in Word i believe, you will se that the Box in the line
Bo = Box ..... turns dark blue, meaning it will search to find the Box.ppm i have in my Macro folder, use that one and make a box where lower left corner is at 0,0 as i dont move it anywhere in "AnotherBox.ppm"

So if you want to use this example, you will need to name my box for Box.ppm first to make it  all work, it can be in the same folder as the mainfile, but it will not work alone, and by that i put it in my Macro folder to split them, more easy to have controll over what is 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

Alvin Gregorio

Quote from: Torfinn on December 30, 2019, 02:28:55 PM
Hi Alvin
I just did with the "Another Box", where i use fruitname instead of X,Y,Z ( A,B,G )
It will use my Box that i put out here earlier in this tread today
If you copyNpaste Another Box in to the editor, and also in Word i believe, you will se that the Box in the line
Bo = Box ..... turns dark blue, meaning it will search to find the Box.ppm i have in my Macro folder, use that one and make a box where lower left corner is at 0,0 as i dont move it anywhere in "AnotherBox.ppm"

So if you want to use this example, you will need to name my box for Box.ppm first to make it  all work, it can be in the same folder as the mainfile, but it will not work alone, and by that i put it in my Macro folder to split them, more easy to have control over what is what.

Torfinn

Okay.  Scratching my head a bit.  I've might have confused myself today with too many efforts.
Thanks Torfinn.  I'll work with what you posted (quoted above).
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

#90
Could not get it to work Torfinn.

>I copied the script below into PPSE.
>I saved as .ppm in Macro Folder in same Folder as the .ppm script I talk about next.
Input(x0,y0,z0,x1,y1,z1);
R = Rectangle(x1-x0, y1-y0,(x0+x1)/2, (y0+y1)/2);
T = Thickness(R, z1-z0);
Output(Move(T, 0, 0, z0));

_________
>I copied/pasted the script below into PPSE
>I saved as .ppm in same Folder that has Macro Folder
>I inserted PPM
>Its size is 0,0,0.  It is in Modelspace, but it is Size=0,0,0.  (That is by appearance and in Inspector Bar; in Selection Info, default Parameters are correct)
//Another Box

//Units(1[mm]);

A = Parameter("Apple",10,LINEAR);
B = Parameter("Banana",5,LINEAR);
G = Parameter("Grape",5,LINEAR);
// And whatever else you need in a different ppm.

Bo = Box(0,0,0,A,B,G);

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

Also-- In "Another Box", "Box" does not turn Dark Blue in PPSE.
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 works fine here Alvin, see Attached.
Maybe try to move Another Box to the mainfolder, Symbols/ My symbols.
And also take away the // from the Units parts, just in case, to force it over to metric.
I dont see anywhere a place where it would use . insted of ,          ,so just for testing.

Do you run it from the Editor, or have you loaded in to Library

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

#93
I got it to work Torfinn.

I had Saved your "Box" .ppm file with a rename of "T-Box", because I already had a "Box.ppm" file in that Macro Folder.
In the "Another Box" script, I changed "Box" to "T-Box", and Saved.  But the "T" always stayed Pink, telling me there is some sort of issue.

I renamed the "T-Box" file to "TBox", and changed the "Another Box" script text to reflect that, and it all worked.

My version-21 does not do the Dark Blue thing.  Not even when using provided Sample files in the Symbols/Sample_PPMs/Misc Folder that use Custom Functions in the Symbols/Sample_PPMs/Misc/Macro Folder.
Although, when I click anywhere within the word "TBox"(for example), the "View Identifier" field reports "External Operation: Box".
It does do the Bold Blue in MS Word, as you suggest.
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

Good you make it work Alvin
The reason for why it go Magenta is the T-Box = T minus Box in ppm, T_Box would have worked.

About colors, maybe you have set the colors in TC to something different than standard, it have always turned dark blue at my Place, also i v 21 PP.
If you make a circle or a rectangle, what color is Circle/ Rectangle inside the ppm ??

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 December 30, 2019, 04:11:52 PM
...

About colors, maybe you have set the colors in TC to something different than standard, it have always turned dark blue at my Place, also i v 21 PP.
If you make a circle or a rectangle, what color is Circle/ Rectangle inside the ppm ??

Torfinn

If I Zoom-In in the PP Script Editor (Hold down Ctrl key, scroll mouse wheel), the External Operation Function text appears Dark Blue.  I just discovered that.  I think it has to do with my screen resolution.
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

Hello All,

I am trying to create a PPM script for a simple closed equilateral triangle.
I am not having success.  I cannot see what the script editor does not like/accept about my script.
Any help?  Below is the script text.
_______________________________________
// Here is a description of an equilateral Triangle

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

Y1=((SL/2)*(tan(30));
Y2=(((SL/2)/(tan(30))-Y1);

Tri=Polyline(Point(-SL/2,Y1*-1),Point(0,Y2),Point(SL/2,Y1*-1),Point(-SL/2,Y1*-1));

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

#97
Below seems like it might be an easier way of going about it.
The angles are fixed.  They will always be 30/60.
All the triangles sides are equal length.

Oh... and-- When inserted, the Point Cross will be at 0,0,0.  That's why everything is referenced off that point.
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

Where I am currently.
Still not working.
What does the Pink text tell me?

_____________________________________________
// Here is a description of an equilateral Triangle

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

Y1=((SL/2)*(tan(0.5235987756));//uses Radians
Y3=(sqrt((SL/2)*(SL/2)+(SL*SL)));//uses Radians, through Y1

Tri=Polyline(
Point((SL/2*-1),(Y1*-1)),//First point (lower/left)
Point(0,Y3),//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

Sorry to just keep posting away.  Last one for the night.

I've improved it; but it still does not work as expected.
What is odd is-- if I replace the Formulas for Y1 and Y2 with the calculated numbers (at the end of that line, at the end of a comment), it works as expected.


// Here is a description of an equilateral Triangle

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

Y1=((SL/2)*(tan(0.5235987756)));//uses Radians (if SL=1; Y1=.2886751346)
Y3=((SL/2)/(tan(0.5235987756)));//uses Radians (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)