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" endThe 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement