Changing Components in a website
-
I did already find that part.....
What I am really after is how to have components residing on a webserver somewhere that can be changed on the server via a web interface, and then after the user has made their selections, they can be loaded into Sketchup...
-
That is not possible exactly.
They can not be changed outside of SketchUp. But you could stick it onto the users SketchUp as a definition but not place it in the model (so like a component that would be purged - its in the file, but not placed anywhere in the model). Then once its in, the user would be able to change it through interacting with your web dialog. I'm pretty sure that is how it has to happen.
Or you could create every possible iteration that you web dialog makes possible and just have the user download the correct iteration.
Chris
-
Having every possible iteration of a component available for download is impossible. One of my simpler components would have over 2 million different versions!!
According to the owner of engineering toolbox, he has figured out a way to change these components outside of Sketchup....
You should try the plugin out, perhaps I am missing something...
Would the Sketchup reader and writer SDK allow you to do this? (I know they are meant for writing importers and exporters....)
-
Interesting. If he is doing it ouitside of SU, then it sounds like he is opening the .skp file in some otherapplication and doing it there. Which seems odd.
Is there a reason you can't load the model invisibly into the users computer and then manipulate it there?
Chris
-
It's not done on the server - the server just sends the Ruby code to SketchUp where the code is executed to create the component.
The server-side application builds the Ruby code from your selections.
-
Ahh, that makes sense....
Would there be a way for this to work with Dynamic Components?
I would like the user to be able to select a DC from a website, configure options that were built into the DC, and then have it delivered to sketchup as a "dumb" component.....
-
Does it really need to be dynamic using the existing dynamic tools? I don't think you could 100% safely put the dynamic component into the SU as completely hidden, change the attributes, explode it, and then show it.
I think during that process they would proabably be able to figure out a way to save the component out as dynamic if they really wanted to.
But you could program the component through ruby in such a way that they do not really ever get any dynamic component, but a bunch of non-dynamic blocks that your ruby assembles as desired.
I think it works. How big of a deal is it for the user to not get their hands on your dynamic component?
Chris
-
Well, you don't want this to work with DC since you want a "dumb" component.
What I imagine you want is, the website let you pick and select the various combinations of components - then send the configuration data to ruby which load each component and assemble them into the arrangements specified.
-
So you have on your server all the component parts. Plain "dumb" components - not DC's.
Then you set up a list of various combinations - url to component, position and scale.
That configuration is sent to ruby, which loads all the parts using the URL given, and then position and scale it. -
I think I understand what your saying, the downside for me would be creating each component using a ruby script, rather then the built in DC process. I would think that would make life difficult for me, as I would want to add, and change all the components on the website with ease....
I would, if possible, have a nice DC sitting on the server, that I was able to create and test in my local Sketchup. The user would be able to configure it on the website, and then have it inserted as say a "dumb" su6 component...
-
Unfortunately, the server can not do that as it would require the server being able to open Sketchup and run ruby scripts and open components all on its own.
And if you plan on using a DC, you still have to rebuild the entire Dynamic Component Ruby script, since you will not be able to use it. So all the menus and such?, you will have to interpert that into your script. I think the DC route is considerably more complicated.
Do you have any actual real world examples you are allowed to share?
Chris
-
If you want to talk about possibilities - it is possible using the SDK (not Ruby API) to write a server-side program that manipulates .skp files directly before sending them to SketchUp. That's beyond my knowledge at the moment.
Another possibility is to send the full-featured component to SketchUp and dumb it down as soon as it is imported.
Another possibility would be to send a blank "DC" component, and then build up the dynamic attributes from the user's options. (by blank, I mean devoid of dynamic attributes, not devoid of geometry.)
(I'm using "send" rather loosely - the actual sequence would be closer to: user selects options in a WebDialog, then hits "Get Component" button. Server sends a message to Sketchup saying "import a component from this location: here. Finally, SU responds to the message by importing the component.)
-
All of a DC's Dynamic parts are stored as strings in an attribute dictionary. You can create a complete dynamic component using Ruby .set_attribute if you know the correct strings to write.
-
Question is, how are you expecting this to work for you, as the designer of the components? Are you looking for something that let you just create a DC and have the server read and interpret how the DC is configured and offer a custom UI to the user of the website that will in return build a "dumb" component?
Advertisement