Copy from Autocad to Sketchup
-
Hi,
Im new to both Autocad and Sketchup SDK. I have been searching on web for a way to copy 2d drawings from Autocad to Sketchup.
I have already found https://github.com/janlelis/clipboard for clipboard handling in Ruby and https://bitbucket.org/jimfoltz/ruby-dxf-reader for reading DXF files but i don't know im on a right track or not? I found that Autocad creates temporary files for copied contents and i don't know where i can find them and how to read them back in Sketchup. My idea is to add an event handler to monitor ctrl-v events in sketchup (no necessary can be a custom command ) and check a folder for Autocad's temporary clipboard files then parse them. But i dont know how can i start.
Can you help me on this please?
Trxsi.
-
Have you found out what data AutoCAD places on the clipboard? Does it perhaps include the path to the temp file there?
Very interesting plugin idea you got there btw.
-
@trxsi said:
I have already found https://github.com/janlelis/clipboard for clipboard handling in Ruby
That specific project seem to copy just text - but perhaps it can be used as a base.
-
Pasting can done cross-platform with:
Sketchup.send_action("paste:")
Try and see if you can copy 2D to clipboard in AutoCAD, then switch to SketchUp, and try a paste from the menu, or type the expression I gave in the Ruby Console.I see your on Mac ??
I may have an idea to access Clipboard data, but only on PC Windows.
Is that github project Mac or Windows ? -
@dan rathbun said:
Is that github project Mac or Windows ?
Cross platform - even Linux.
I'm thinking it might be easier with a C Extension - avoiding all the dependencies that project has which is troublesome within SketchUp's shared environment.
-
I just tried drag and drop for both DWG and DXF, but the cursor changes to a "No Drop Here" cursor.
The Pro version of SketchUp can import files via the UI manually, or via Ruby with
Model.import()
-
-
Wooow what a cool forum to ask question. Thank you so much!
Yes im using mac. Im confortable with C++, Obj-C, C, but not ruby at the moment. It would be nice if i have a chance to use something alternative to ruby.
As far as i understand Autocad stores file location and some meta data related to temporary file at memory for clipboard copy op. Currently i don't have Autocad installed on my machine and i could not tested or conformed this info.
Thank you!
What's next?
-
I dont know where my replays are going?
-
What's next ??
Well, guess what? Ruby is itself written in C. So you can write extensions to Ruby in C. And plugins in Ruby are really also Ruby extensions.
See the last post in the [ Code Snippets ] sticky topic, for an index to C/C++ Ruby extensions topics, examples etc..
-
@trxsi said:
I dont know where my replays are going?
New users need to have replies approved to limit spam posts. You should be all set to post now.
Also, the dxf -> ruby lib on bitbucket is by me, so let me know if you have any questions.
-
Been wondering if anything ever happened with this or if there is something out there now that can do this. would love to just copy/past from autocad to sketchup.
thanks,
bob -
@dan rathbun said:
Pasting can done cross-platform with:
Sketchup.send_action("paste:")
Hmmmm, makes one wonder how many other send_action commands there are that are not in the API?
-
See Jim's list here.
http://sketchucation.com/forums/viewtopic.php?t=34840#p374097There are a few more perhaps added since then.
Advertisement