💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
Exporting DWG
-
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
Advertisement