sketchucation logo sketchucation
    • Login
    1. Home
    2. ethomson
    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
    E
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 1

    ethomson

    @ethomson

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    ethomson Unfollow Follow
    registered-users

    Latest posts made by ethomson

    • 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

      posted in Developers' Forum
      E
      ethomson