sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Materials problem on Export

    Scheduled Pinned Locked Moved Plugins
    12 Posts 3 Posters 496 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Alan FraserA Offline
      Alan Fraser
      last edited by

      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


      ffexport.rb

      3D Figures
      Were you required to walk 500 miles? Were you advised to walk 500 more?
      You could be entitled to compensation. Call the Pro Claimers now!

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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

        TIG

        1 Reply Last reply Reply Quote 0
        • Alan FraserA Offline
          Alan Fraser
          last edited by

          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 kEND

          I tried manually line counting in Notepad but lost track.

          3D Figures
          Were you required to walk 500 miles? Were you advised to walk 500 more?
          You could be entitled to compensation. Call the Pro Claimers now!

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            @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 kEND

            I 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 method options_of' for class Module'

            TIG

            1 Reply Last reply Reply Quote 0
            • Didier BurD Offline
              Didier Bur
              last edited by

              Hi,
              I've been told that there are several versions of fileutils.rb, some of them have bugs.

              DB

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                You don't need FileUtils at all...
                I'll sketch out a version without it ad post it asap...

                TIG

                1 Reply Last reply Reply Quote 0
                • Alan FraserA Offline
                  Alan Fraser
                  last edited by

                  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.

                  3D Figures
                  Were you required to walk 500 miles? Were you advised to walk 500 more?
                  You could be entitled to compensation. Call the Pro Claimers now!

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    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...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      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...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • Alan FraserA Offline
                        Alan Fraser
                        last edited by

                        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. πŸ˜‰


                        export test.jpg

                        3D Figures
                        Were you required to walk 500 miles? Were you advised to walk 500 more?
                        You could be entitled to compensation. Call the Pro Claimers now!

                        1 Reply Last reply Reply Quote 0
                        • TIGT Offline
                          TIG Moderator
                          last edited by

                          Alan

                          Here's a version with reporting of exports 'on'...ffexport.rb Use the one that suits you...

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • Alan FraserA Offline
                            Alan Fraser
                            last edited by

                            Thanks TIG.

                            3D Figures
                            Were you required to walk 500 miles? Were you advised to walk 500 more?
                            You could be entitled to compensation. Call the Pro Claimers now!

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post
                            Buy SketchPlus
                            Buy SUbD
                            Buy WrapR
                            Buy eBook
                            Buy Modelur
                            Buy Vertex Tools
                            Buy SketchCuisine
                            Buy FormFonts

                            Advertisement