sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Batch .dwg Importer

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    6 Posts 3 Posters 659 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.
    • D Offline
      dirtypr
      last edited by

      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
      • TIGT Online
        TIG Moderator
        last edited by

        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

          dude! that is awesome!

          1 Reply Last reply Reply Quote 0
          • D Offline
            dirtypr
            last edited by

            😍 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

              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
              • TIGT Online
                TIG Moderator
                last edited by

                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
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement