News:

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

Main Menu

2 New Tools

Started by Duram, December 06, 2013, 04:40:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Duram

1- Triangle tool : write the sides or/and angles and position , like a rectangle tool (for 3 sides)
2- Math formula tool: write an equation between points and the drawing
is formed   f.i.:  X^2    bet 1mm and 4mm (for 2D drawings)   that is very useful to draw antennas
and all parabola objects (f.i: mirrors) or any other object base on a math formula

Dean

Quote from: Duram on December 06, 2013, 04:40:46 AM
1- Triangle tool : write the sides or/and angles and position , like a rectangle tool (for 3 sides)
2- Math formula tool: write an equation between points and the drawing
is formed   f.i.:  X^2    bet 1mm and 4mm (for 2D drawings)   that is very useful to draw antennas
and all parabola objects (f.i: mirrors) or any other object base on a math formula

Here’s a simple script for a triangle to get ya started. download the attached file then change the file extension from .txt  to .ppm > Open the parametric script editor palette then locate and open the enclosed  .ppm file > hit the “insert parametric part” button. You can adjust the “x and “y” values > ex: (0, 0),then re-run the script.  There’s also Ruby scripting but it’s a Royal pain in the arse in V20 because the ruby console doesn’t stay on top of the main UI. I guess Imsi finds this amusing rather than fixing it. V18 is better but the ruby language is different now in V20. LoL, I’m confused
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

Torfinn

Here is another solution of the triangle made with ppm, copy and save/ give name inside " My symbols" and load from library palette, then you don't need to change the ppm file all the time ( only parameter values to what you want), and if you change your mind:), go to Selection Info palette and change the 3  parameter's to what ever you want.
If you use "in", take away the first setting in the ppm, this is to force TC to use "mm", by default it is "in".

The "Output (ABC)" is to control how it will show inside library palette, important that this is the first "Output" to make it work

Torfinn


// Triangel
// Torfinn 06.12.013
//**********************
Units (1[mm])
//**********************

A = Parameter("Lengde A", 1200, LINEAR);
B = Parameter("Lengde B", 1000, LINEAR);
V = Parameter("Vinkel A > B",145, ANGULAR);

D1 = (cos(V)*B)
D2 = (tan(V)*D1)
p1 = (A,0)
p2 = (D1,D2)

Trekant = (Polyline(Point(0,0),Point(p1),Point(p2 ),Point(0,0)))

ABC = (A,B,V)
Output (ABC);
Output (Trekant);
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

Dean

Great Torfinn! Take it to the next level...
Your script works but what language is your text written :) in the “symbol parameters properties”? I’m English.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

Torfinn

Hi Dean

Uups, sorry about that :)
I see now that i wrote it in Norwegian as i'm from Norway, SouthWest coast, and by that nearly ho close Norway is to England. ( 1 houer to London from my home :)
From Stavanger, "oil capital" in Norway

Lengde A = Length A
Lengde B = Length B
Vinkel   A = Angle A
And Trekant is Triangle

Just in case if somebody want to translate the parameter's text, to their native language in the ppm file

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

Marek

#5
Hi Duram
I wrote sometime in the VB script  sketching graphs the function y = a * x ^ ea + b * x ^ eb + c * x ^ce+ d.  I converted it to Ruby for TC20. It may be useful for those plotting a parabola (polyline). All fields should be described. You can to simplify this equation by entering zero. If you set before drawing,  colors to "by layer", the axes will be blue, and the graph red.I tested script little.
Marek

P.S - corrected script in thread below
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

Dean

Hi Marek, Thanks for sharing!.
I can't produce a curve or a smooth polyline from the script.  Can you post an example with some field data? Thanks.
also, I continue to get an "unhandled exception" when closing out of turbo cad platinum V20 64 bit after I've been using your script.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

Marek

Hi Dean
Quote from: Dean on December 10, 2013, 05:43:13 AM
I continue to get an "unhandled exception" when closing out of turbo cad platinum V20 64 bit after I've been using your script.
corrected ( I attached new script).
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

Dean

Thanks Marek! , I don’t get the un-handled exception any more but as you can see in the attached picture I needed to (smooth) >modify the original polyline that was created by the script to a Bezier then to a spline. This is ok, but doesn’t the “focus” hence move after the modification?
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

Marek

This function should be symmetrical. x = 0 will  be then in the middle of the graph. For snap6 zoom is larger> 10,000%. Tolerance in Bezier = 0.0001. You have to try different ranges for x and different dx.  I do not know too much about the accuracy of the conversion of a polyline to curve.
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

Dean

Quote from: Marek on December 10, 2013, 01:06:39 PM
This function should be symmetrical. x = 0 will  be then in the middle of the graph. For snap6 zoom is larger> 10,000%. Tolerance in Bezier = 0.0001. You have to try different ranges for x and different dx.  I do not know too much about the accuracy of the conversion of a polyline to curve.

Great Marek!
Variable x  (dx)  @ .01 produced a smooth polyline with 300 vertices, much smoother than the original 0.1 with 30 vertices. I tried a variable x (dx)@ .001 and got 3000 vertices!
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

Marek

 That's how it works. Number of vertices = length of the interval divided by the increment dx. For <-a, b> and dx, n = (-a-b) .abs / dx. You control the number of vertices. Too much can be troublesome in future work.
Marek
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

Duram

I see you all agree with me that a math tool is necessary, how many people know how to make scripts and how time consuming is it when you need a fast work.

For me I need to begin asking: scripts, how to make them in TC20DL and to use them?
i know visual basic but i don´t have any visual basic tool to program, i think Microsoft
do not make them any more.

Marek

Ruby scripts you can write in the notebook, eg Notepad + + or directly in RubyConsole in TC - "AddOns / Ruby scripts / Toggle Ruby Console". I have a TC Pro, I do not know how it is in the version of the DL. Examples of TC20 you have in the folder ... \ Documents \ TurboCAD Professional20 \ RubyScripts. VB scripts I wrote in free Microsoft Visual Studio 2008 and 2010 (now there are newer versions). See "SDK Corner" on this forum.
Marek
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit