Automating Sketchup from Excel
-
Hi All,
I'm wondering if anyone has managed to automate Sketchup from Excel. I have a list of components and dimensions thereof in Excel, and I want to click a button in Excel and start Sketchup automatically where a new model is created that inserts dynamic components with the correct dimensions as specified in MS Excel.
I've automated Excel from Sketchup (with Win32OLE), but not managed find a way to automate Sketchup from Excel. Is this possible?
Phil
p.s. Ideally I'd like to avoid the user having to start Sketchup (and run a ruby where they have to pick the Excel file which is then interrogated from a Sketchup ruby)
-
I've done what you've done, created excel sheets from Ruby based on contents of the model.
I suspect you could do what you want to do through VBA. If VBA can kick off a process, then it could kick off SU, and a plugin could be implemented that communicates with your VBA code. Not sure how that would work, perhaps through a pipe.
-
OK. This is what I've come up with:
- Export a file to the users profile (c:\documents and settings) with a standard name.
- Start Sketchup via VBA
- Sketchup has an ruby that checks for the existence of the file created in step 1.
- Create dynamic components according to the contents of the file
- Delete the file so that it's not re-processed next time sketchup is opened.
It's a bit annoying in that the users has to run a further ruby script inside Sketchup because the $dc_observers variable is not setup with the dynamic components are being inserted in step 4.
-
I have a wip that can pick up plain text lists (including Excel .csv files) and open them in a Sketchup model. It can also inspect an existing model and assemble entity names in automated hierarchies, each linking to its data. If interested have a look at the flyer linked below and let me know me what think.
-
@filcole said:
It's a bit annoying in that the users has to run a further ruby script inside Sketchup because the $dc_observers variable is not setup with the dynamic components are being inserted in step 4.
Your file in step 3/4 should have at the top:
require( 'dynamiccomponents' )
to be sure the DC extension is loaded before your script tries to use or create dynamic components. -
Here's another forum link along these lines:
Excel to SU ( 29/7/08 version ) [has code for download]
Advertisement