Dynamic Components and Glue To
-
I'm not sure if this is the best forum for this, but I'll give it a try...
Does anyone know of a way to have simple dynamic component pull information from it's "glued_to" surface. I think this may really be part of a larger question, which is how to go beyond simple spreadsheet-like formulas in dynamic components to something really useful.
I can think of a way to do this if I can create a number in a ruby file, and then send it to the DC. I have followed the advice from Scott Lininger's post (http://forums.sketchucation.com/viewtopic.php?f=180&t=24241) regarding creating dynamic components in ruby. First, no mater what I enter for units, the dynamic component units are the default text. Second, once I have created the variable, if I change the units in the DC attributes editor, I can't change it using ruby code by simply saying x.set_attribute.
Any ideas?
Thanks,
--
Karen -
@kwalkerman said:
Does anyone know of a way to have simple dynamic component pull information from it's "glued_to" surface.
Yes it's the correct forum.
@unknownuser said:
(http://code.google.com/apis/sketchup/docs/ourdoc/componentinstance.html#glued_to)":257d4pve]The glued_to method is used to retrieve the entity that this instance is glued to.
So once you have the 'gluee' entity reference, you'd use that object's methods to gain information, likely starting with gluee.class which should probably be a Sketchup::Face.
-
If your asking about automation... we have a problem at present.
Both the DefinitionObserver and InstanceObserver classes are bugged.
You should monitor ThomThom's topic "State of Observers"
http://forums.sketchucation.com/viewtopic.php?f=180&t=20676 (bookmark it..)Once the DefinitionObserver is fixed, you could then implement an onGlue method, that could update attributes in a component's dictionary.
Right now you'd have to use some other working Observer to fire a polling type method, that iterates Instances, and checks their glued_to value. Then do whatever, depending on the value, or if it changed (which means YOU would have to keep a Hash of "glued to object" values for Instances of interest.)
-
Dan,
I have been watching ThomThom's "state of observers" forum. And (assuming all observers are working correctly), I can think of some ways to use observers to 'watch' entities and feed information back to a ruby script, which does some calculations. The real problem is in the DC interface. I was hoping that someone here knew an unpublished way to access information about components that we can get using ruby code, directly in the DC interface.
--
Karen -
@kwalkerman said:
The real problem is in the DC interface.
Your not the first to have wishes of a custom DC Manager dialog.
@kwalkerman said:
I was hoping that someone here knew an unpublished way to access information about components that we can get using ruby code, directly in the DC interface.
I've also seen others suggest embedded Ruby macros, inside a DC.
I'll put this subject on my list of many things to look into. (I have considered a DC Tech Reference as a possible project, as the API does not cover them.)
-
A DC tech reference would be pretty awesome. Thanks!
--
Karen
Advertisement