DC "Flipping" Script
-
Maybe this post would be more at home in the Dynamic Components sub forum?
-
Did Scott outline what a script would need to do?
I'm not all that familiar with DC - especially the scripting communication of it - I'm not immediately aware of what problems and issues there are.What exactly happens when a DC "blows up"?
-
Ok, let me see if I can explain this a little better.
You have a Dynamic component. So lets say you drew a wall cabinet that you want glued to just vertical surfaces (walls). To get the gluing to work correctly, you have to draw your DC on the ground plane, face up. So for a wall cabinet component to glue itself to a vertical surface, and be facing the right way, its Z, or blue axis has to be the "depth" of the wall cabinet.
So far, this is really easy to do. But, DC's are more complicated. You have the main component (the Wall cabinet) and then a ton of sub components. Things like doors, sides, backs, face frames, etc. All of these components reference off of the axis of the main component.
So lets say that I want to take this wall cabinet, and turn it into a base cabinet, because I have spent hours and hours building a wall cabinet. To do this, I need to glue to the floor. Since currently this wall cabinet has its vertical, or blue axis set as the "depth" of the cabinet, when I place it on the floor, it sits on the floor, face up, which is no good. The only way to fix this is to change the axis of the component so that the Z, or blue axis is vertical, or the "height" of the cabinet, rather then the depth. This is all good on "dumb" components, but since every sub component relies on referencing information on the size of the main component, it "blows up" when you change the axis.
The only way to fix this you have to manually swap the formulas in every sub component over and over again. Its really, really tedious, and usually results in errors. What Scott was saying at Basecamp is that its totally possible with the API to create some sort of script that can take a DC, as the user where they want the axis, and "flip" all the formulas that would need to be changed in order to make the DC work again.
Does that make sense?
-
Can you give an example of an formula? Before and after?
-
Ok, so here's a fairly basic DC. If I change the axis of the DC, it "blows up" because all of the formula's are referencing an axis that has changed.
Pull this into your model, and use it to see how it works. Then, right click on it, and change the orientation of the axis and then try to use it again, you'll see what happens.
-
Will look at it.
(Sorry - been a wee bit busy) -
hmm.. are we talking about just flipping, or adjusting axis completely?
Is it swapping X for Y or Z etc? -
Lets say you took the above DC and rotate the axis about the Blue axis. In other words, you switched the direction of the green and red axis, leaving the blue one in the same direction. For the DC not to "Blow up" you'd need to switch every Red axis formula with Green axis references and vica versa, leaving the blue ones alone.
Doing this manually is really tedious and dangerous, even on a simple DC such as this one.
-
Ok - that's an easier scope. Arbitrary change of the axis would appear awfully complex. Even flipping, mirroring appear to be a bit of a problem. But axis swapping should be doable without too much fuzz. (famous last words...?)
-
Ok, I am seeing what you are thinking. Flipping would be awesome, because then, like I said, I could change the gluing plane of DC's without having to rebuild them.
Later on, something that would mirror DC's would be killer, but that's a lot of math to wrap your brain around! (and how do you change small sections of formulas, instead of just swapping them around?)
-
@unknownuser said:
(and how do you change small sections of formulas, instead of just swapping them around?)
That'd be the key problem. To interpret forums. Just seem all too complex.
But let's have a look at swapping axis orientation.
-
That would be really cool if axes could be rotated....
As far as changing snippets of formulas, is it impossible with the API, or just really friggin hard?
-
@unknownuser said:
As far as changing snippets of formulas, is it impossible with the API, or just really friggin hard?
It's easy if you know what to change. But the formula is basically source code and they can appear in so many mutations, you'd have to make the script be able to understand what the formula do, its intention.
-
Ahh ok, but a script that would say go through a change all the "LenX" references to "LenY" references would be fairly easy?
-
Yea - much easier.
But, what about sub-components? If you have multiple depths with components? -
Oh yeah, there are always sub components, that's what makes this so hard to do. If I was just changing top level stuff, the script wouldn't be needed.
-
Yea, but a the sub-components could themselves be DC's - would one have to flip the axis of these as well? Or would things work find if one only processed the first level of sub-components?
-
As far as sub components, it would be any sub components that reference the axis of the most top level component. And sub component that references an axis from another sub component that is below the top level wouldn't need to be changed.
Advertisement