• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ 30% Off | Artisan 2 on sale until April 30th Buy Now

Batch .dwg Importer

Scheduled Pinned Locked Moved SketchUp Discussions
sketchup
6 Posts 3 Posters 659 Views
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.
  • D Offline
    dirtypr
    last edited by 29 Aug 2011, 23:32

    I have about 150 CAD drawings I have to import into SU. Does anyone have any suggestions to speed up the process?? It's driving me crazy to do each one manually. Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 29 Aug 2011, 23:58

      Write a one liner something like this:

      f='C;/Temp/DWGfolder';Dir.entries(f).each{|d|Skethcup.active_model.import(File.join(f,d),false) if File.extname(d).upcase==".DWG"}
      

      Edit the part in the f='' to be the full-path to YOUR folder of DWG files.
      Copy+paste into the Ruby Console + <enter>...

      TIG

      1 Reply Last reply Reply Quote 0
      • P Offline
        penumbradesign
        last edited by 30 Aug 2011, 00:44

        dude! that is awesome!

        1 Reply Last reply Reply Quote 0
        • D Offline
          dirtypr
          last edited by 30 Aug 2011, 02:26

          ๐Ÿ˜ TIG! Thank you!! I'll try it out and let you know how it goes.
          Thanks again.

          1 Reply Last reply Reply Quote 0
          • D Offline
            dirtypr
            last edited by 30 Aug 2011, 02:44

            That worked really well. It puts them all in the same file, so i'll still have to separate them but that still is a big help. I've never worked with the ruby scripts (besides downloading them) but it looks kinda fun. I'm gonna tweak that and if I come up with anything useful I'll share it.

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 30 Aug 2011, 09:39

              You never said you wanted the DWGs importing so each went into a separate SKP file !
              ๐Ÿ˜’
              To do that you need a bit more code - start with an almost empty SKP add a small bit of geometry [dot at origin?] to force a new component on import; run the adjusted code, it gets the imported file name and imports it, saves the SKP with that name.skpe [into a given folder], then it erases the DWG-component and purges the SKP's definitions, and adds the next DWG and repeats saving as that name etc... until all DWGs should have been saved into separate SKPs...

              TIG

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

              Advertisement