[Plugin] Export Cpoints to CSV v1.0 20110913
-
Hi TIG,
After changing the file it now says: exportcpoints2csv.new
Error: #<NameError: undefined local variable or method `exportcpoints2csv' for main:Object>
(eval):982Brgds
Jesper -
What have you done ???
Here's a new version that does it as a TSV file with ',' as the decimal separator!
Exportcpoints2tsv.rb -
Hi TIG,
Yes, one could wonder what happened, I believe I just did as you instructed, changed the "," to "\t" in the first line and "csv" to "tsv" in second line, but something must have gone wrong. Maybe it has to do with the fact that I did a classic! I was too quick to use Notepad to edit the rb file and forgot to remove the "Use always this program" sรฅ now all the rb files is shown as "Notebook" files... (
Here is the result of the new file you made:
7,0 129,0 0,0
6,0 140,0 0,0
0,0 138,0 2,0
0,0 140,0 2,0
15,0 196,0 -1,0
1,0 180,0 2,0
22,0 169,0 -1,0
-8,0 168,0 -1,0
21,0 189,0 0,0
-16,0 180,0 0,0As you can see it still round up all figures, so it must have something to do with the exporting as Sketchup itself shows it with 3 decimals, the setting is with 3 decimal in Model Info and it can't have anything to do with Excel as the file now is exported to a text file... this is strange...
Brgds
Jesper -
Hi again,
Just a question, is it somehow possible to force the numbers of decimals to say fixed 3 decimals on all the 3 figures (LLZ)?
Best regards
Jesper -
@jemagnussen said:
Hi again,
Just a question, is it somehow possible to force the numbers of decimals to say fixed 3 decimals on all the 3 figures (LLZ)?
Best regards
JesperTo export to 3dp always including trailing .000 would be possible... BUT the XYZ code would need revisiting - I'll come back later today when I have a moment...
-
Here's the updated version
(c) TIG 2011
Type
Exportcpoints2tsv.new
in the Ruby Console.
Exports all Cpoints is a Selection to a X,Y,Z 'TSV' file.
The sep="\t", the decsep=',' and ext='tsv'.
Change decsep='.' IF you want 1.234 rather than 1,234 OR run with arguments
as shown below...
Model Units are used and get exported to the TSV in say meters as 1,234 -
it always forces 3dp even when not needed - e.g. 0,100
Check that your locale Excel uses ','/'.' matching your output.
You can affect output by adding an argument to the command line, e.g.
It returns XYZ format by default BUT if you type
Exportcpoints2tsv.new 1
it will then use YXZ format.
To change from ',' to '.' as the decimal separator, type
Exportcpoints2tsv.new 2
To change from ',' to '.' as the decimal separator AND use YXZ, type
Exportcpoints2tsv.new 31.0 20110914 First issue.
1.1 20110915 Forces 3dp always, command-line argument to change format.Exportcpoints2tsv.rb -
Hi TIG,
Voila... that did the trick, now I get the decimals, also from the model that is geolocated so this is really a big help. Can't thank you enough for your kind assistance.
Have a lovely day,
Best regards
Jesper -
I get there eventually
-
Sorry to bother you, but I got referred to this post from the newbie section. I had asked the following:
I am laying out a porous plate and was wondering if there is an easy way or perhaps a script that will read the construction points (e.g. centerpoints) of each of the circles representing the holes. If it could write out the points to a file would be great, but if it would print to the console -- I could write them down. There are a couple of hundred holes that is why I would like to automate this.
Operating system: Mac OS X
SketchUp version: V8This script sounds exactly like what I need. I placed the ruby script in the Main folder:
MacHD/Applications/Library/Application Support/Google SketchUp 8/SketchUp/plugins/but when I relaunch SketchUp I don't see the script in the Plugins pull down menu. Am I missing something?
Sincerely,
Bill -
The instruction says
@tig said:
Type
Exportcpoints2csv.new
in the Ruby Console...Open the ruby console from the window menu and simply copy paste that line there (at the bottom) then press enter
-
As Gaieus said... it's a rarely used tool, so it is used without a menu item - as explained in the instructions on the download page...
Type
Exportcpoints2csv.new
in the Ruby Console.You can export any selected cpoints to CSV using this 'Export CSV' tool...
To mark all of the selected Arcs/Circles centers with cpoints, BEFORE you do that final CSV export, you can run this one liner: Copy/Paste the code into the Ruby Console + <enter>
m=Sketchup.active_model;ae=m.active_entities;s=m.selection;as=[];s.each{|e|next unless e.kind_of?(Sketchup;;Edge)and e.curve and e.curve.kind_of?(Sketchup;;ArcCurve);as<<e.curve};as.uniq.each{|ar|ae.add_cpoint(ar.center)}
A cpoint is added to every Arc/Circle's center for you, select them.
The 'Export CSV' tool filters for only cpoints so you don't need to be too carefully making the selection as long as you include the cpoints you want...
Advertisement