TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
Remember to do a search before you ask a question!!!

Torfinn- PP code?
Read 5794 times
* July 30, 2014, 08:04:06 PM
Torfinn old buddy, :) With a PP not a PPS >
Is there a line of code for having the “z” value of a 3d object “Automatically” follow another 3d object when the height is changed?
Ex; I created a PP of each box then a PP of the two boxes.
Ex; a box is sitting on top of another box > when the height of the bottom box changes I want the top box to follow the height change. I know I can adjust the individual  PP parameters but I was looking for an automatic function to type in the “z” value of the top box.
I’ll owe you one of those Norwegian Beers, Thanks.

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 03:10:29 AM
#1
Hi Dean gamle ørn  ;)

I dont work with PP, prefer PPM but it's basically the same thing i think, so have to look in to it.
Made a quick ppm that is nested with another and put it on the top of the first one

And the PP should work in the same way i believe, as you can see the DB ppm get all the parameter values it need inside DB2 ppm, inside DB2 i say that it should move DB the same heigth like the box made in DB2 is, so by that i can control size and Z values of both box's in DB2

BTW be careful with the beer in Norway :) 1 beer 0,5 l = 5,5 $ in a shop and in a normal bar it's about 11 $ for 0,4 l


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

W=Parameter("Witdh", 800, LINEAR);
L=Parameter("Length", 1000, LINEAR);
H1=Parameter("Heigth A", 800, LINEAR);
H2=Parameter("Heigth B", 600, LINEAR);

B1 = Thickness(Rectangle(W,L),H1);
B2 = Move(DB(W,L,H2),W/2,L/2,H1);

Output(B1,B2);
***********************************
DB
*********************
Input(W,L,H2)
B2 = Thickness(Rectangle(W,L),H2);
Output(B2);
************************

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 06:31:28 AM
#2
"BTW be careful with the beer in Norway :) 1 beer 0,5 l = 5,5 $ in a shop and in a normal bar it's about 11 $ for 0,4 l "

Hi Torfinn, Would you settle for Green Tea :)

Thanks for sharing! I like the PPSE with (PPM)'s it's much more reliable. I use the PP for simple functions.
I'm getting an execution error with your script, (see attachment) Thanks.

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 06:39:58 AM
#3
 :) Ok!, I got it to work, it was the un-wanted characters.**** Works like a charm

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 07:39:08 AM
#4
I can't get it to look like in your picture, The top box doesn't move ???

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 08:26:40 AM
#5
Sorry, i should have wrothe that the stars and DB, DB2 just was for splitting the 2 ppm files, and only the name DB was importent
It can also be a good ide'a to make a folder named Macro just under My Symbols and put all the non self-executing files in there, like the DB.ppm

I find it more easy to make a ppm then a pp file, espacially if they are small, just copy one other file and rebuild little bit, finish :)
Rigth now i'm rebuilding/changing a truss ppm to what a customer want and will looking in to the pp question to nigth or tomorrow, i have to re-learn pp :)

Then i'm ready for a cup of Green tea, guess i give it to my wife, have seen her drinking it sometimes so it has to be something healty, not for my body. ;)

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 08:31:03 AM
#6
I can't get it to look like in your picture, The top box doesn't move ???

I can rebuild it little bit and add some extra parameter values that let you move the top box in x and y direction, the way i made it with moving 50 % in x and y was just to show a possebility.

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 08:41:04 AM
#7
A rebuild version that let you change the placement of the top box

Torfinn


Units (1[mm])

W=Parameter("Witdh", 800, LINEAR);
L=Parameter("Length", 1000, LINEAR);
H1=Parameter("Heigth A", 800, LINEAR);
H2=Parameter("Heigth B", 600, LINEAR);
M1=Parameter("Move X", 400, LINEAR);
M2=Parameter("Move Y", 500, LINEAR);
M3=Parameter("Move Z", 0, LINEAR);

ABC = (W,L,H1,H2,M1,M2,M3);
Output (ABC);

B1 = Thickness(Rectangle(W,L),H1);
B2 = Move(DB(W,L,H2),M1,M2,(H1+M3));

Output(B1,B2);


Edit; added possebility to move in Z also
« Last Edit: July 31, 2014, 08:51:53 AM by Torfinn »

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 09:34:54 AM
#8
Thanks Torfinn!, maybe it's back to giving you a beer :)
 
i'm getting an Error with your last script, see attachment

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 10:05:38 AM
#9
Hi Dean

I cant see what it could be, maybe it didn't like when i was edit it.
Try this, this one i was testing in Library aswell and it works

Torfinn
Edit; it telling that there is something on the line with B2..... there is something wrong, did you make the DB.ppm and saved in same folder or in the Macro folder ??, if DB2.ppm is in My Symbols ( or what name you give it when saved )

Units (1[mm])

W=Parameter("Witdh", 800, LINEAR);
L=Parameter("Length", 1000, LINEAR);
H1=Parameter("Heigth A", 800, LINEAR);
H2=Parameter("Heigth B", 600, LINEAR);
M1=Parameter("Move X", 0, LINEAR);
M2=Parameter("Move Y", 0, LINEAR);
M3=Parameter("Move Z", 0, LINEAR);


ABC = (W,L,H1,H2,M1,M2,M3);
Output (ABC);

B1 = Thickness(Rectangle(W,L),H1);
B2 = Move(DB(W,L,H2),M1,M2,(H1+M3));

Output(B1,B2);
« Last Edit: July 31, 2014, 10:12:06 AM by Torfinn »

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 10:13:44 AM
#10
Still not working. All I get is one box and the"move" functions are not working. The error is with the "move" see in my picture. Oh well,,,, Thanks for trying. I like using Autodesk very stable  ;)

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 10:34:10 AM
#11
PPM are very stable to, exept when you make them and do something wrong  ::)
I attach 2 zip file this time, i see that you have the DB2.ppm on the desktop, is the DB.ppm also on the desktop ??
Anyway try to put DB2.ppm in to the folder ../../ My Symbols
and DB.ppm in to ../../ My Symbols/ Macro
If you dont have the Macro folder just make it, make the system looking better.

Something like this
C:\Users\Your Name\Documents\TurboCAD Professional 21x64\Symbols\My Symbols\Macro

Reload the Library and it should show up there with the ? mark, rigthklick on it and select Update Thumbnails .., select the view you want.

All this talking about beer, make me go to the shop  8)

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 11:21:56 AM
#12
Thanks old buddy! I'll get you two beers! :)
 I'll give your files a third try.
Is there a special way to load your ppm's into the editor? Do I have to load two ppm's or what? Can you explain.. maybe a third beer for you, it's been a long day.

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 12:34:22 PM
#13
Hi Torfinn,
 I did as you explained concerning the file locations and dragged the ppm out from the library folder and everything worked, Thanks :) I guess or did you create a symbol from the script?
BUT > if  load the two scripts into the ppm editor the script doesn't function. You must be doing something else and why are there two ppm's to run one script? I'd give you another beer but you probably wouldn't be of much help anymore :) :) :)
I was able to create a similar situation with Anilab 5, took me 7 min to create. I can add functions etc.. I've been banging my head on the wall for 7 hours with the ppm scripts.Parametric parts, Though it is the most documented feature in the manual, IMSI really needs to give more in depth support for this. I use  Autodesk just for that reason, they are  really good in that department.
Thanks  :)again for your help....

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 01:01:13 PM
#14
Hi Dean

Then this could be a long nigth or a very short one, depending on how quick i drink :) 8)

I don't load the files in to the editor, that's where i make them, after saving them in ../../ My Symbols and ../../ My Symbols/ Macro they will be loaded automatic everytime i open TC.
Just going to the Library Palette and pick the symbol i want for inserting.

If i make a new one and save it in My Symbols i don't want to restart TC, so i rigthklick in a free area in the Library Palette and select "Reload Symbols ", second last choice in the menu that pop up.
And just in case, i then stand in the My Symbols folder in Library Palette when doing so.

You only load 1 of the 2 ppm's in to TC/ Library Palette ( DB2.ppm ), DB.ppm will not show in Library Palette since it can't run alone, it need to get some info from the DB2.ppm for working and that's why i save the non executable in the Macro folder.
If you open the BD.ppm in Parametric Part Editor you will se the line "Input(W,L,H2) " and that is the info the ppm should get from the DB2.ppm
If you see on line 16 in BD2.ppm you will see the same thing there i "call up" BD (.ppm ) and tell that it should get the info (W,L,H2) here
"B2 = Move(DB(W,L,H2),M1,M2,(H1+M3));"

I belive when you make it work 1 time it's because you have both file,s in one ppm, the ide'a was to show how to nest them and it's actually 2 ppm files that work together like i understand was the question in the 1 post about pp's.

If you look on DB2.ppm in the editor you will see that the DB is darker blue compared to the rest of the blue letters and that indicate that this is a "outside" command, not a regular command of the legal command's that is possible to use when making a ppm.

And that is a very big improvment/ difference compared to PP, after some time when you have made a "selection" of small symbols, you can select the one's you alredy have made and put them together in a "main file" that collect and put everything together in one file, you don't need to re writhe everything, that will also keep the filesize's down, as the symbols can't be more then 36 Kb by the book, it will work up to about 38Kb, but after that it's not possible to writhe more in 1 file and if you have some space's and so on, they will also stealing from that amount of Kb.

That i find out when making a symbol of all the wood/constructions of a normal Norwegian house so now this file is split up in 10-12 different files and put together in the executable file that control everything, i dont know the total size of it anymore but it is a he... of characters in it :) and about 50+ parametric values that work together, ofcourse i could save some space if i writhe it better, but it was my first big ppm and a kind of learning on how to make ppm's and it's also a kind of to big for starting all over again and re writhing it, but maybe some day :)

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 01:15:14 PM
#15
Thanks Torfinn :),
If you're still awake > what would be the code for adding the width and length of each box to the symbol parameters fields once the symbol is inserted?  Would this be written in the DB file? Thanks..
Maybe now, tea would be better :)

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 01:53:24 PM
#16
Hi Torfinn,
 I did as you explained concerning the file locations and dragged the ppm out from the library folder and everything worked, Thanks :) I guess or did you create a symbol from the script?
BUT > if  load the two scripts into the ppm editor the script doesn't function. You must be doing something else and why are there two ppm's to run one script? I'd give you another beer but you probably wouldn't be of much help anymore :) :) :)
I was able to create a similar situation with Anilab 5, took me 7 min to create. I can add functions etc.. I've been banging my head on the wall for 7 hours with the ppm scripts.Parametric parts, Though it is the most documented feature in the manual, IMSI really needs to give more in depth support for this. I use  Autodesk just for that reason, they are  really good in that department.
Thanks  :)again for your help....

Hi Dean
They are not ment to be together, it would be no problem to make only 1 symbol like that, but in the beginning of this topic you writhe that you have made pp1 and pp2 and want the pp1 to stand on top of pp2 and pp1 should be lifted up the same distance like the heigth of pp2 all the time, or something like that :)

I also think i have more beer than i need rigth now  ::) if i should be aible to work :)

I start and have been using AC ( 2D ) since 1992 (V11 and 12 on a 386 machine :) until i figured out i realy need to start working in 3D, and i was a very big fan of AutoLisp back then, and by that it was familiar for me to use ppm even if i dont have been using AutoLisp for nearly 20 years, but i still remember that for the final test of that course back in 92 i was trying to make a C+ command to work in AutoLisp and dont knowing it was a C+ command before after 2 days( i was using it for many weeks before:), that meaning i have 12 houers to make it finish before delivering and i sitt up all nigth to writhe it, a script that could draw kitchen (cabinet's, bottom, worktop, etc. etc) with all the info in blocks for making the order of that spesific kitchen when taken out by the database tool or something :)

That's why i made 2 ppm's that work together and DB.ppm is "nested" to DB2.ppm like pp1 should be to pp2 in the beginning.

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 02:47:14 PM
#17
Thanks Torfinn :),
If you're still awake > what would be the code for adding the width and length of each box to the symbol parameters fields once the symbol is inserted?  Would this be written in the DB file? Thanks..
Maybe now, tea would be better :)

I,m still awake :)
about two houers left of this workingday for me, normally i stop at 2 am in Norway.

If i want to change the size of both box's i would need to make some change in both ppm's, se attached zip's, this time DBb and DB3.
Same proccedures for copy to the correct place
And like i told, green tea is for my wife, i stick with the beers and a lot of coffee :)
People should only know how big job it is to keep my skin teigth  ;D  ;)

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* July 31, 2014, 03:21:23 PM
#18
Thanks Torfinn, Now works like a charm! Do you like dark roast or flavored coffee :)

I'm trying to understand how the symbol reads the macro form the other file. In DB3 you have B2=move DBb .Do you write script DB3 save the file then write DBb save the file then when you drag the symbol from the library DB3 automatically searches and finds DBb macro? or do you write the entire script in one script then create seperate files? If you write one script can I see that?

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* July 31, 2014, 05:18:40 PM
#19
Your welcome Dean

Actually i like the dark roast coffee ( Arabic ), but i never drink it in Norway, thats a part of my holiday experience and i can dream/ missing it for about maybe 3-4 week's after i'm coming home again, and trig me for the next holiday :) for me a holiday is traveling far away from Norway, for the moment normally to Thailand, " Land of smiles" ,amazing country/ people :)

Normally i start to write everything in 1 file ( now i noticed i write, write wrong, thanks, and then try to remember it for the next time's :) )
in the beginning and then i split it after some time, when i feel i have control over what i need in the non executable file(s) like DBb

The Input( Wb,Lb,H1 ) in DBb.ppm is telling TC that it should get this info in the file i choose to use it in, like in the line 18 of DB3.ppm where it stand
"B2 = Move(DBb(Wb,Lb,H2),M1,M2,(H1+M3));" and it's in the part "(DBb(Wb,Lb,H2)," i tell TC that i want to use the outside file DBb ( .ppm ) and it should get the info it need from the parameters "(Wb,Lb,H2)," in  this file " (Wb,Lb,H2)" that i give the parameter values of in DB3.ppm

Tc will search for it in the actual folder, if not find it, TC going 1 step down to the Macro folder and search there, if not in one of this 2 place's, i get a fault and the ppm don't work ( or the other way, i dont know where TC search first:)

To make everything in 1 file is very easy, just a little bit difference from DB3 on line 18, see attachment DB4
In this small file there is nothing to get/ save from using 2 files, exept the possebility to use DBb.ppm sometimes later in a different ppm, but then it's the problem to remember what file do i have and what is the name/ function of it :)

You also see that there is a output named ABC, that is just a "dummy", but it control's how it look in Library palette when you choose the symbol and should start to put in the parameter values in a order that become natural for the object you want to make.
It's very important that this is the first output in the ppm file, if not it will not work and we have no control of what parameter values standing where in Library Palette, make a test and delete the ABC output or just put // ( they will be green ) in front of it, save and se how it looks in Library Palette after that.

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* August 01, 2014, 02:54:34 AM
#20
Thanks Torfinn  :)
how would I get the below scripts to work? they don't work for me.
//script taken from the manual
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));

//script taken from the manual
//nested function
B1=Box(0,0,0,10,10,10);
BF=BooleanSubtract(B1,Move(RotateZ(RotateY(Box(-5,-5,-5,5,5,5),45),45),-1,-1,-1));
Output(BF);

Thanks :)


Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* August 01, 2014, 03:54:12 AM
#21
Hi Dean

The first of your examle need some input from another file, rebuild it little bit and give the parameter values directly in the same file and saved like Rektangel = ( Norwegian for Rectangle )
Boks = ( Norwegian for Box )

The next one, if you put it in to the ppm editor you can se that the Box is dark blue and by that it is a external command that call for the Box.ppm
I save it like Boks.ppm and it will go to my Macro folder and get the Box.ppm i have ther.
This Box.ppm is also inside the help file as a example

Attached is a zip with Rektangel, Boks and Box.ppm
Put the 2 first one in ../../ My Symbols
and Box.ppm in ../../ My Symbols/ Macro

Reload Library palette and you should be redy to go

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB


* August 01, 2014, 06:12:47 AM
#22
tusen takk, Torfinn :)
works like a charm,

Logged
"What do I know, I'm still learning"..
Windows 7 64 bit HP > on a stock HP laptop with 4gb-2.4 GHz.Turbocad 2019-2018-2017, TurboCad Platinum 21.Using Lightworks and Redsdk, Anilab lab 5. ATI Mobility Radeon HD 4500/5100 and HP all in one desktop with Nvidia Geforce 210, open gl 3.3


* August 01, 2014, 06:33:00 AM
#23
Ingen Ã¥rsak Dean  :)

Torfinn

Logged
V18, V19, V20, V21, 2015/ 16/ 17/ 18 Pro. Platinum
Deluxe V20, V21, 2015/ 16/ 17
RedSDK enabled
Windows 10 Home Premium 64 bit, 32 GB
NVIDIA Geforce GTX 780m, 1 GB