[Plugin] Export Batch DAE
29 posts
• Page 1 of 1
[Plugin] Export Batch DAECopyright (c) TIG 2011-2014
Permission to use, copy, modify, and distribute this software for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies. This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose. Name: ExportBatchDAE.rb Usage: Sketchup Menu > File > Export Batch DAE... Answer the options dialog, then OK. [Note that a 'usual' set of 'options' shown - adjust as desired] Select one SKP from a folder of SKPs to be exported, then OK. All SKPs in that folder are opened, exported as DAE [using the given settings] and then closed. You might be prompted to save a SKP - answer 'No'. If the original SKP was unsaved the last exported SKP remains open, otherwise the original SKP's window is restored. All exported DAE files are found in a [new] subfolder in the selected folder called 'DAEs' - there might also be subfolders made to contain associated texture files, each named after its DAE. Any preexisting DAE files will be overwritten without a warning. Donations: PayPal.com info @ revitrev.org Version: 1.0 20110809 First issue. 1.1 20131228 Future-proofed. TIG
Re: [Plugin] Export Batch DAE v1.0 20110809hi TIG,
just did a mac test over lunch... I made a folder called 'importDAEs_from' and dropped a selection of .skp's in... started SU and chose batch export... a new sub-folder named DAE was made, it contains the .dae's and a materials folder for one of the .skps contains a .jpg so all went well. as a note, the original SKP was unsaved and SU shut down on completion of exports. is it possible to preserve groups or maybe convert them to components on-mass prior to export? john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] Export Batch DAE v1.0 20110809Hi, driven...
If you have any SKP where you want to make all of its groups into component-instances prior to export use this one-liner, or insert the code just after 'Sketchup.open_file(skp)' in the batch exporter script...
![]() ![]() TIG
Re: [Plugin] Export Batch DAE v1.0 20110809hi Tig that works, as well...
however it seems that using this 'disappears' the toolbars , but I thought it was Thomas's new tool, so didn't mention it earlier. I then thought it was Sketchup.send_action('terminate:') that was doing it , but just tested that on it's own and it doesn't. so must be something else in the script, both versions... john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] Export Batch DAE v1.0 20110809There is nothing in this script or thomthom's that should [could] cause this to happen...they are both well wrapped in their own methods and don't mess with any other classes/methods/methods that I know of...
What other scripts do you have loading ?? TIG
Re: [Plugin] Export Batch DAE v1.0 20110809hi TIG,
I've got a reasonably stable set of well organised plugins that don't interfere with my launcher app. if I add anything ropey it usually interferes with my launch so I eliminate or fix it first. most of the rubies are in additional folders and I just load them when I need to use them, I have some of yours, thomthom's, jim's and chris's and fredo's in the wild and these are the floating toolbars that I use all the time. I also have some of the oldtimers like weld, rotated rectangle, mesh additions, etc... the only installed ones that ever play up are EEby Vector to Obj [if I extrude bezier curves] and a couple of webDialog issues with the latest version of Safari. it really does appear to be something to do with this, so I'll clarify what happens. if I open SU and 'save' the empty file, and then use 'Export Batch DAE' everything works and on completion SU stays open, if I then quit SU and reopen I still have my 'floating toolbars' if I don't save the initial file, on completion SU closes itself and when I reopen my 'floating toolbars' have gone. my 'custom toolbar' remains intact in both scenarios... CHANGE OF PLAN ok, problem still persists... and I also tested without tt_shell... I don't actually have a current use for this plugin, I'm just mac testing it out of curiosity... john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] Export Batch DAE v1.0 20110809From your description the code that runs if you didn't have a 'saved' SKP open when you started exporting is Sketchup.send_action('terminate:')
On the PC that line closes the window belonging to the last SKP exported. However, if the open SKP had been saved before exporting then it's reopened again, so the last SKP exported window closes. Perhaps the 'terminate:' code on a MAC behaves differently from a PC... Change the line Sketchup.send_action('terminate:') to ###Sketchup.send_action('terminate:') UI.messagebox('Please close this last SKP window manually!') The last exported SKP stays open and you are asked to close it yourself Retry - it shouldn't then affect your toolbars ?? Of course the simple trick to avoid this is to open one of the SKPs in the folder of SKPs you want to batch-export, then the folder selection jumps to that folder as the start point and you select any SKP + OK and you are off and running - the originally opened SKP is reopened on completion... TIG
Re: [Plugin] Export Batch DAE v1.0 20110809tried that,
toolbars remain intact, but none of the windows are closed by SU, you need to manually close them all. one of the reasons for my interest is your use of Sketchup.send_action('terminate:') as I was hoping to use it in something else. it seems quite stable when used on it's own from Ruby Console with 'saved', 'un-saved', 'individual' or 'multiple' skp's. I currently use an shell script killall SketchUp in a couple of things, but have to run a separate app to send it [as SU won't] and I also keep looking for a less harsh way to instantly 'close all' when a process is taking far longer then the results warrant. john learn from the mistakes of others, you may not live long enough to make them all yourself...
Re: [Plugin] Export Batch DAE v1.0 20110809Quick Newbie question
![]() Everything's alright now, the photographer's here.
Re: [Plugin] Export Batch DAE v1.0 20110809
![]() I suspect you meant "DAE" [as in this exporter] which is the Collada file format [developed by Sony Computer Entertainment and the Khronos Group]; it is short for "digital asset exchange", it's an 'xml' format; it's now widely used for 3d data transfer - similar to DXF - it is also very similar to Google Earth's own .kmz file-format etc. TIG
Re: [Plugin] Export Batch DAE v1.0 20110809Thank you TIG for the answer AND your patience.
![]() Everything's alright now, the photographer's here.
Re: [Plugin] Export Batch DAE v1.0 20110809![]() TIG
Re: [Plugin] Export Batch DAE v1.0 20110809Hi TIG,
Thanks a lot for all your plugins! I managed to adapt this one to be able to batch export skps into OBJ files, but I still have to clic "OK" on the "OBJ Export Results" popup to move to the next file, which is a little bit annoying for a batch process! ![]() And of course I don't know how to code this to do it automatically... could you or anyone else help me? Thanks! David Re: [Plugin] Export Batch DAE v1.0 20110809IF you had posted your script we might be better able to see where it needs fixing ! However, using my super-powers of clairvoyance I suspect that you need code along these lines... model.export(objpath, false) which might help - the second argument controls the appearance of the prompt in all exports other than DAE, which can take an 'options-hash' - OBJ can't take a 'hash' [it uses Sketchup's 'current-settings'] - so if you pass a 'hash' the exporter sees it as just 'true', and so it pops up the report each time ! ![]() TIG
Re: [Plugin] Export Batch DAE v1.0 20110809Here is the script!
model.export function already has a second argument... perhaps changing the last two variables (double_precision, vertex_normals) or adding a new one can help? Re: [Plugin] Export Batch DAE v1.0 20110809You missed my point entirely.
![]() You can't pass an 'options-hash' to the exporter... UNLESS it's exporting a DAE file. All of your code/dialog about getting settings for the OBJ is wasted. The OBJ exporter always uses the last used Sketchup OBJ export options. Your code won't affect those and is a waste of time/effort. What it does do is pass 'something' other than 'false' to the exporter, which it then interprets as 'true', so the 'report' dialog pops up each time ! The settings in the hash are simply ignored ! Its easier than you've made it - just use opts=false it will work without the reports interrupting BUT you need to have the OBJ options set first. ![]() TIG
Re: [Plugin] Export Batch DAE v1.0 20110809Oh I just realized this digging into the Sketchup API reference!
![]() So no hash for exports except DAEs. I simply replaced the "opts" parameter with "False" and everything works fine... You just have to set the OBJ export parameters right before running the script. Anyway, thanks a lot again! This will save me a lot of clics! ![]() I attached the "revised" cleaned up script if anyone needs it! David Re: [Plugin] Export Batch DAE v1.0 20110809I'm looking for a script that will batch convert files from 3ds to dae format using sketchup.
I have found this script in an old thread
Re: [Plugin] Export Batch DAE v1.0 20110809I think this will only work on pro..
TIG
Re: [Plugin] Export Batch DAE v1.0 20110809
would it be possible to export all skp files in a folder AND subfolders?
Re: [Plugin] Export Batch DAE v1.0 20110809Dear TIG
Sorry, I am completely new to this and I am looking for a batch conversion of 3ds to dae. I see that you have already the batch export from skp to dae and I guess that the above code would do the trick. However I am completly incapable of joining the information into something that works. May I kindly ask you to do this? I will be super grateful if you will help me. Is it possible to modify this script to batch import 3ds files instead of skp and export to dae? (and how?) Reason for asking is that I have more than 1000 3ds files that I need in 3rd party software and I need to have the sketchup version of dae. Last edited by RasmusL on Thu Oct 25, 2012 10:51 pm, edited 1 time in total.
Re: [Plugin] Export Batch DAE v1.0 20110809
I posted some example code that does [could do] exactly this... it's in another post from earlier today... do a Search... TIG
Re: [Plugin] Export Batch DAE v1.0 20110809I think it is in this topic, from 4:32 today?
I tried it, but how do I get it to loop through all the 3ds files like a batch. Re: [Plugin] Export Batch DAE v1.0 20110809
Get the user to choose one 3DS file in the folder. Currently the code uses the returned file path. BUT let's say we have the returned filepath=UI.openpanel(...) From that you can find folder=File.dirname(filepath) [There's currently no API UI.getfolder() method... ![]() From the folder you can find all of the 3DS files... There are several ways, e.g... files=[] Dir.entries(folder).each{|f|files << File.join(folder,f) if File.extname(f).downcase==".3ds"} Now we have an array of all 3ds files in that folder... Each array element is a full path... Use a 'batch' process like this... files.each{|file| ### ALL OF THE CODE TO IMPORT/EXPORT '3ds file' GOES HERE... } Unless you want to pay to have a properly written script I'll leave it there... ![]() Hint: to process files in subfolders do something similar to the above but this time make a list of all folders in the 'selected' folder, then iterate through the contents of each of those in turn, adding any 3ds files to the array for the ultimate batch processing ![]() Please be wary - I have typed this from memory, so it's untested... ![]() TIG
Re: [Plugin] Export Batch DAE v1.0 20110809
OK... i'll keep working on it then. My question is linked to ae snapshot plugin, when it is used to collect informations about all skp files on the hard drive, create a thumbnail and a file shortcut in a specified folder. I adapted Jim FOLTZ's code to open each skp file in a folder, zoom out and save, so when it is saved, aesnapshot creates automatically the thumbnail and the file shortcut
I am not sure about the necessity of the prompt between the files register Re: [Plugin] Export Batch DAE v1.0 20110809I expect that the prompt is a device to get the view zoomed before doing the export, otherwise you might find it's exported before the zoom is finished ?
TIG
Re: [Plugin] Export Batch DAE v1.0 20110809
yes maybe a timer would be enough, so it would not be necessary to wait and click for each file Re: [Plugin] Export Batch DAE v1.0 20110809model.options["PageOptions"]["ShowTransition"] = false
might help... OR this entire thing as an example ?
TIG
29 posts
• Page 1 of 1
|
Who is online
Users browsing this forum: casildo, lisannamagdalena and 15 guests