News:

All posts discussing pricing or where to buy TurboCAD will be deleted.

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.

Alvin Gregorio

Welcome Back Nikki!
I'm glad to read that you had a pleasant Holiday.
I was a bit concerned by your absence; it's good to hear that all is well and okay and you were just enjoying a well-earned 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)

nikkipollard

Thanks for this topic Alvin. It is always fun to learn a new trick.
I played with your ppm a bit. Basically changed the triangle to a polygon with between 3 and 10 sides.
The polygon is a macro which I made when I first started playing with ppms.
I also tried to find a way to set the PenWidth to a parameter but it didn't work.
You can set pen widths in a ppm but the value is different to what you see in the SI.
so I changed the pen width to 0.25 without a parameter
I was lazy with side length so I used a radius for the polygon instead of a side length.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

A couple of weeks ago, I had unintentionally clicked "Rebuild Thumbnails for All Category" in Material Editor when my triangular mobius was selected; but I think they look pretty cool.
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'm trying to recall...

I think we figured out how to set SetProperties to include a "PenColor" that allows us to change the inserted Parametric Symbol via the Property Toolbar (or its Properties window or Selection Info Palette).  Without first Exploding it.

Does anyone recall if we solved that?  And what that PropertyValue is?
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

Was not that in the Mobius ring or what the name of it was, color by a number that John R showed a table of, so i would have checked that tread.

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

Alvin, are looking for "Pen Color" in Drawing_Defaults...
0=Black, -3=By Layer, -4=By Block, -5=By Pen

or the list of TurboCAD Colors (in HTML file, within Zip file)? I believe TurboCAD likes Decimal numbers.
John R.

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

Alvin Gregorio

Not quite what I was looking for John.

I was looking for what I can enter in a Parametric Part script that will result in:

After inserting the Parametric Symbol, I can select it and change it's Pen Color to another color that is not "By Layer" (PPM default).
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

#157
Something like the Code below. I used the PPM that Nikki supplied with "Decimal Colors".
  •By Layer
  •Sky Blue
  •Violet Red

//==============================================================================
//Sweep; Twist; Properties; Rotate-X Sweep, to being back flat on Plan View
TA1=360/PN
TA2=TA1*PI/180
TA=TA2*NR //twist angle

Swp=Sweep(MTRP,RtC);
SwpSP1=SetProperties(
Swp,"$TWISTANGLE"=TA, //adds twist
"PenColor"=-3, //=ByLayer
"PenWidth"=9.84251964837313E-03) //0.25;

RSwpSP1=RotateX(SwpSP1,270);

//==============================================================================


//==============================================================================
//Sweep; Twist; Properties; Rotate-X Sweep, to being back flat on Plan View
TA1=360/PN
TA2=TA1*PI/180
TA=TA2*NR //twist angle

Swp=Sweep(MTRP,RtC);
SwpSP1=SetProperties(
Swp,"$TWISTANGLE"=TA, //adds twist
"PenColor"=13408561, //=Sky Blue
"PenWidth"=9.84251964837313E-03) //0.25;

RSwpSP1=RotateX(SwpSP1,270);

//==============================================================================


//==============================================================================
//Sweep; Twist; Properties; Rotate-X Sweep, to being back flat on Plan View
TA1=360/PN
TA2=TA1*PI/180
TA=TA2*NR //twist angle

Swp=Sweep(MTRP,RtC);
SwpSP1=SetProperties(
Swp,"$TWISTANGLE"=TA, //adds twist
"PenColor"=10039756, //=Violet Red
"PenWidth"=9.84251964837313E-03) //0.25;

RSwpSP1=RotateX(SwpSP1,270);

//==============================================================================
John R.

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

nikkipollard

#158
I haven't tested it Alvin but if you use a COLOR type parameter - like the font type - a colour dialogue box appears.

col=Parameter("Colour","Red" ,COLOR)

gfx=SetProperties(g1,"PenColor"=col)


No don't try that it crashed my drawing.
I usually do this - it works but is tedious.

Colours=Array("Black","Green","Red")

col=Parameter("Colour","Red" ,Text,Set(Colours))
col1=IF( col=="Green", "some number" , IF(col=="Red",255,0))

g=SetProperties(g1,"PenColor"=col1)

You could probably make another ppm macro with
the conditional ("IF") stuff so that you can use it lots of times in a ppm.
And you wouldn't have to find those colour codes every time




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

Alvin Gregorio

Quote from: John R on November 19, 2020, 08:03:10 PM
Something like the Code below. I used the PPM that Nikki supplied with "Decimal Colors".
...

Nope.  Thanks for the effort though John.

What Nikki just suggested but strike-throughed is closer; I discovered and tried that yesterday.  It seemed to have promise.  It appears to work, but ultimately does not.

What I am looking for is something to enter into a PPM script that will cause when that Parametric Symbol is inserted, the Pen Color of the symbol to be "By Object"-- the Pen Color to be quickly and easily editable, and not 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)

nikkipollard

the only thing that doesn't work is the colour and material dialogues . I think they haven't coded them so they are there but don't work because TC doesn't know what to do with them.
So I just use text instead of the dialogues.
And code it myself.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

nikkipollard

#161
I don't know how practical this is - because you are not choosing colours from a color dialog.
You can use RGB values to define Colour
But would have to find RGB values first . The up side is  you wouldn't be limited.

You  need a separate parameter  for each RGB value.
Convert it to decimal and use that to set colour property

Decimal= R+G*256+B*65536
Attached an example
Macro RGBConvert.ppm
Test file RGBtest.ppm


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

Cliff2

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
Maybe this will help.

Torfinn

Thanks Cliff2

The issue was solved about a year ago by Darrel, but good to know whom to ask if a next time :)

Seems like the server don' want more picture at the moment

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

#164
I don't know how I missed that. but if anyone is interested here is the macro I use to find the intersection point of 2 lines.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Torfinn

Hi Nikki

It was about Christmas time last year, wasn't you on holiday back then, i think Darrel come with a solution between Christmas and New year.
I checked Cliff2's calc and it was very nice and short, so maybe i rebuild the ppm, i have put it in there already so i have it if i ever should use it, it was most of all because i wonder how to, as i did know it was possible, and i was looking in wrong direction for the solution.
And i also forgot to change from radians to degree when i tested, that's just me :)
So now i will look at your solution :)

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

It is just a general intersection point macro. Useful for any project with angled lines. Instead of the sin rule - Cliffs solution it uses Y=mx+C
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Torfinn

Dosn't matter what it is, as they all work like a charm :)

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

I think it wont work if the first line is -270 or -90 degrees. But that is an easy fix
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h