Cad#
Geometric geometric_forms#
Geometric Forms#
This module contains functions to generate and manipulate basic geometric forms using PyVista. These forms can be used for visualization and analysis in various engineering and physics simulations. The functions in this module provide simple representations of common mechanical components such as control arms, tubes, cylinders, spheres, springs, and other structures.
Each function creates geometric shapes by connecting specified points in 3D space, allowing users to model complex systems efficiently. These forms can be used to build assemblies or test various configurations, making them useful for mechanical simulations, 3D modeling, and CAD systems.
The generated shapes are returned as pv.MultiBlock objects, which allow for efficient handling and visualization of multiple geometric forms in a single structure.
These functions provide an easy way to generate basic geometric components for more complex 3D models.
- pymycar.Cad.geometric_forms.control_arm(uca_front, uca_rear, uca_outer_i, radius=10, resolution=100, n_sides=10)[source]#
Generate a control arm.
- Parameters:
- uca_frontarray-like
Coordinates of the front point of the control arm.
- uca_reararray-like
Coordinates of the rear point of the control arm.
- uca_outer_iarray-like
Coordinates of the outer point of the control arm.
- radiusfloat, optional
Radius of the Tubes, by default 10.
- resolutionint, optional
Resolution of the Tubes, by default 100.
- n_sidesint, optional
Number of sides of the Tubes, by default 10.
- Returns:
- pv.MultiBlock
MultiBlock containing two Tubes representing the control arm.
Notes
The control arm is formed by two Tubes connecting the front and rear points to the outer point.
- pymycar.Cad.geometric_forms.rocked(rocked_pivot, l_spring_mount, push_rod_inner_i)[source]#
Generate a structure with tubes connecting various points.
- Parameters:
- rocked_pivotarray-like
Coordinates of the rocked pivot point.
- l_spring_mountarray-like
Coordinates of the lower mounting point of the spring.
- push_rod_inner_iarray-like
Coordinates of the inner point of the push rod.
- Returns:
- pv.MultiBlock
MultiBlock containing three Tubes representing the structure.
Notes
The structure is formed by three Tubes connecting various points.
- pymycar.Cad.geometric_forms.simple_cylinder(wheel_center_i, height, radius)[source]#
Generate a simple cylinder.
- Parameters:
- wheel_center_iarray-like
Coordinates of the center of the cylinder.
- heightfloat
Height of the cylinder.
- radiusfloat
Radius of the cylinder.
- Returns:
- pv.MultiBlock
MultiBlock containing a Cylinder representing the simple cylinder.
Notes
The simple cylinder is a Cylinder centered at the specified point with the given height and radius.
- pymycar.Cad.geometric_forms.simple_sphere(wheel_center_i, radius)[source]#
Generate a simple sphere.
- Parameters:
- wheel_center_iarray-like
Coordinates of the center of the sphere.
- radiusfloat
Radius of the sphere.
- Returns:
- pv.MultiBlock
MultiBlock containing a Sphere representing the simple sphere.
Notes
The simple sphere is a Sphere centered at the specified point with the given radius.
- pymycar.Cad.geometric_forms.simple_tube(tierod_inner, tierod_outer_i, radius=5, resolution=100, n_sides=10)[source]#
Generate a simple tube.
- Parameters:
- tierod_innerarray-like
Coordinates of the inner point of the tube.
- tierod_outer_iarray-like
Coordinates of the outer point of the tube.
- radiusfloat, optional
Radius of the Tube, by default 10.
- resolutionint, optional
Resolution of the Tube, by default 100.
- n_sidesint, optional
Number of sides of the Tube, by default 10.
- Returns:
- pv.MultiBlock
MultiBlock containing a Tube representing the simple tube.
Notes
The simple tube is formed by a single Tube connecting the inner and outer points.
- pymycar.Cad.geometric_forms.spring(u_spring_mount, l_spring_mount_i, radius=5)[source]#
Generate a spring.
- Parameters:
- u_spring_mountarray-like
Coordinates of the upper mounting point of the spring.
- l_spring_mount_iarray-like
Coordinates of the lower mounting point of the spring.
- radiusfloat, optional
Radius of the Spheres and the Tube, by default 10.
- Returns:
- pv.MultiBlock
MultiBlock containing two Spheres and a Tube representing the spring.
Notes
The spring is formed by two Spheres at the upper and lower mounting points and a Tube connecting them.
- pymycar.Cad.geometric_forms.spring_old(u_spring_mount, l_spring_mount, radius=10, coil_radius=10, n_coils=1, n_points=1000)[source]#
Generate a spring.
- Parameters:
- u_spring_mountarray-like
Coordinates of the upper mounting point of the spring.
- l_spring_mountarray-like
Coordinates of the lower mounting point of the spring.
- radiusfloat, optional
Radius of the Spheres, by default 10.
- coil_radiusfloat, optional
Radius of the spring coil, by default 5.
- n_coilsint, optional
Number of coils in the spring, by default 10.
- n_pointsint, optional
Number of points to represent the spring coil, by default 100.
- Returns:
- pv.MultiBlock
MultiBlock containing two Spheres and a Helix representing the spring.
Notes
The spring is formed by two Spheres at the upper and lower mounting points and a Helix representing the spring coil.
Chassis#
Formula#
- pymycar.Cad.Chassis.formula.model_A(front_axle_to_com=1500, rear_axle_to_com=822.5, front_track=750.0, rear_track=822.5, com_height=400.0, roll=0, pitch=0, yaw=0, x=0, y=0, z=0) MultiBlock[source]#
Generate a 3D model of a Formula vehicle chassis.
# --- #--------------------------- | | # | | | # ------------ | | # | | | #----------- CoG A ----B-----|C| # | * * * |*| #----------- ----------| | # | | | # ------------ | | # | | | #--------------------------- | | # ---
- Parameters:
- front_axle_to_comfloat, optional
Distance from the front axle to the center of mass (CoM).
- rear_axle_to_comfloat, optional
Distance from the rear axle to the center of mass (CoM).
- front_trackfloat, optional
Front track width.
- rear_trackfloat, optional
Rear track width.
- com_heightfloat, optional
Height of the center of mass (CoM).
- rollfloat, optional
Roll angle in radians.
- pitchfloat, optional
Pitch angle in radians.
- yawfloat, optional
Yaw angle in radians.
- xfloat, optional
X-coordinate of the center of mass (CoM).
- yfloat, optional
Y-coordinate of the center of mass (CoM).
- zfloat, optional
Z-coordinate of the center of mass (CoM).
- Returns:
- pv.MultiBlock
MultiBlock containing the chassis components.
Notes
The model consists of multiple boxes representing different parts of the vehicle chassis.
- pymycar.Cad.Chassis.formula.model_B(front_axle_to_com=1500, rear_axle_to_com=822.5, front_track=750.0, rear_track=822.5, com_height=400.0, roll=0, pitch=0, yaw=0, x=0, y=0, z=0) MultiBlock[source]#
Generate a 3D model of a different Formula vehicle chassis.
- Parameters:
- front_axle_to_comfloat, optional
Distance from the front axle to the center of mass (CoM).
- rear_axle_to_comfloat, optional
Distance from the rear axle to the center of mass (CoM).
- front_trackfloat, optional
Front track width.
- rear_trackfloat, optional
Rear track width.
- com_heightfloat, optional
Height of the center of mass (CoM).
- rollfloat, optional
Roll angle in radians.
- pitchfloat, optional
Pitch angle in radians.
- yawfloat, optional
Yaw angle in radians.
- xfloat, optional
X-coordinate of the center of mass (CoM).
- yfloat, optional
Y-coordinate of the center of mass (CoM).
- zfloat, optional
Z-coordinate of the center of mass (CoM).
- Returns:
- pv.MultiBlock
MultiBlock containing the chassis components.
Notes
The model consists of multiple boxes representing different parts of the vehicle chassis.
Tourist#
- pymycar.Cad.Chassis.tourist.model_A(front_axle_to_com=822.5, rear_axle_to_com=822.5, front_track=822.5, rear_track=822.5, com_height=600.0, roll=0, pitch=0, yaw=0, x=0, y=0, z=0) MultiBlock[source]#
Generate a 3D model of a vehicle chassis.
# <---------- d2 ---------> # # ------------------------- # | | # h2 | *p1 | # | | # --------------- | # h1 | cog | # | * (x,y,z) | # | | # --------------------------------------- # <------------------ d1 ---------------> #
- Parameters:
- front_axle_to_comfloat, optional
Distance from the front axle to the center of mass (CoM).
- rear_axle_to_comfloat, optional
Distance from the rear axle to the center of mass (CoM).
- front_trackfloat, optional
Front track width.
- rear_trackfloat, optional
Rear track width.
- com_heightfloat, optional
Height of the center of mass (CoM).
- rollfloat, optional
Roll angle in radians.
- pitchfloat, optional
Pitch angle in radians.
- yawfloat, optional
Yaw angle in radians.
- xfloat, optional
X-coordinate of the center of mass (CoM).
- yfloat, optional
Y-coordinate of the center of mass (CoM).
- zfloat, optional
Z-coordinate of the center of mass (CoM).
- Returns:
- pv.MultiBlock
MultiBlock containing the chassis, cabin, and rear wheel.
Notes
The model consists of a chassis, a cabin, and a rear wheel, all represented as 3D geometric shapes.
Suspension#
Double Wishbone Visualization#
This module provides utilities for visualizing a double wishbone suspension system using PyVista. It includes functions to construct the CAD representation of the system components such as control arms, wheel, springs, and other suspension parts.
- pymycar.Cad.Suspension.double_whisbone.whisbone_cad_base(data, index=None)[source]#
Generates the base components of the suspension system.
- Parameters:
- datadict
Dictionary containing suspension geometry data.
- indexint
Index of the current data point.
- Returns:
- tuple
A tuple containing: - upper_control_arm : pyvista.PolyData - lower_control_arm : pyvista.PolyData - direction : pyvista.PolyData - wheel_center : pyvista.PolyData
- pymycar.Cad.Suspension.double_whisbone.whisbone_cad_configuration_1(data, index=None)[source]#
Creates a suspension system configuration with a spring.
- Parameters:
- datadict
Dictionary containing suspension geometry data.
- indexint
Index of the current data point.
- Returns:
- tuple
A tuple containing: - upper_control_arm : pyvista.PolyData - lower_control_arm : pyvista.PolyData - direction : pyvista.PolyData - wheel_center : pyvista.PolyData - spring_o : pyvista.PolyData
- pymycar.Cad.Suspension.double_whisbone.whisbone_cad_configuration_2(data, index=None)[source]#
Creates a suspension system configuration with a rocker, push rod, and spring.
- Parameters:
- datadict
Dictionary containing suspension geometry data.
- indexint
Index of the current data point.
- Returns:
- tuple
A tuple containing: - upper_control_arm : pyvista.PolyData - lower_control_arm : pyvista.PolyData - direction : pyvista.PolyData - wheel_center : pyvista.PolyData - spring_o : pyvista.PolyData - push_rod : pyvista.PolyData - rocked_o : pyvista.PolyData
Tourist#
- pymycar.Cad.Chassis.tourist.model_A(front_axle_to_com=822.5, rear_axle_to_com=822.5, front_track=822.5, rear_track=822.5, com_height=600.0, roll=0, pitch=0, yaw=0, x=0, y=0, z=0) MultiBlock[source]#
Generate a 3D model of a vehicle chassis.
# <---------- d2 ---------> # # ------------------------- # | | # h2 | *p1 | # | | # --------------- | # h1 | cog | # | * (x,y,z) | # | | # --------------------------------------- # <------------------ d1 ---------------> #
- Parameters:
- front_axle_to_comfloat, optional
Distance from the front axle to the center of mass (CoM).
- rear_axle_to_comfloat, optional
Distance from the rear axle to the center of mass (CoM).
- front_trackfloat, optional
Front track width.
- rear_trackfloat, optional
Rear track width.
- com_heightfloat, optional
Height of the center of mass (CoM).
- rollfloat, optional
Roll angle in radians.
- pitchfloat, optional
Pitch angle in radians.
- yawfloat, optional
Yaw angle in radians.
- xfloat, optional
X-coordinate of the center of mass (CoM).
- yfloat, optional
Y-coordinate of the center of mass (CoM).
- zfloat, optional
Z-coordinate of the center of mass (CoM).
- Returns:
- pv.MultiBlock
MultiBlock containing the chassis, cabin, and rear wheel.
Notes
The model consists of a chassis, a cabin, and a rear wheel, all represented as 3D geometric shapes.