Tuesday, November 28, 2023
Home3D ModelingLearn how to transfer a gaggle with entities to world origin -...

Learn how to transfer a gaggle with entities to world origin – Ruby API


hello guyes
I create a gaggle and add to group face

group1 = entities.add_group
face = group1.definition.entities.add_face(f[0], f[1], f[2], f[3])

Subsequent I’ll rotate every little thing on this group

[X_AXIS, Y_AXIS].every 
   if not face.regular.samedirection?(Z_AXIS)
      if face.regular.perpendicular?(axis)
        angle = face.regular.angle_between(axis)
        angle = 180 - (angle * 180 / Math::PI)
        rotation = Geom::Transformation.rotation(group1.bounds.middle, axis, angle.levels)
        group1.entities.transform_entities(rotation, group1.entities.to_a)
      finish
   finish

Subsequent I want to maneuver every little thing to the origin of worldwide coordinates. Learn how to do it?
group1.transformation.origin have zero coordinats, however group1 is just not at zero.
learn how to transfer a gaggle or its contents to a different location?

Why are you rotating the entities of the group and never the group as an entire ?

If i rotating the group, I will be unable to find out the course vector of the face contained in the group, coordinates can be previous, contained in the group, the native coordinate system is used as within the Elements

After rotating the group (as an entire) you need to be capable to get the traditional vector course of the face:

face_global_normal = face.regular.rework(group1.transformation)

However this assumes that the present enhancing context is the highest stage mannequin entities and that group1 is a entity baby on this context.



1 Like

It actually works with the face and I rotated the group as I wanted.
Now group1.transformation.origin exhibits coordinates, however these coordinates has nothing to do with the true ones. If I rebuild the group of those entities manually group1.transformation.origin present me actual world coordinats. Why is that this and learn how to remedy it?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments