Materials problem on Export
-
Greetings gents,
I could do with a little help with this one. I've attached an export plugin that I use to automatically export a range of different formats and a thumbnail image. Obviously this saves having to go to File > Export multiple times....which can get exceedingly boring.
This worked flawlessly in V7, but it's looking like the API got tweaked slightly, because it's giving problems in V8. It's usually ok with just geometry, but if any materials are used, it tends to hang.It's a fairly lengthy script, but that's only because it goes through the same routine time and again with different formats.
Operationally, it operates out of the Plugins menu and brings up a little dialog box in which can be specified which formats you wish to export. After first usage it saves these preferences to a config text file. It calls on the standard SU export filters (and options) and saves the output to the same folder as the original skp file...or more exactly to an output sub-folder. If materials have been used, it creates a temp folder to collect everything in, zips it all up, then deletes the temp folder, leaving everything neatly packaged in the zip.
The problem with V8 is that it is hanging at the stage of creating the first of these temp folders...the 3ds. This is not far into the script, just after dwg and thumbnail generation. I'm clearly missing something obvious and would appreciate being put right, so I can finally get rid of V7...which I'm only hanging onto for export reasons. I'm assuming that any changes in the 3ds section can be applied to all the other formats too.
TIA
-
As I don't have some of the third-party tools your script calls I can't test it... but here's an adjusted version anyway...
I can't see what might be up - although you do have a lot of 'global' variables [$]...
Can you try it and report the error messages in the console etc...ffexport.rb -
Thanks TIG. Actually, you don't need Image Magik...that was just a belt and braces job.
I'm getting this in the console.Error Loading File ffexport.rb
C:/PROGRA~1/Google/GO24A4~1/Plugins/ffexport.rb:212: syntax error, unexpected $end, expecting kENDI tried manually line counting in Notepad but lost track.
-
@alan fraser said:
Thanks TIG. Actually, you don't need Image Magik...that was just a belt and braces job.
I'm getting this in the console.Error Loading File ffexport.rb
C:/PROGRA~1/Google/GO24A4~1/Plugins/ffexport.rb:212: syntax error, unexpected $end, expecting kENDI tried manually line counting in Notepad but lost track.
I got that too...
You need Notepad++ which adds line numbers!
I missed an 'end' after the last def end!
But it's messed up... I'll look at it and get back to you...
I suspect that the fileutils.rb is raising the error...@unknownuser said:
...212: syntax error, unexpected $end, expecting kENDError Loading File fileutils.rb
undefined methodoptions_of' for class
Module' -
Hi,
I've been told that there are several versions of fileutils.rb, some of them have bugs. -
You don't need FileUtils at all...
I'll sketch out a version without it ad post it asap... -
Thanks TIG, I really appreciate the effort. I can't imagine what's happened between V7 and V8 as regards the export of materials. It's probably as well to find out.
-
It's not so much what has changed in the API as the Ruby version and the FileUtils that seems incompatible...
I'll knock up a quick version that doesn't need them or global variables etc and see how it goes from there... -
Alan
Here's a version that works for me.ffexport.rb I've removed the need to have FileUtils [it now uses standard File/Dir methods].
The units change in options was changed too, as you can't rely on the same array elements applying across SUp versions or platforms - I've only change the units - you might also want to change the d.p's ?
Because I don't have your 'zip' tools or 'imagemagick' I've added some traps BUT it should work OK for your needs. I have mocked up the zip copy to the base folder, using manual methods, and it worked OK.
If you want the export reporting back add,true
after each export command.
I've put ### near each major change...
I've also added some console reporting and it opens the folder it's made at the end... -
Cheers TIG; that's absolutely brilliant. You're a star. I just tested it on a fully mapped model and this is the resulting 3ds version (if SU is going to screw up the mapping on anything, it's the 3ds)
Yes, there's a lot of superfluous legacy stuff in there, as we tried it across several SU versions and also wanted it to be cross-platform.
I'll decide whether or not to turn the reporting back on. I do need the face-count, but as I usually photo-render stuff in Deep Exploration, I can get it from there anyway.
My son James did most of the coding on that. I'd have got him to fix it, but he's just disappeared off down to London...to a job in oil and gas exploration (coding in IDL for an obscene amount of money for someone his age). Kids; they're never around when you need them...just fly back to the nest when you don't.
-
Alan
Here's a version with reporting of exports 'on'...ffexport.rb Use the one that suits you...
-
Thanks TIG.
Advertisement