i want to move component to the new position(new_component_pos). but the component is upside-down.
new_component_instance.move! Geom::Transformation.new(new_component_pos - new_component_instance.transformation.origin)
i want to move component to the new position(new_component_pos). but the component is upside-down.
new_component_instance.move! Geom::Transformation.new(new_component_pos - new_component_instance.transformation.origin)
There are two ways to use transformations. They can be used as:
The “move!” method replaces the entities transformation with the supplied argument. Taking the difference between two positions results in a vector, and the transformation you create is a translate. The translate is more of a relative operation. You are replacing the object’s position with the difference between two positions. It would descale, de-rotate, and the transformation’s origin would be position of the entity. In addition, “move!” does not support edit undo: Below are three options for grouped objects:
translate = Geom::Transformation.new(new_component_pos - new_component_instance.transformation.origin)
new_component_instance.move! translate * new_component_instance.transformation
translate = Geom::Transformation.new(new_component_pos - new_component_instance.transformation.origin)
new_component_instance.transformation = translate * new_component_instance.transformation
translate = Geom::Transformation.new(new_component_pos - new_component_instance.transformation.origin)
new_component_instance.transform! translate
new_component_instance.tranform! Geom::Transformation.new(
new_component_instance.transformation.origin.vector_to(new_component_pos)
)
thank you. your answer is very helpful for me.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.