Align to Floor - Complete Documentation¶
PLACE IMAGE OF THE SIDEBAR PANEL WITH THE "Place Face(s) on Floor" OPTION IN FOCUS HERE
The "Align to Floor" tool in DAMTools allows rotating and translating an object so that the selected face touches the Z=0 plane and points downwards, facilitating the preparation of models for 3D printing, visualization, or physical simulation.
Index¶
- What is Align to Floor?
- Workflow
- Shortcuts and Access
- Functionality Explanation
- Face Selection in Edit Mode
- Rotation and Translation Calculation
- Threshold and Safety Support
- Key Code Snippets
- Suggested Images
What is Align to Floor?¶
It allows selecting one or more faces of an object in edit mode and rotating the object so that the average normal of those faces points towards -Z, translating the object so that the face touches the Z=0 plane.
PLACE IMAGE OF THE OBJECT BEFORE AND AFTER USING "Place Face(s) on Floor" HERE
Workflow¶
- Select a mesh object and enter edit mode.
- Select one or more faces you want to align to the floor.
- Activate the "Place Face(s) on Floor" operator from the sidebar panel or pie menu.
- The object is automatically rotated and translated.
PLACE GIF OR IMAGE SEQUENCE OF THE ALIGN TO FLOOR WORKFLOW HERE
Shortcuts and Access¶
- DAMTools Sidebar Panel: "Place Face(s) on Floor" option.
- DAMTools Pie Menu (Shift+W): "Place on Floor" option.
- Operator:
object.place_face_on_floor
Functionality Explanation¶
Face Selection in Edit Mode¶
- Only works in edit mode and with at least one face selected.
- Calculates the average normal and center of the selected faces.
Rotation and Translation Calculation¶
- Rotates the object so that the average normal points to -Z.
- Translates the object so that the lowest point of the selected face touches Z=0.
Threshold and Safety Support¶
- Includes checks for validity of normals, vertices, and operation mode.
- Handles errors and edge cases to prevent incorrect transformations.
Key Code Snippets¶
Normal and Center Calculation¶
def get_selected_faces_data(context):
# Calculates the average normal and center of the selected faces
# Returns (avg_normal_local, avg_center_local, selected_vertices_indices)
Applying Rotation and Translation¶
def execute(self, context):
# ...
# Calculate necessary rotation to align the normal to -Z
# Translate the object so the face touches Z=0
Suggested Images¶
- PLACE IMAGE OF THE SIDEBAR PANEL WITH THE OPTION IN FOCUS
- PLACE GIF OF THE ALIGN TO FLOOR WORKFLOW
- PLACE IMAGE OF THE OBJECT BEFORE AND AFTER USING THE TOOL
- PLACE IMAGE OF THE DAMTools PIE MENU WITH "Place on Floor" IN FOCUS
For technical details and explanation of each file, see the technical documentation in the [DOCUMENTATION] folder.