TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
When replying to a specific statement be sure to quote the previous post.

Ruby in TCad Pro 20
Read 3483 times
* April 20, 2013, 01:33:25 PM
I did upgrade to TC Pro 20 and decided to see what happens with Ruby in TCPro 20. First, thanks for the great examples  scripts  in Ruby Script folder for Kevan. I hope as it will be many as possible. For inexperienced amateurs are the best source of practical application and learning. I converted my old script  time stamp with file  *. xaml to do UI and it worked fine. In the script TC20_TimeStamp crept probably a small mistake - it works if you change the line 36 from  "tsx.Text =" 0 "" to "tsX.Text =" 0 "". I tried also TC20_ImportXYZPoints.rb and it worked out great. Kevan in TC20_TimeStamp.rb to create the UI, you did not use the *. xaml file. I tried to repeat it to another definition, and although the script  worked, a window UI did not appear and  I had the message "no such file to load - System.OKing, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a".
Marek
« Last Edit: April 27, 2013, 10:17:00 AM by Marek »

Logged
Marek

TurboCAD Pro 2016, TurboCAD Pro 2017
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit


* April 25, 2013, 03:59:06 AM
#1
Kevan, could you write an example of how add graphics to the created layer, how add graphics to group . I tried to do it. I can create and add to the model, layer or group, but when I'm trying to add to layer or group  graphics, TCP 20 64 bit crashes.
Marek
« Last Edit: April 27, 2013, 10:17:21 AM by Marek »

Logged
Marek

TurboCAD Pro 2016, TurboCAD Pro 2017
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit


* May 05, 2013, 01:39:11 PM
#2
Continued trying
Following the example of the methods of VB, I was able to create a group. I also found a way to add layers, but unfortunately creates a layer invisible. I gave up for now with added layers. I wrote a Ruby script creates a symbol of insulation between preset points with specified thickness with UI following the example of Kevan. The *. rb file we need to copy to the folder "Documents \ TurboCADProfessional 20 \ RubyScripts" and then load with the Ruby Console. I also tried the method of the file *. xaml, but unfortunately if there is exception, crashes not only the Ruby Console, but the entire TurboCAD and if we did not save  our  drawing earlier, we lose it. I tried to use regular expressions to eliminate exceptions, and features built-in Ruby as exit, exit!, break but this resulted in a crashes the entire program. MInsulation2TC20 script works and with exceptions there is a warning that lets you correct the error.
« Last Edit: May 05, 2013, 01:41:22 PM by Marek »

Logged
Marek

TurboCAD Pro 2016, TurboCAD Pro 2017
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit


* September 07, 2013, 09:58:48 AM
#3
Hi
I wrote  Ruby script that is designed to inserting  road signs of  the external library as a XRef. The size of signs is selected so as to be visible at a scale of 1:500. I made the ability to scale, but I was just trying  yet only 1:2 and 2:1. Xref file should have X, Y, Z reference point (0,0,0). To apply colors for the attributes,  before inserting blocks, should be set the drawing color to "By Layer". Attribute first is extracted from name of file or can be set manually, attribute second, we can choose from list. The script is for a specific task, but it seems to me that it is easy to convert it, to other needs, so I attached it. Besides missing unless different examples and little going on in Ruby Corner.
Marek

Logged
Marek

TurboCAD Pro 2016, TurboCAD Pro 2017
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit