Is this possible? [code] batch export
-
I was wondering is there a ruby out there which does this?
I have to export my 3D models in several 3D extensions. Its a time consuming thing to do by hand if youve got to export 10 models in 5 different formats each time. So I was wondering can this be automated with a ruby?
Something like this:
- Open model
- Click Ruby
- Tick the 3D extensions you want your model exported in
- Select a folder all these exports go into
- Press okay and supress any file name errors by automatically accepting them (3ds and a few more replace the spaces between words with underscores and asks if this is okay)
- SU starts exporting each 3D extension one by one with just that one click
Is this possible, or is something like this out there? It would mean the world to me.
Any help in this matter would be greatly appreciated!!
-
Rob,
I think it's possible, at least most of it. What extensions should be available as options?
The core functionality is simple. If you can make this work, the rest is grunt work. You can copy and paste it right into the Ruby Console to test it.
%w(dxf kmz fbx obj).each {|ext| Sketchup.active_model.export("/testmodel.#{ext}",false)}
This files should be create on on a Windows machine, and the / folder on a Mac (I assume.) I don't have the Pro exporters and so can't test them.
-
Jim, I tried your line of code and it seemed to work. There was a stop after the DXF export for user acknowledgement that the export had completed. I imagine Rob would like even that to be automated if it could be.
-
@dave r said:
Jim, I tried your line of code and it seemed to work. There was a stop after the DXF export for user acknowledgement that the export had completed. I imagine Rob would like even that to be automated if it could be.
That's promising. I edited the code snippet to add an explicit "false" to the export. If this does not make the DXF acknowledgment dialog go away, I don't think there is anything that can be done about it.
-
That specifically is a bug that's been reported already. (the dxf / false thingy)
Todd
-
Hey guys, thanks for your help so fast!
I want to export to
.3ds
.dwg
.dae
.objI would be willing to bash my return button a few times to make those pop ups go away. Is it possible that way?
Keep in my I have no idea how ruby's work, so that piece of code looks really fancy to me but what to do with it is beyond me.
-
Using a dot-slash ( ./ ) puts the export files in the same folder as the original file (assumes the file has been saved somewhere), which might be more convenient.
Regardless, nice one-line coding Too bad this wasn't issued specifically as a ruby challenge item...
-
Rob,
To export to the types you specified, just change the stuff in parentheses after the %w at the beginning - something like
%w(3ds dwg dae obj)......
and leave the rest of the code intact.
-
And I enter the code into the ruby entry console? or could I form it into a nice button?
-
Make 2 nice buttons and post them here. a 16X16 pixel and a 32X32 pixel. Someone will do it.
Todd -
Here you go 2 quick png's
-
Pwetty Pwease someone?
-
Hey Rob,
I just continued where Jim and Rick left off.
Put the contents of what is in the attached .zip into you plugins directory and restart SketchUp.
You'll see your icon that you made. Open a model click on the tool bar icon. The model will be exported to c:\ with the models name i.e. whatever the name says in the Title bar. I also gave the icon a tool tip and the status bar text.
Let me know if that works. This is a first draft and I'm sure it could be better.
BTW the defect Todd was talking about "not suppressing the results dialog after dwg export" is fixed and will be in the next version of SketchUp.
Hope this helps, I hope it doesn't suck....it good to breath clean air
http://www.sketchucation.com/forums/scf/sas/Ruby/Export_Toolbar.zip
-
Thanks alot Brad!
This will save me and the guys over at FF quite a bit of time!If anyone is interested in advancing this ruby,
A window in which you can tick the exports and specify their file names and their location would be awesome.But for now this works perfectly! It indeed is nice to breath clean air Brad !
-
@robmoors said:
If anyone is interested in advancing this ruby, a window in which you can tick the exports and specify their file names and their location would be awesome.
Any progress on this one?
I used it the other day and all the files showed up with no name, just a .dwg .obj etc...
I would welcome a more refined script.Thanks.
Advertisement