sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Exporting DWG

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 277 Views 1 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.
    • E Offline
      ethomson
      last edited by

      I was messing around with the idea of exporting simple 2d geometry to a dwg for later use by Autocad.

      This is what I came up with. I just started with Sketchup today and downloaded the Pro demo but work with Autocad daily (2d & 3d). Anyways this seems to work, I'm not sure if this is a proper way of going about it.

      
      def exportmodel
         #Save existing drawing temporarily to come back after processing others
      	Sketchup.active_model.save "temp1.skp"
         Sketchup.file_new
      		
      	model = Sketchup.active_model	
      	exportlayer = model.layers.add "Samplelayer"	
      
      	pts = []
      	pts[0] = [0,0,0]
      	pts[1] = [10,0,0]
      	pts[2] = [10,10,0]
      	pts[3] = [0,10,0]
      	
      	rect = model.entities.add_face pts
      	rectlines = rect.edges
      	
      	i = 0
      	4.times do
      		rectlines[i].layer = exportlayer
      		i += 1
      	end
      
         #creating a face and then deleting it to leave just the edges/lines seemed 
         #slightly easier than creating the edges on their own, maybe this is a bad idea.
      	rect.erase!	
      
      	model.export "c;\\sample.dwg"
         #save just so I don't get a file close dialog
      	model.save "temp.skp"
      	#restore previous drawing
      	Sketchup.open_file "temp1.skp"
      end
      
      

      The ultimate end goal would be to generate multiple 2d component dwg parts from a sketchup 3d model. I just wanted to make sure it would work in theory before I got to far into it.

      Thanks

      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