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

    {REQ} Collada Mass Export by layer

    Scheduled Pinned Locked Moved Plugins
    5 Posts 2 Posters 360 Views 2 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.
    • EarthMoverE Offline
      EarthMover
      last edited by

      Not sure if this is possible, but I was wondering if you could, via script, take a model and export all layers into separate .dae (.or fbx) files, and ideally have each layer exported with a 0,0,0 origin on center. The purpose is for exporting to Lumion, (but could be useful for iClone, UDK or other similar programs) where each part of a model that needs to be controlled separately, needs imported separately with it's own axis defined. Right now it's a matter of copying each component to a new file, moving it to origin and manually exporting a dae file for each item. I was wondering if a speed up would be possible through a plugin.

      3D Artist at Clearstory 3D Imaging
      Guide Tool at Winning With Sketchup
      Content Creator at Skapeup

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

        I already wrote one [almost two years ago] called ' export_by_layer.rb'
        http://forums.sketchucation.com/viewtopic.php?p=183609#p183609
        You just specify the extension, e.g. 'dae' export_by_layer('dae')...
        It'll use that exporter's current export option settings...
        The 'origin' issue isn't addressed, as it assumes you want to keep all of the exported pieces in the same relative positions...
        It'd be easy enough to write a 'centering' script to run on the exported SKP files later...
        Try it and comeback... 🤓

        TIG

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

          This will center any model on the origin...
          Copy+paste the code in a file called TIG-centerorigin.rb in Plugins and restart Sketchup

          module TIG
           def self.centerorigin()
            model=Sketchup.active_model
            if model.entities != model.active_entities
              until model.entities == model.active_entities
                begin
                  model.close_active
                rescue
                end
              end
            end#if
            ct=model.bounds.center
            ct.z=0 ###
            ve=ct.vector_to(ORIGIN)
            tr=Geom;;Transformation.translation(ve)
            model.start_operation("TIG.centerorigin")
              model.entities.transform_entities(tr, model.entities.to_a)
            model.commit_operation
           end
          end
          
          

          Usage: type TIG.centerorigin in the Ruby Console.

          Note: the line starting 'ct.z=0' keeps everything at the same Z height, BUT you can add a # to the front of it IF want to center everything in the Z axis too...

          TIG

          1 Reply Last reply Reply Quote 0
          • EarthMoverE Offline
            EarthMover
            last edited by

            Thanks TIG. I forgot about that one. Let me try it out and I'll let you know. Lumion sets its origin point for each imported item at 0,0,0, so if I have a table that is 20' from origin when exported, in lumion, all the move and other other transforms are then set 20' from the table as well. I suppose I could use Chris Fullmer's center on origin too and center all the layers on top of each other, export and then undo the centering operation. The only issue is that his script centers items based on the middle of the bounding box and not the bottom. Still, I could make it work. Thanks again.

            EDIT - just saw your code response. I'll try that too. Thanks!

            3D Artist at Clearstory 3D Imaging
            Guide Tool at Winning With Sketchup
            Content Creator at Skapeup

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

              My TIG.centerorigin moves all geometry in the current SKP so that it's centered in the XY at the origin - the Z is unchanged but can be centered too by # out a line as explained... It means you need to process the SKP for each layer exported, but it pretty quick...

              TIG

              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