JWock82 / JWock82/Pynite

Visualize Local Coordinate Systems on Members in Finite Element Model Visualization

Open
#190 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
743
Forks
150
Avg merge
6d 1h
Merged PRs (30d)
2

Description

Currently, I am working with standards that have predefined coordinate systems with the Y-axis pointing upwards. This specific orientation is critical for our analyses and understanding of structural behavior according to these standards. However, our current visualization tool lacks the functionality to explicitly display local coordinate systems for each member according to this convention. This limitation makes it challenging to ensure that all members are correctly oriented as per the standards, potentially leading to errors in analysis or interpretation.

I know we should follow the pynite conventions for local coordinate systems:
https://pynite.readthedocs.io/en/latest/member.html

I propose the addition of a feature that allows for the visualization of local coordinate systems for each member within the finite element model. This feature would visually represent the local X, Y, and Z axes at an appropriate point (such as the midpoint), with distinct colors for each axis (e.g., red for X, green for Y, blue for Z) to clearly indicate directionality. There should be options to customize the length of these axes for clear visibility without overwhelming the model's appearance, and the ability to toggle this display feature on or off as needed by the user.

maybe we can update the renderer?

```
renderer.show_local_coordinate = true
```
Small code idea to kickstart the feature:
```
def plot_member_coordinate_system(self, member):
# Midpoint calculation and axis direction determination is done here
midpoint = [(member.i_node.X + member.j_node.X) / 2,
(member.i_node.Y + member.j_node.Y) / 2,
(member.i_node.Z + member.j_node.Z) / 2]

# Directions for local axes
local_x_direction = [member.j_node.X - member.i_node.X,
member.j_node.Y - member.i_node.Y,
member.j_node.Z - member.i_node.Z]

local_z_direction = [0, 0, 1] # Always horizontal

# Calculate local_y_direction using cross product of x and z directions
local_y_direction = [
local_x_direction[1] * local_z_direction[2] - local_x_direction[2] * local_z_direction[1],
local_x_direction[2] * local_z_direction[0] - local_x_direction[0] * local_z_direction[2],
local_x_direction[0] * local_z_direction[1] - local_x_direction[1] * local_z_direction[0]
]

# Size of coordinate system
axis_length = 1
```

A quick example of what it could look like:
![image](https://github.com/JWock82/PyNite/assets/37536594/d033dfef-2d48-42b3-9e38-8f1974c74605)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.