2121# SOFTWARE.
2222"""Provides for creating and managing a beam."""
2323
24+ from enum import Enum
2425from typing import TYPE_CHECKING
2526
2627from ansys .geometry .core .math .point import Point3D
3031
3132if TYPE_CHECKING : # pragma: no cover
3233 from ansys .geometry .core .designer .component import Component
34+ from ansys .geometry .core .designer .part import Part
35+ from ansys .geometry .core .materials .material import Material
36+ from ansys .geometry .core .math .frame import Frame
37+ from ansys .geometry .core .shapes .curves .trimmed_curve import TrimmedCurve
38+ from ansys .geometry .core .shapes .parameterization import ParamUV
39+
40+
41+ class BeamType (Enum ):
42+ """Provides values for the beam types supported."""
43+
44+ BEAM = 0
45+ SPRING = 1
46+ LINK_TRUSS = 2
47+ CABLE = 3
48+ PIPE = 4
49+ THERMALFLUID = 5
50+ UNKNOWN = 6
51+
52+
53+ class SectionAnchorType (Enum ):
54+ """Provides values for the section anchor types supported."""
55+
56+ CENTROID = 0
57+ SHEAR_CENTER = 1
58+ ANCHOR_LOCATION = 2
3359
3460
3561class BeamProfile :
@@ -66,7 +92,6 @@ def name(self) -> str:
6692 """Name of the beam profile."""
6793 return self ._name
6894
69-
7095class BeamCircularProfile (BeamProfile ):
7196 """Represents a single circular beam profile.
7297
@@ -145,6 +170,162 @@ def __repr__(self) -> str:
145170 return "\n " .join (lines )
146171
147172
173+ class BeamCrossSectionInfo :
174+ """Represents the cross-section information for a beam.
175+
176+ Parameters
177+ ----------
178+ section_anchor : SectionAnchorType
179+ Specifies how the beam section is anchored to the beam path.
180+ section_angle : float
181+ The rotation angle of the cross section clockwise from the default perpendicular of the
182+ beam path.
183+ section_frame : Frame
184+ The section frame at the start of the beam.
185+ section_profile : BeamProfile
186+ The section profile in the XY plane.
187+ """
188+
189+ def __init__ (
190+ self ,
191+ section_anchor : SectionAnchorType ,
192+ section_angle : float ,
193+ section_frame : Frame ,
194+ section_profile : BeamProfile ,
195+ ):
196+ """Initialize ``BeamCrossSectionInfo`` class."""
197+ check_type (section_anchor , SectionAnchorType )
198+ check_type (section_angle , float )
199+ check_type (section_frame , Frame )
200+ check_type (section_profile , BeamProfile )
201+
202+ self ._section_anchor = section_anchor
203+ self ._section_angle = section_angle
204+ self ._section_frame = section_frame
205+ self ._section_profile = section_profile
206+
207+ @property
208+ def section_anchor (self ) -> SectionAnchorType :
209+ """Specifies how the beam section is anchored to the beam path."""
210+ return self ._section_anchor
211+
212+ @property
213+ def section_angle (self ) -> float :
214+ """The rotation angle of the cross section clockwise from the default perpendicular of the beam path."""
215+ return self ._section_angle
216+
217+ @property
218+ def section_frame (self ) -> Frame :
219+ """The section frame at the start of the beam."""
220+ return self ._section_frame
221+
222+ @property
223+ def section_profile (self ) -> BeamProfile :
224+ """The section profile in the XY plane."""
225+ return self ._section_profile
226+
227+ def __repr__ (self ) -> str :
228+ """Represent the ``BeamCrossSectionInfo`` as a string."""
229+ lines = [f"ansys.geometry.core.designer.BeamCrossSectionInfo { hex (id (self ))} " ]
230+ lines .append (f" Section Anchor : { self .section_anchor .name } " )
231+ lines .append (f" Section Angle : { self .section_angle } " )
232+ lines .append (f" Section Frame : { self .section_frame } " )
233+ lines .extend (["\n " , " Section Profile info" , " -------------------" , str (self .section_profile )])
234+ return "\n " .join (lines )
235+
236+ class BeamProperties :
237+ """Represents the properties of a beam.
238+
239+ Parameters
240+ ----------
241+ area : float
242+ The cross-sectional area of the beam.
243+ centroid : ParamUV
244+ The centroid of the beam section.
245+ warping_constant : float
246+ The warping constant of the beam.
247+ ixx : float
248+ The moment of inertia about the x-axis.
249+ ixy : float
250+ The product of inertia.
251+ iyy : float
252+ The moment of inertia about the y-axis.
253+ shear_center : ParamUV
254+ The shear center of the beam.
255+ torsion_constant : float
256+ The torsion constant of the beam.
257+ """
258+
259+ def __init__ (
260+ self ,
261+ area : float ,
262+ centroid : ParamUV ,
263+ warping_constant : float ,
264+ ixx : float ,
265+ ixy : float ,
266+ iyy : float ,
267+ shear_center : ParamUV ,
268+ torsion_constant : float ,
269+ ):
270+ """Initialize ``BeamProperties`` class."""
271+ check_type (area , float )
272+ check_type (centroid , ParamUV )
273+ check_type (warping_constant , float )
274+ check_type (ixx , float )
275+ check_type (ixy , float )
276+ check_type (iyy , float )
277+ check_type (shear_center , ParamUV )
278+ check_type (torsion_constant , float )
279+
280+ self ._area = area
281+ self ._centroid = centroid
282+ self ._warping_constant = warping_constant
283+ self ._ixx = ixx
284+ self ._ixy = ixy
285+ self ._iyy = iyy
286+ self ._shear_center = shear_center
287+ self ._torsion_constant = torsion_constant
288+
289+ @property
290+ def area (self ) -> float :
291+ """The cross-sectional area of the beam."""
292+ return self ._area
293+
294+ @property
295+ def centroid (self ) -> ParamUV :
296+ """The centroid of the beam section."""
297+ return self ._centroid
298+
299+ @property
300+ def warping_constant (self ) -> float :
301+ """The warping constant of the beam."""
302+ return self ._warping_constant
303+
304+ @property
305+ def ixx (self ) -> float :
306+ """The moment of inertia about the x-axis."""
307+ return self ._ixx
308+
309+ @property
310+ def ixy (self ) -> float :
311+ """The product of inertia."""
312+ return self ._ixy
313+
314+ @property
315+ def iyy (self ) -> float :
316+ """The moment of inertia about the y-axis."""
317+ return self ._iyy
318+
319+ @property
320+ def shear_center (self ) -> ParamUV :
321+ """The shear center of the beam."""
322+ return self ._shear_center
323+
324+ @property
325+ def torsion_constant (self ) -> float :
326+ """The torsion constant of the beam."""
327+ return self ._torsion_constant
328+
148329class Beam :
149330 """Represents a simplified solid body with an assigned 2D cross-section.
150331
@@ -172,7 +353,17 @@ def __init__(
172353 start : Point3D ,
173354 end : Point3D ,
174355 profile : BeamProfile ,
175- parent_component : "Component" ,
356+ parent_component : Component ,
357+ name : str = None ,
358+ is_deleted : bool = False ,
359+ is_reversed : bool = False ,
360+ is_rigid : bool = False ,
361+ material : Material = None ,
362+ cross_section : BeamCrossSectionInfo = None ,
363+ properties : BeamProperties = None ,
364+ shape : TrimmedCurve = None ,
365+ type : BeamType = None ,
366+
176367 ):
177368 """Initialize ``Beam`` class."""
178369 from ansys .geometry .core .designer .component import Component
@@ -189,6 +380,16 @@ def __init__(
189380 self ._profile = profile
190381 self ._parent_component = parent_component
191382 self ._is_alive = True
383+ self ._name = name
384+ self ._id = id
385+ self ._is_deleted = is_deleted
386+ self ._is_reversed = is_reversed
387+ self ._is_rigid = is_rigid
388+ self ._material = material
389+ self ._cross_section = cross_section
390+ self ._properties = properties
391+ self ._shape = shape
392+ self ._type = type
192393
193394 @property
194395 def id (self ) -> str :
0 commit comments