Question about "open" groups.
-
OK, you're right.
What are you trying to do? Can you use the group's transformation origin and apply that to any translation you need to do for your cpoints?
-
@unknownuser said:
OK, you're right.
What are you trying to do? Can you use the group's transformation origin and apply that to any translation you need to do for your cpoints?
I could if I could get the original transformation. But as I said its set to identity as soon as you open the group.
When I create the group of construction points I set an attribute that has its initial position in the group. Then the user opens the group, manipulates the points and I compare the new position to the position stored in the attribute. It works fine if the group is closed but if it is still open the points are transformed into world space instead of group space so I am comparing apples and oranges.
@jim said:
But the Group's transformation stays the same even if its entities are changed... so what's the point trying to get something you already know? Sorry if I'm missing the obvious.
The groups transform does not stay the same. Not only is the transform zeroed but the location of all the points is world relative instead of group relative. If I have a point at position (1,1,1) in a group when I open the group its position will be (1,1,1) + whatever the transformation.origin of the unopened group is. Not to mention the effects of rotation and scaling.
It seems when you open a group Sketchup transforms all the entities in that group by the groups transform and then sets the group transform to identity.
-
I had a similar issue recently and I simply had to tell the user that the operation he was trying to perform was not allowed while in Group edit. This was because of the bugs dealing with working with groups and being out of context when in group/component edit.
That's the way the ball bounces.
-
@unknownuser said:
I had a similar issue recently and I simply had to tell the user that the operation he was trying to perform was not allowed while in Group edit. This was because of the bugs dealing with working with groups and being out of context when in group/component edit.
That's the way the ball bounces.
Thats disappointing.
Thanks Todd.
-
I found a work around but its a little gross. I don't fully trust observers not to crash Sketchup.
I put a entityObserver on my lattice group and then in onChangeEntity I store the current transformation in an attribute. Then when a user moves a point I check to see if the group is open (via observer) and if so I transform my control points by the inverse of the stored transform. That gives me a group relative point. whew.
Thanks for the help.
Chris -
I figured it out!
If your group is open, get any entity in the group, and do this:
entity.parent.origin
That will give you the origin of the group's transformation. Viola!
Todd
-
@unknownuser said:
I figured it out!
If your group is open, get any entity in the group, and do this:
entity.parent.origin
That will give you the origin of the group's transformation. Viola!
Todd
When I try that the parent is ComponentDefinition and that doesn't have .origin. Did I miss a step?
Chris
-
Oops. Sorry.
entity.parent.insertion_point
Todd
-
@unknownuser said:
Oops. Sorry.
entity.parent.insertion_point
Todd
Ah! That does seem to work. Its only a point though, any way to get the rest of the transformation?
Thanks Todd!
-
My hat of guessing says...
tr = Geom::Transformation.new(entity.parent.insertion_point)
Todd
-
...but I don't think that will take care of any rotation.
-
@unknownuser said:
...but I don't think that will take care of any rotation.
Yeah without rotation it doesn't help. But the observer method seems to be working fine so far.
Chris
-
I did check with Google on this topic yesterday, and they see it as a flaw.
Todd
Advertisement