News:

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

Main Menu

How to Program TurboCAD

Started by Cad Man, May 27, 2021, 09:55:06 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Cad Man

Does anyone know how to program TurboCAD using Ruby script?  Do you just type a Ruby script into the built in command prompt and hit enter?  I don't see how that will command TurboCAD to do certain things on the screen.  I have Ruby script samples in a Ruby script folder but they don't open up when I click on them.  Also, can any other programming language be used at the Command prompt?

Torfinn

Not my cup of tea, but have you tried to run the Ruby Script console on top of screen ??
Maybe not in all editions, but you don't say anything about what version/ edition you use so ....
Also a bit down on TC Forum pages you will find a section about it, what language you can use etc.

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

#2
Quote from: Cad Man on May 27, 2021, 09:55:06 AM
Does anyone know how to program TurboCAD using Ruby script?  Do you just type a Ruby script into the built in command prompt and hit enter?  I don't see how that will command TurboCAD to do certain things on the screen.  I have Ruby script samples in a Ruby script folder but they don't open up when I click on them.  Also, can any other programming language be used at the Command prompt?

Not my cup of tea, either. But to run one of the samples, click "Toggle Ruby Console" in a TCad drawing and click on one of the entries in the drop-down list at the bottom right of the Console. If you just want to look at the code, open it in Notepad. For more information, see README_RUBYSCTIPTS.TXT in the RubyScripts folder.

Henry H

nikkipollard

#3
You can also read the script by Loading it
The SDK documentation that comes with Turbocad - might help with the methods available for Turbocad.
Unfortunately the documentation isn't that great and there isn't an inbuilt intellisense For Ruby - which makes it quite difficult to script.
If you have excel/ or Visual studio and know a bit of Vb you can explore the Turbocad SDK a little easier because it has intellisense.
Then translate to Ruby. or vbscript - which can be run via the macro recorder.
The Sdk documentation is all VB based - which also makes it easier to explore the Turbocad SDK.

The other option you might want to look into is the Scripted symbol option (PPM). they are easy to write
and you don't need sophisticated programming skills.
- The result is a parametric symbol which 90% of the time is the reason most people want to program Turbocad.
Torfinn is a great source of information for PPMs - And the documentation is better then the SDK documentation.


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

Cad Man

Yes.  My main goal is to use TurboCAD to create my own sort of mapping program as a sort of plug-in if you will.  In trying to figure out how to program TC, the README_RUBYSCTIPTS.TX file does have a very limited explanation on the Ruby console and assumes you know how to use WPF to create XMAL-based dialog boxes (which I don't know) and gives a couple of examples.  However, this is not a very extensive or intuitive way to try and figure out how to program TC.  I currently have an old version of TurboCAD LTE Pro v. 9 and am willing to upgrade to a newer PRO version, but not if I cannot figure out how to program it.  I was hoping for better documentation starting with basics, and a lot more examples.  It looks as though, no such documentation exists and to say that TurboCAD is programmable by users when in reality such arcane knowledge belongs only to the creators of TurboCAD, while no instruction manual exists, is not of much use to the average user.

nikkipollard

#5
I use Turbocad Platinum but according to Turbocad you can program lite pro
It is probably best to work with a programming language you do know.
A year ago I decided to teach myself how to do this.
The only programming experience I had was creating user forms in excel - using VBA.
The SDK documentation  was written when VBA was still built into Turbocad
- so the examples are mostly in some form of visual basic.
But you can use any language that is object oriented, Including Ruby.
I chose to go with VB.net In Visual studio - I don't know why.

Visual studio was great for me - because I really don't know what I am doing and the IDE  sort of guides you.
Before I even looked at the Turbocad SDK I worked with windows Graphics I also familiarised myself with programming methods.
All this  helped when starting to use the Turbocad SDK.
Once I was familiar with programming graphics I switched to the SDK.
Instead of referencing windows Graphics - Reference the Turbocad Library - or libraries.
When you start typing all the available methods pop up so you can choose what you want to do.

In the SDK section on this form there is an "updated" SDK help - most of the stuff in there still works.
Some people have also posted a few examples in their preferred languages. - Study those.
It can be frustrating at times - but it is doable.

WPFs can be Created using visual Studio.
They are similar to windows forms, there are lots of tutorials for them.
But if you are downloading Visual studio to make WPFs you may as well write the whole program  using visual studio where you can take advantage of the intellisense.
https://www.youtube.com/watch?v=L9HhSoFDevo






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