Sketchup's API and Ruby
-
my question:
Is it possible to extract the "drawing zone" from sketchup and then, use it somewhere else using Ruby and Sketchup's API?
Id like to insert the drawing zone in a selfmade form....... and use it code behind with Ruby. Or, remove all from the original sketchup's main screen.....menus, toolbars and the rest.
first: is it possible ?
if yes, how can i do ?thanks
PL -
First of all you should ask yourself if it's legal
-
I have done it. But its tricky and windows only. First I used windows messages to remove all the Sketchup UI elements leaving you with just a bare window. Then I used a C# app to grab that window and set its parent to be a panel in a form. It worked pretty well. But that was as far as I took it.
-
mmm, legal, it's not.
but im tricky for school.... possible to fit the "drawing zone" into a webdialog ?
... is there any "transparency" property for a webdialog?i suppose the best way ("or the easy way") is a floating webdialog as a control bar
over a naked sketchup original window.control bar connected to Ruby functions.
-
To share, this is a post i found about it (by cphillips)
Additionnal stuff:
http://www.suwiki.org/suwiki/index.php?title=Ruby_Tutorial_-Dialog_Boxes_and_WIN32API%28Advanced%29the Win32API.so link below wont work
you can get Win32API.so from there
After you install ruby into a folder, say c:\RUBY, then Win32Api.so will be in
c:\RUBY\lib\ruby\1.8\i386-mswin32the original post:
http://groups.google.com/group/Ruby-API/browse_thread/thread/52ade11766148a57-The function is called "cleanSlate()".
-It will remove all the menus and the window boarder.
-You need to manually disable any toolbars you dont want.
-Requires win32API.so lib(attached).NOTES:
-It works by looking for a window named "Sketchup - Untitled".
Therefore it will only work when no model is loaded. You could change
this by editing the ruby.
-It wont fully work at startup because the "Plugins" menu gets created
after the cleanSlate() function is run.Enjoy
Chris
http://groups.google.com/group/sketchup-Pro-Groups/web/win32API.so
http://groups.google.com/group/sketchup-Pro-Groups/web/cleanSlate.rb<code>
require "sketchup.rb"
require "Win32API"def cleanSlate()
#setup win32 calls.
findWindow=Win32API.new("user32.dll", "FindWindow", ['P','P'], 'N')
sendMessage=Win32API.new("user32.dll", "SendMessage",['N','N','N','P'], 'N')
getMenu=Win32API.new("user32.dll", "GetMenu", ['N'], 'N')
getMenuItemCount=Win32API.new("user32.dll", "GetMenuItemCount",['N'], 'N')
getSubMenu=Win32API.new("user32.dll", "GetSubMenu", ['N','N'], 'N')
deleteMenu=Win32API.new("user32.dll", "DeleteMenu", ['N','N','N',],'N')
drawMenuBar=Win32API.new("user32.dll", "DrawMenuBar", ['N'], 'N')
setWindowLong=Win32API.new("user32.dll", "SetWindowLong",['N','N','N'], 'N')#find the sketchup window pw=findWindow.call(0,"Untitled - Sketchup") #remove the menu menu=getMenu.call(pw) while(getMenuItemCount.call(menu)>0) menu=getMenu.call(pw) deleteMenu.call(menu,0,0x400) drawMenuBar.call(menu) end #force the layout to update. sendMessage.call(pw,0x0047,0,"") #remove the window boarders setWindowLong.call(pw,-16,0x00800000|0x10000000|0x00080000|0x00040000)
end
</code>
Advertisement