Importing Geometry from CAD

Demonstrates loading Geometry and CompoundGeometry objects from .dxf and .3dm (Rhino) files.

# sphinx_gallery_thumbnail_number = 8

from sectionproperties.pre.geometry import Geometry, CompoundGeometry
from sectionproperties.analysis.section import Section

Load a geometry with a single region from a dxf file

geom = Geometry.from_dxf(dxf_filepath="files/section_holes.dxf")
geom.plot_geometry()
Cross-Section Geometry
<AxesSubplot: title={'center': 'Cross-Section Geometry'}>

Generate a mesh

geom.create_mesh([1])
sec = Section(geom)
sec.plot_mesh(materials=False)
Finite Element Mesh
<AxesSubplot: title={'center': 'Finite Element Mesh'}>

Conduct a geometric & plastic analysis

sec.calculate_geometric_properties()
sec.calculate_plastic_properties()
sec.plot_centroids()
Centroids
<AxesSubplot: title={'center': 'Centroids'}>

Display the geometric & plastic properties

sec.display_results()
     Section Properties
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Property ┃         Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ A        │  3.543777e+02 │
│ Perim.   │  1.235768e+02 │
│ Qx       │  5.047390e+03 │
│ Qy       │  5.923689e+03 │
│ cx       │  1.671575e+01 │
│ cy       │  1.424297e+01 │
│ Ixx_g    │  1.137665e+05 │
│ Iyy_g    │  1.387654e+05 │
│ Ixy_g    │  8.892907e+04 │
│ Ixx_c    │  4.187664e+04 │
│ Iyy_c    │  3.974650e+04 │
│ Ixy_c    │  4.558164e+03 │
│ Zxx+     │  2.820099e+03 │
│ Zxx-     │  2.860789e+03 │
│ Zyy+     │  2.606925e+03 │
│ Zyy-     │  2.330570e+03 │
│ rx       │  1.087058e+01 │
│ ry       │  1.059049e+01 │
│ phi      │ -3.842404e+01 │
│ I11_c    │  4.549251e+04 │
│ I22_c    │  3.613063e+04 │
│ Z11+     │  2.155143e+03 │
│ Z11-     │  2.061571e+03 │
│ Z22+     │  1.717082e+03 │
│ Z22-     │  1.599443e+03 │
│ r11      │  1.133018e+01 │
│ r22      │  1.009728e+01 │
│ x_pc     │  1.626707e+01 │
│ y_pc     │  1.427513e+01 │
│ Sxx      │  3.548750e+03 │
│ Syy      │  3.153834e+03 │
│ SF_xx+   │  1.258378e+00 │
│ SF_xx-   │  1.240479e+00 │
│ SF_yy+   │  1.209791e+00 │
│ SF_yy-   │  1.353246e+00 │
│ x11_pc   │  1.662479e+01 │
│ y22_pc   │  1.427103e+01 │
│ S11      │  3.492177e+03 │
│ S22      │  2.898242e+03 │
│ SF_11+   │  1.620392e+00 │
│ SF_11-   │  1.693940e+00 │
│ SF_22+   │  1.687888e+00 │
│ SF_22-   │  1.812032e+00 │
└──────────┴───────────────┘

Load a geometry with multiple holes from a dxf file

geom = Geometry.from_dxf(dxf_filepath="files/section_holes_complex.dxf")
geom.plot_geometry()
Cross-Section Geometry
<AxesSubplot: title={'center': 'Cross-Section Geometry'}>

Generate a mesh

geom.create_mesh([1])
sec = Section(geom)
sec.plot_mesh(materials=False)
Finite Element Mesh
<AxesSubplot: title={'center': 'Finite Element Mesh'}>

Conduct a geometric & plastic analysis

sec.calculate_geometric_properties()
sec.calculate_plastic_properties()
sec.plot_centroids()
Centroids
<AxesSubplot: title={'center': 'Centroids'}>

Display the geometric & plastic properties

sec.display_results()
     Section Properties
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Property ┃         Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ A        │  6.997735e-01 │
│ Perim.   │  3.531378e+00 │
│ Qx       │  1.127282e+01 │
│ Qy       │  1.113424e+01 │
│ cx       │  1.591121e+01 │
│ cy       │  1.610924e+01 │
│ Ixx_g    │  1.816356e+02 │
│ Iyy_g    │  1.772080e+02 │
│ Ixy_g    │  1.793714e+02 │
│ Ixx_c    │  3.907173e-02 │
│ Iyy_c    │  4.872212e-02 │
│ Ixy_c    │  7.193759e-03 │
│ Zxx+     │  8.271797e-02 │
│ Zxx-     │  5.195063e-02 │
│ Zyy+     │  9.416195e-02 │
│ Zyy-     │  8.798053e-02 │
│ rx       │  2.362939e-01 │
│ ry       │  2.638665e-01 │
│ phi      │ -6.192581e+01 │
│ I11_c    │  5.255906e-02 │
│ I22_c    │  3.523478e-02 │
│ Z11+     │  8.973609e-02 │
│ Z11-     │  1.082595e-01 │
│ Z22+     │  5.379674e-02 │
│ Z22-     │  7.702330e-02 │
│ r11      │  2.740596e-01 │
│ r22      │  2.243918e-01 │
│ x_pc     │  1.592489e+01 │
│ y_pc     │  1.613076e+01 │
│ Sxx      │  1.364187e-01 │
│ Syy      │  1.554974e-01 │
│ SF_xx+   │  1.649203e+00 │
│ SF_xx-   │  2.625929e+00 │
│ SF_yy+   │  1.651383e+00 │
│ SF_yy-   │  1.767407e+00 │
│ x11_pc   │  1.588269e+01 │
│ y22_pc   │  1.611059e+01 │
│ S11      │  1.620643e-01 │
│ S22      │  1.302126e-01 │
│ SF_11+   │  1.806010e+00 │
│ SF_11-   │  1.496999e+00 │
│ SF_22+   │  2.420454e+00 │
│ SF_22-   │  1.690561e+00 │
└──────────┴───────────────┘

Load a geometry from a 3dm (Rhino) file

geom = Geometry.from_3dm(filepath="files/complex_shape.3dm")
geom.plot_geometry()
Cross-Section Geometry
<AxesSubplot: title={'center': 'Cross-Section Geometry'}>

Generate a mesh

geom.create_mesh([1])
sec = Section(geom)
sec.plot_mesh(materials=False)
Finite Element Mesh
<AxesSubplot: title={'center': 'Finite Element Mesh'}>

Conduct a geometric & plastic analysis

sec.calculate_geometric_properties()
sec.calculate_plastic_properties()
sec.plot_centroids()
Centroids
<AxesSubplot: title={'center': 'Centroids'}>

Display the geometric & plastic properties

sec.display_results()
    Section Properties
┏━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Property ┃        Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ A        │ 2.602049e+00 │
│ Perim.   │ 2.130651e+01 │
│ Qx       │ 9.082300e+00 │
│ Qy       │ 3.252560e+00 │
│ cx       │ 1.249999e+00 │
│ cy       │ 3.490441e+00 │
│ Ixx_g    │ 4.773758e+01 │
│ Iyy_g    │ 6.824622e+00 │
│ Ixy_g    │ 1.135287e+01 │
│ Ixx_c    │ 1.603635e+01 │
│ Iyy_c    │ 2.758925e+00 │
│ Ixy_c    │ 5.755182e-06 │
│ Zxx+     │ 4.476583e+00 │
│ Zxx-     │ 4.813398e+00 │
│ Zyy+     │ 2.207139e+00 │
│ Zyy-     │ 2.207142e+00 │
│ rx       │ 2.482533e+00 │
│ ry       │ 1.029704e+00 │
│ phi      │ 0.000000e+00 │
│ I11_c    │ 1.603635e+01 │
│ I22_c    │ 2.758925e+00 │
│ Z11+     │ 4.476583e+00 │
│ Z11-     │ 4.813398e+00 │
│ Z22+     │ 2.207139e+00 │
│ Z22-     │ 2.207142e+00 │
│ r11      │ 2.482533e+00 │
│ r22      │ 1.029704e+00 │
│ x_pc     │ 1.249996e+00 │
│ y_pc     │ 3.353406e+00 │
│ Sxx      │ 5.801661e+00 │
│ Syy      │ 2.504936e+00 │
│ SF_xx+   │ 1.296002e+00 │
│ SF_xx-   │ 1.205315e+00 │
│ SF_yy+   │ 1.134925e+00 │
│ SF_yy-   │ 1.134923e+00 │
│ x11_pc   │ 1.249996e+00 │
│ y22_pc   │ 3.353406e+00 │
│ S11      │ 5.801661e+00 │
│ S22      │ 2.504936e+00 │
│ SF_11+   │ 1.296002e+00 │
│ SF_11-   │ 1.205315e+00 │
│ SF_22+   │ 1.134925e+00 │
│ SF_22-   │ 1.134923e+00 │
└──────────┴──────────────┘

Load a compound geometry with multiple regions from a 3dm (Rhino) file

geom = CompoundGeometry.from_3dm(filepath="files/compound_shape.3dm")
geom.plot_geometry()
Cross-Section Geometry
<AxesSubplot: title={'center': 'Cross-Section Geometry'}>

Generate a mesh

geom.create_mesh([1])
sec = Section(geom)
sec.plot_mesh(materials=False)
Finite Element Mesh
<AxesSubplot: title={'center': 'Finite Element Mesh'}>

Conduct a geometric & plastic analysis N.B a warping analysis would be invalid due to the lack of connectivity between the two regions

sec.calculate_geometric_properties()
sec.calculate_plastic_properties()
sec.plot_centroids()
Centroids
<AxesSubplot: title={'center': 'Centroids'}>

Display the geometric & plastic properties

sec.display_results()
     Section Properties
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Property ┃         Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ A        │  2.838725e+00 │
│ Perim.   │ -1.000000e+00 │
│ Qx       │  1.413033e+01 │
│ Qy       │  3.548404e+00 │
│ cx       │  1.249999e+00 │
│ cy       │  4.977702e+00 │
│ Ixx_g    │  9.237156e+01 │
│ Iyy_g    │  7.393179e+00 │
│ Ixy_g    │  1.766291e+01 │
│ Ixx_c    │  2.203499e+01 │
│ Iyy_c    │  2.957676e+00 │
│ Ixy_c    │  4.909920e-06 │
│ Zxx+     │  5.480936e+00 │
│ Zxx-     │  4.426740e+00 │
│ Zyy+     │  2.366139e+00 │
│ Zyy-     │  2.366142e+00 │
│ rx       │  2.786088e+00 │
│ ry       │  1.020736e+00 │
│ phi      │  0.000000e+00 │
│ I11_c    │  2.203499e+01 │
│ I22_c    │  2.957676e+00 │
│ Z11+     │  5.480936e+00 │
│ Z11-     │  4.426740e+00 │
│ Z22+     │  2.366139e+00 │
│ Z22-     │  2.366142e+00 │
│ r11      │  2.786088e+00 │
│ r22      │  1.020736e+00 │
│ x_pc     │  1.249996e+00 │
│ y_pc     │  4.805339e+00 │
│ Sxx      │  6.956641e+00 │
│ Syy      │  2.699474e+00 │
│ SF_xx+   │  1.269243e+00 │
│ SF_xx-   │  1.571504e+00 │
│ SF_yy+   │  1.140877e+00 │
│ SF_yy-   │  1.140876e+00 │
│ x11_pc   │  1.249996e+00 │
│ y22_pc   │  4.805339e+00 │
│ S11      │  6.956641e+00 │
│ S22      │  2.699474e+00 │
│ SF_11+   │  1.269243e+00 │
│ SF_11-   │  1.571504e+00 │
│ SF_22+   │  1.140877e+00 │
│ SF_22-   │  1.140876e+00 │
└──────────┴───────────────┘

Total running time of the script: ( 0 minutes 16.655 seconds)

Gallery generated by Sphinx-Gallery