News:

When posting a problem be sure to include which version you are using.  Give as much information as possible.  If the problem is with a specific file be sure to attache it to your post.

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

From Spreadsheet to TC

Started by bigjimslade, October 14, 2013, 07:55:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bigjimslade

I have a table of offers for a ship in Excel format. They give the X/Y/Z coordinates for the positions the hull.

There are about 4000 data points.

Is there any fast way to mark these positions in TC? E.g. insert a line whose end is at that point?

John R

The Ruby Console has a "Import XYZ Points" file that will read an XYZ or CSV file.

You may want to look at the topic: Ruby in TCad Pro 20.
John R.

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

bigjimslade

THanks, I have TC19 that appears to support this. Where is the starting point documentation?

Thanks,

John R

I think there will be problems here. The Ruby program used in V19 is completely different from the one used in V20, or so I've been told. Example scripts for V19 are at "C:\Program Files\IMSIDesign\TCWP19\Program\RubyScripts", but there isn't any "Import XYZ Points" file.

The Ruby XYZ files from V20 are attached below. I doubt they will work in V19, but if you're code savvy (I'm not), you may be able to find something useful. They're readable in Wordpad.

The only documentation for this is in the Help: Using the Ruby Console.
John R.

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

bigjimslade

Thanks for info. The problem is the documentation that I see is woefully inadequate to do anything.

It looks like TC defines a tcApp object of some unknown class. There may be other objects as well. 

Without knowing the properties of those classes you're kind of stuck here. Maybe the TC gods can answer in this forum for us where such documentation may exist.

bigjimslade

I'll add what I put in the RUBY forum. If I could get an example of how to draw a solid black line from (X, Y, Z) to (X, Y + 2, Z) in feet to layer zero, I could probably put everything else together (the file read and loop).

Torfinn

Try this one, i get the link from Kai a couple of days ago, it can read RB files and a bounch of others format :):)

http://notepad-plus-plus.org/

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

Dean

Quote from: bigjimslade on October 14, 2013, 07:55:31 AM
I have a table of offers for a ship in Excel format. They give the X/Y/Z coordinates for the positions the hull.

There are about 4000 data points.

Is there any fast way to mark these positions in TC? E.g. insert a line whose end is at that point?

Big Jim, can you post the excel file?
is it in csv format? If it originally was a txt file was it delimited with tab and comma? I use Tcad 20.2 platinum and the ruby "import xyz points" and the ruby "import xyz lines does a good job so far importing in either csv or xyz format. sometimes it takes a while to import all the points.
"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

bigjimslade

Right now the table is not finished. It's actually a bunch of tables. Some of them use length offsets as the X axis. Others use width offsets as the X axis. There are a lot of null data points.

When finished, I'd have to do some work formatting into a a csv file. I wanted to be ready to read the thing when I got finished.

bigjimslade

Here is a a sample file I extracted. The data is X.Y.Z.


To the Turbocad Gods. The system does not allow uploading a CSV file.

Marek

After processing a text file in Notepad + +, I used available TCP20 ruby scripts "Import lines" and "import points". I obtained the results as in attachments. Scripts from version 20 will not work in version 18.
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

Dean

#11
Jim my results are similar to Marek.
There were some errors in your file that I fixed.
Change the attached .txt file to .xyz. Since V19 doesn’t have the ruby script “import xyz points try to open it in a program that will import the xyz file, Design cad imports xyz files. I’ve attached my results in the V19 TCad file.
You could run a database report to check the quantity of points.
"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

bigjimslade

#12
Thanks guys. I suspect there are some rounding errors. Here is the file plotted in Excel. Notice the lack of kinks after the AP.

I'd be curious to know what had to be changed in the file.

It looks like I need to write a script. I still need to figure out how to draw.

It would actually be helpful to be able to draw a spline threw the points in a data set. For now, I just want to get the data in.


The bottom image shows a 10,000 point set. You can see some jaggies from uncorrected data. I have to look at microfilm and 3's look a lot like 5's and 0's and 9's and 6's all look alike, depending upon the amount of smudging. Sometimes I have to try all the combinations that might be right for a particular smudge.

Dean

#13
"It would actually be helpful to be able to draw a spline threw the points in a data set"
Tcad 20 will import your modified sample test text file (above) and changed to xyz > the xyz points as a 3d polyline. (pic1) Using the "import xyz lines" ruby but if you were to import a complete hull you'd be better off using the points only cause the lines create a mess. You would have to import say the stations, buttocks separately then loft the 3d polylines.

Design cad 3d max will also (pic2) they have trail versions for both
"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

bigjimslade

I'm upgrading my TC to 20 now.

What exactly do you do to import the files? Is this import documented somewhere? It sounded like you folks had to edit the files. Why?

Thanks

Dean

#15
For starters download the attached txt file then change the extension to xyz.
> In tcad 20 run the ruby “ import xyz  lines” or type in the ruby console import_XYZ_lines hit enter and choose xyz file > locate the bigjim sample xyz file and run the ruby.
If you want change the file extension back to txt > open in word pad and see how it’s formatted. I find in Tcad xyz files to work more without errors as do csv files. Excel can convert txt files through the text wizard but it gets tricky. Also, Tcad 20 platinum will export the coordinates (see attached pic)
Normal xyz format in wordpad is
0.0  0.0  0.0 
1.0  1.0  0.0   
always spaces between the x,y and z columns. Once you have the txt file just change the extension to xyz.
"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

bigjimslade

I did LOAD. THen selected TC20_ImportXYZPoints
Then Execute.

The console printed "71"

I did execute again.

THe console printed "72"

And so on


THen I did LOAD again. THen selected TC20_ImportXYZLines

Clicking execute causes the number to print while incrementing

The scripts look like they are supposed to display a file open dialog box so I can load the file you send.

Dean

By default the script is already loaded in the ruby console. You don't have to load the script.
>open the ruby console
>in the drop down list choose ' import xyz lines" or xyz points hit enter or execute
>then open the xyz file.
"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

bigjimslade

#18
Tanks. That did it. user error.

It looks like I need to do some programming to convert .CSV to .XYZ.

I have

/  Y1 Y2 Y3
X1 Z11 z12 z13
X2 z21 z22 z23


Dean

"It looks like I need to do some programming to convert .CSV to .XYZ."


A lot depends on the .csv file. Jim
If you have a .csv file change the extension to .txt and upload it then I'll take a look at it.
"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

murray dickinson

#20
Take a look at Marcus Bole's PolyCAD, needs to be registered but free.  Has a macro editor with the simplest syntax conceivable:

polyline name(optional), or  spline name(optional), or other entities
list of points, space delimited, not commas
end

It's got find/replace to sort delimiters, save the script as *.cmd, and run, you've got your entity.  It's that simple.  Polylines exchange sweetly with .dxf, splines with IGES.  IMSI/Design and SoftDevs ought to take a look too.  The Symbol Designer looks like it should be able to do the same thing, but I have no idea how to go about formatting and syntax, and there is no lucid (at least to me) documentation that explains it.  TC's inbuilt PPM editor is restricted to 2D plines as of V20, don't even know if it'll draw a spline.

murray dickinson

Well, I overcame the formatting/syntax thing in Symbol Designer with a cut'n'paste.  I drew a 3D polyline with a few points, then replaced my arbitrary points in the script with your list, formatted Point(x,y,z),Point(x1,y1,z).......and it drew the polyline, which will save as .dwg.  It's more cack-handed than PolyCAD's method, and it won't draw splines, 2D or 3D, but it's doable.

bigjimslade

Would it be possible to draw a 3D or 2D spline through all the points?

If so, what modifications would be necessary?

murray dickinson

#23
I've given you a bum steer: PolyCAD will create a polyline via the macro, not a curve.  But once the pline's created, PolyCAD can make it a control point spline or an interpolating spline at will, backwards-and-forwards.   PolyCAD doesn't distinguish between 2D or 3D plines or curves, there's only World CS and no point is locked to a plane.   The curve or line will be a poop-storm unless the points are relatively structured.  If you think of  cursive handwriting as an interpolating curve, consider how unintelligible it would be if the line didn't pass consecutively through each letter then to the next, but instead jumped backwards and forwards to arbitrary points, not just on adjacent letters, but anywhere within a word.
It's as simple as formatting the points as space-delimited, with your example by "find comma, replace with space",  head the list with "polyline" with or without a name, and end the list with "end"(!), then run....it's not even case-sensitive.    You've nothing to lose, just try it already.

bigjimslade


bigjimslade

Here is an example of success.

This is the path of the molded path of the upper sheer plating viewed from the stern ... or the bow (whichever you want).

murray dickinson

TC20's got a Ruby script by Kevan Chapman in the samples folder called "TC20_Draw3DLine.rb".  It calls 3D polyline to draw a rectangle.  Your coordinate list will have to be formatted.  Looks simple enough, maybe it can be persuaded to call a curve....

Dean

#27
Quote from: murray dickinson on October 23, 2013, 12:54:40 PM
TC20's got a Ruby script by Kevan Chapman in the samples folder called "TC20_Draw3DLine.rb".  It calls 3D polyline to draw a rectangle.  Your coordinate list will have to be formatted.  Looks simple enough, maybe it can be persuaded to call a curve....

Murray, Tcad will connect the points in a xyz file with a 3d polyline if there is a value in the “z” column.
Use the ruby“import_XYZ_lines”. Try it with the attached txt file (Jim’s original) that I modified just change the extension to xyz. And or remove the “#” change >cmd and run it in polycad.

???I wonder how Jim managed his approach..
"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

bigjimslade

I drew the lines manually.

It would be helpful still to have something do draw the spline automatically.

Here is what most of the data looks like from the side.

It includes the top of the sheer plates I posted previously, the bottom half breadth, and the tangency line. Unfortunately, the points come out as blurs. I still have more to add for various purposes.

The bald spots in the  middle occur in the original data.

Dean

#29
I remembered that animation lab has a “morphing” script so I tried animation lab and was able to morph a 3d spline (fitted) to the 3d polyline. I set the number of control points and segments the same as the 3d polyline.
I quickly drew a straight two point 3d spline by fitted points then changed the number of points. (attached video)




Design cad 3d max (imsi) Has a import xyz file and  will draw a spline curve through the imported points. It's a shame tcad can't do this. Check out the design cad forum member Dr Pr and his ship he drew with Design cad.
"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

murray dickinson

Amazing work, Dean, but puritanism about exclusive use of TC isn't my thing, even if it didn't need Anilab or DesignCAD, and Jim's reference to "fast" in his opening post must be contextually different to mine, too.  Speed and approachability for this sort of stuff is why I've been using PolyCAD since about TC V7.  Even PolyCAD's file format is readable text, so you can format a coordinate list, give the file the attachment .geo, and open it in PolyCAD as a pline, spline, mesh, NURB surface, point cloud, etc, then export as .dxf or .iges for TC use.   Alternatively, create an arbitrary entity with the same node count as your coordinates, edit the saved file in Notepad++ and replace the arbitrary coordinates with your own data, save, reopen in PolyCAD and export.  Nothing commercial is that transparent.

mikek

Hi Jim,

the line import function of the TC 20 ruby engine is great, usual no reason for other extern programs.  I made 2 csv files from
excel with each about 3600 data points, a sin curve and a modified sine curve.  Rename the file extension from txt to csv.

mike 

bigjimslade

#32
This is a performance issue here.

I am loading a spreadsheet with 13,000 data points into TC on my 32GB system. The have been loading now for 1-3/4 hours.

Assuming it completed now, would be under 2 data points loaded a second.

0-0-0-0-0

I killed that load after two hours.

I went to a 3,000 point file. Over an hour loading. on that one. That's less than a data point per second.

It appears that the time to load is nonlinear in regard to the size of the file.

mikek

#33
Hi Jim,

i cannot understand your performance issues. Changed the sin table, so all x values have a float part of ca. 7 digits, so i got a sine wave with 3600 points = 10 periods of 360 degrees, y values from - 100 to + 100.  Second file with the same 3600 x-points and random y-values from 0 to 100. Both files with z-value 0. With TCAD 20 32bit on WinXP and the Ruby import_XYZ_lines function on an older Dell Optiplex with 2GB RAm and an Athlon 7850 dual core at 2.8 MHz  (significantly slower than an Intel 8200 at same clock) it took in both cases about 1 sec to read and draw the polyline.
I changed the csv files to a dot as decimal separator and a comma as value separator. In the dropdown box for the file extension you can change all files and the function recognizes the txt files.

mike

Dean

Quote from: bigjimslade on November 04, 2013, 08:24:12 PM
This is a performance issue here.

I am loading a spreadsheet with 13,000 data points into TC on my 32GB system. The have been loading now for 1-3/4 hours.

Assuming it completed now, would be under 2 data points loaded a second.

0-0-0-0-0

I killed that load after two hours.

I went to a 3,000 point file. Over an hour loading. on that one. That's less than a data point per second.

It appears that the time to load is nonlinear in regard to the size of the file.

Jim try the attached txt file, remember to change the extension to xyz. Use the import xyz lines ruby. It’s a sine wave that starts at 0,0.
I tried running Mikek's file and got the same results as you. Turbo froze… I think he created a sine wave from Earth to Pluto…… Lol
"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

bigjimslade

I noticed that when I import, the Redsdk stats kept flashing.

I disabled Redsdk and the import that was taking over an hours went through in seconds.

Dean

Quote from: bigjimslade on November 05, 2013, 12:02:15 PM
I noticed that when I import, the Redsdk stats kept flashing.

I disabled Redsdk and the import that was taking over an hours went through in seconds.
Good find Jim.
Until you experience what you are sacrificing by using Redsdk you think everything is working as it should be….They really need to iron out these quirks…. I do enjoy 3d modeling with Redsdk enabled but I keep finding these little quirks. If a TC tool or operation isn’t working as expected, I guess the first think to do for a possible fix is switching to GDI if Redsdk is enabled. There should be a repository of all these Bugs or whatever you want to call them where users can QUICKLY access the information. my 2 cents…..
"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

henry tideman

I do not have TCADV20.

Marcus Bole was abundantly generous in his help to me for PolyCad: to down-load, authorize, and find documentation.  He extended his greetings to Murray Dickinson.
Pro Platinum 2016/23.2/61.2
Oregon, Illinois, USA

murray dickinson

#38
Thanks for the heads-up, Henry.  Every CAD app should have some of the specific capabilities that he's built into PolyCAD (like the simple backwards-and-forwards conversion of curves to polylines, and similar for NURB surfaces to meshes), and I'm grateful that he's so generous with it, and with his help.

bigjimslade

I have run into another issue. I have a file with about 15,000 points.

Load XYZ Points has stopped working (Or is putting the points somewhere I cannot find).
Load XYZ Lines CONTINUES to work.

I can use Load XYZ Points on other files and copy them into the big file.


I don't know if this is a file size issue (why would Load XYZ Points still work then?) or something else.