PDA

View Full Version : X,Y Excel/CSV Import Corel?



Ryan O'Hara
09-28-2010, 2:16 PM
Creekers, I have been pretty quiet lately, but do have a question that some of you Corel Experts may be able to help out with.

Basically, I need to import a number of points (later used to create a spline) via a csv or excel file. Is there an easy and simple way to do this in Corel (using X3)? File looks like this (see below) with a list of 80 points.

Any help is greatly appreciated!


0.63415168 0.66936978
0.86970487 0.71961693
1.10525805 0.78630919
1.34081123 0.85773114
1.57636442 0.92216738
1.8119176 0.96790249
2.04747078 0.98322107
2.28302396 0.95640771
2.51857715 0.87574699
2.75413033 0.72952352
1.82326152 0.89183238
1.91968485 0.88426057
2.01610818 0.86982353
2.1125315 0.84852128
2.20895483 0.8203538
2.30537816 0.78532111
2.40180149 0.74342319
2.49822482 0.69466005
2.59464815 0.63903169
2.69107148 0.5765381
1.48694763 0.83177632
1.6060588 0.81637714
1.72516997 0.79490183
1.84428114 0.76735037
1.96339231 0.73372278
2.08250348 0.69401906
2.20161465 0.6482392
2.32072582 0.59638321
2.43983699 0.53845108
2.55894816 0.47444281
1.36383272 0.67863339
1.48427847 0.69049583
1.60472422 0.69046766
1.72516997 0.67854888
1.84561572 0.6547395
1.96606147 0.61903951
2.08650722 0.57144892
2.20695296 0.51196772
2.32739871 0.44059592
2.44784446 0.35733351
1.36683552 0.59755772
1.4726009 0.59749767
1.57836628 0.58786034
1.68413166 0.56864574
1.78989705 0.53985387
1.89566243 0.50148472
2.00142781 0.45353831
2.10719319 0.39601462
2.21295857 0.32891365
2.31872395 0.25223542
1.15063373 0.55251568
1.26474023 0.5252635
1.37884673 0.49423114
1.49295323 0.45941861
1.60705973 0.4208259
1.72116623 0.37845302
1.83527273 0.33229997
1.94937923 0.28236673
2.06348573 0.22865333
2.17759223 0.17115975
0.76026939 0.53750167
0.89973289 0.49568722
1.03919639 0.45131425
1.17865989 0.40438274
1.31812339 0.35489269
1.45758689 0.30284411
1.59705039 0.248237
1.73651389 0.19107135
1.87597739 0.13134717
2.01544089 0.06906446
0.64316009 0.38135593
0.76894416 0.38169504
0.89472822 0.37135615
1.02051229 0.35033926
1.14629635 0.31864438
1.27208042 0.2762715
1.39786448 0.22322062
1.52364855 0.15949174
1.64943261 0.08508487
1.77521668 0

Doug Griffith
09-28-2010, 5:57 PM
One way to go may be to regex to g-code. Then backplot to a DXF. Then import that DXF into Corel. Or, you may be able to script Corel. That is what I would do in Illustrator.

Lee DeRaud
09-28-2010, 6:28 PM
One way to go may be to regex to g-code. Then backplot to a DXF. Then import that DXF into Corel. Or, you may be able to script Corel. That is what I would do in Illustrator.Great minds think alike.

For a one-shot, probably quickest to generate HPGL right in Excel...that imports directly.

But a Corel VBA script is probably the right long-term solution if this problem crops up a lot. Might want to check macromonster.com to see if it's been done already.

Jeff Saltzman
09-28-2010, 7:19 PM
Interesting question... I want to generate some shapes programmatically with Python, so this is an interesting starting data set.

svg is open and well documented, so it's fairly easy to form in a spreadsheet. Here's the official reference for paths:
http://www.w3.org/TR/SVG/paths.html

Here's a spreadsheet with three header lines, a leading column with an "M" to start the path and "L" for each additional point, the values multiplied by 300 (to fit in the "viewBox") and a trailing line to close the svg:
https://spreadsheets.google.com/ccc?key=0AsCUiP6WbJIvdGtQTm1GS21UZTcyZy1ET1NVVHRUV EE&hl=en

Page with the resulting svg (just the text of the spreadsheet copied and pasted) that should import (or open?) into CorelDraw or whatever:
https://docs.google.com/leaf?id=0B8CUiP6WbJIvYjBhYWEzNzYtODNhMS00Y2M4LWFkN jAtY2FkZTVhNGIwMWY5&hl=en

You could fiddle with the width, height, viewBox, and scaling, but... is that the shape you expected?

Doug Griffith
09-29-2010, 1:30 AM
Interesting question... I want to generate some shapes programmatically with Python, so this is an interesting starting data set.

svg is open and well documented, so it's fairly easy to form in a spreadsheet. Here's the official reference for paths:
http://www.w3.org/TR/SVG/paths.html

Here's a spreadsheet with three header lines, a leading column with an "M" to start the path and "L" for each additional point, the values multiplied by 300 (to fit in the "viewBox") and a trailing line to close the svg:
https://spreadsheets.google.com/ccc?key=0AsCUiP6WbJIvdGtQTm1GS21UZTcyZy1ET1NVVHRUV EE&hl=en

Page with the resulting svg (just the text of the spreadsheet copied and pasted) that should import (or open?) into CorelDraw or whatever:
https://docs.google.com/leaf?id=0B8CUiP6WbJIvYjBhYWEzNzYtODNhMS00Y2M4LWFkN jAtY2FkZTVhNGIwMWY5&hl=en

You could fiddle with the width, height, viewBox, and scaling, but... is that the shape you expected?

I program in Perl and there are modules that do the SVG grunt work. I'm sure Python has the same since they are similar languages.

Ryan O'Hara
10-01-2010, 1:46 AM
Gents, I will read up on svg format. That would probably be perfect. I use matlab alot so will report back on this. I attempted to use scripting in autocad, but that didn't work very well.

Robert Walters
10-01-2010, 12:15 PM
FWIW...

The InkScape developers have told me that there are "issues" with the SVG spec in regards to absolute positioning when using in/mm units.

I wonder if it could be done in PostScript, though he mentioned splines, so not sure about that.

Lee DeRaud
10-01-2010, 1:46 PM
I wonder if it could be done in PostScript, though he mentioned splines, so not sure about that.Eh? PostScript does splines...IIRC it handles all arcs as splines internally.

Robert Walters
10-01-2010, 1:57 PM
Eh? PostScript does splines...IIRC it handles all arcs as splines internally.

And that's why I said "I wonder..." :D

Doug Griffith
10-01-2010, 5:11 PM
FWIW...

The InkScape developers have told me that there are "issues" with the SVG spec in regards to absolute positioning when using in/mm units.

I wonder if it could be done in PostScript, though he mentioned splines, so not sure about that.

My thought is that lasers are not precision enough to reflect the positioning errors caused by SVG. If you were dealing with EDM or even possibly CNCs it might make a difference.

Robert Walters
10-01-2010, 7:23 PM
My thought is that lasers are not precision enough to reflect the positioning errors caused by SVG. If you were dealing with EDM or even possibly CNCs it might make a difference.

It's not so much precision, but ye old rounding errors:

4.500 being rounded to 4.493857228
as SVG (per spec) uses 'pixel' as the native unit, not in/mm.

If you were doing inlay on the laser, it could muck things up as example.


Since you mentioned CNC...
Someone has created a python plugin for InkScape to generate g-code =)
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?InkscapeHowto
But I haven't played with it.

Doug Griffith
10-01-2010, 9:17 PM
It's not so much precision, but ye old rounding errors:

4.500 being rounded to 4.493857228
as SVG (per spec) uses 'pixel' as the native unit, not in/mm.

If you were doing inlay on the laser, it could muck things up as example.


Since you mentioned CNC...
Someone has created a python plugin for InkScape to generate g-code =)
http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?InkscapeHowto
But I haven't played with it.

You are correct. Even though I still think it wouldn't make much of a difference, I'd have a hard time using SVG without being able to control it's rounding function. Possibly SVG_SCALE=0.

Here is a tool for converting datapoints into a DXF:
http://www.delicad.com/anglais/rapiddxf4.php

Joe De Medeiros
10-02-2010, 12:17 AM
Here is a tool for converting datapoints into a DXF:
http://www.delicad.com/anglais/rapiddxf4.php

I wrote a program similar to this a few years ago, it can connect to Excel, Access or read in a text file, I wrote the dxf portion from scratch. It exports in dxf2000 format. I was contracted to write this for a company that needed to get xls data into autocad, and at the time there wasn't any off the shelf solutions.