Looking for a batch export .skp to .dxf ruby
-
Ruby experts,
Is there an a script out there for batch exporting .skp files as .dxf? Essentially, I have a lot of small SketchUp files that need to be converted into a lot of small .dxf files.
Thanks in advance for your help.
--Lewis
[Lewis Wadsworth]
-
Try the Automated 2D Output script from didier.
it's an script called ADO
You an find it here
http://www.crai.archi.fr/RubyLibraryDepotIt's at the top of this page :
http://www.crai.archi.fr/RubyLibraryDepot/Ruby/em_fil_page.htmAutomatic 2D output from pages. Features: pages settings, images settings, creates 6 standard ortho views, creates 4 standard axonometric views, exports either standard pages, or user pages, or all pages to various bitmap and vector format files. Supported output formats: jpg,tif,bmp, tga, png, dwg,dxf,eps,pdf.
-
Thanks, but I've used that and its not quite what I'm looking for, since I do not want these SketchUp files to become 2D objects. Essentially, I have a folder of about 40 small 3D components (some custom steel fittings) and I want to turn them into 40 small 3D .dxf files so that I can used them in other programs (AC3D and Blender) that trade 3D mesh files with SU using .dxf and .3ds. I suppose a batch .skp to .3ds converter would do just as well.
If worse comes to worse, I'll find my Ruby Handbook and try to do this myself, but it might take me longer to get a script working than it would to translate each little widget individually.
--Lewis
[Lewis Wadsworth]
-
You can create axonometric pages then it's still 3d
maybe pm didier ?
-
I will contact him...but if I'm not mistaken, those axons created by this script are products of an Export 2D operation.
--Lewis
[Lewis Wadsworth]
-
Hi Lewis,
Alexander is right, exporting dxf will be a 3D export, even when in orthogonal views.
Regards, -
Thanks for noticing this, Didier...I hadn't had a chance to send you a message yet. I've looked at the ADO script, though (I have the .pdf directions open now) and I still don't quite see how this addresses my problem...it seems that it will create multiple .dxf files from a single .skp file, but my problem is that I have multiple .skp files and I would like to convert them each to a separate .dxf file. I suppose I am looking for something like the capabilities of the batch file conversion program 3DWin5, but working from within SketchUp and translating from .skp to .dxf (or .3ds, as a second choice).
It has occurred to me that if this can't be done in SketchUp with a Ruby, I might be able to do it with Rhino and Rhinoscript/VB, but I hesitate to think how long it might take me to relearn VB.
--Lewis
EDIT: I think I found something that will solve part of my problem. Some of these same components exist in .dwg format as well as .skp, and there is a Linux application for batch converting .dwg to .dxf ( http://lx-viewer.sourceforge.net/ ). That doesn't help me with the items that exist only in .skp format, but at least it saves a bit of labor.
[Lewis Wadsworth]
-
Why, thanks ccsing. I just noticed this...but the original post was a long time ago, and in the end I settled on using a modeler (Rhino 4) for the project that opens SU files natively.
-
#convert skp to obj #every thumb is putted in a created dir with name of related skp model's name #skppath is the residence of skpfiles require 'sketchup.rb' if(not file_loaded?("skp2obj.rb")) plugins_menu = UI.menu("Plugins") plugins_menu.add_item("skp2obj") {file_export} end file_loaded("skp2obj.rb") def file_export #skp file path #beware the end "/" e.g. skppath ="i;/skp/skptest/model/error/" skppath ="i;/tt/" #open dir and loop all skps dir = Dir.open(skppath) begin dir.each {|x| next if x !~ /\.skp$/i x = "#{x}" sourcefile = skppath+x x = x[0,x.length-4] destdir = skppath + x + "/" destfile = destdir + x +".obj" #mak dir Dir.mkdir(destdir) #open modle file Sketchup.file_new status = Sketchup.open_file sourcefile if (!status) UI.messagebox "error; " + sourcefile end #export obj status = Sketchup.active_model.export destfile if (!status) UI.messagebox "error; " + sourcefile end } ensure dir.close end UI.messagebox "Finished" end
Advertisement