diff --git a/src/Mod/Fem/FemBeamSection.py b/src/Mod/Fem/FemBeamSection.py
index 934168cb50..86d6ac21ae 100644
--- a/src/Mod/Fem/FemBeamSection.py
+++ b/src/Mod/Fem/FemBeamSection.py
@@ -35,8 +35,11 @@ def makeFemBeamSection(width=20.0, height=20.0, name="BeamSection"):
'''makeFemBeamSection([width], [height], [name]): creates an beamsection object to define a cross section'''
obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name)
_FemBeamSection._FemBeamSection(obj)
- obj.Width = width
- obj.Height = height
+ obj.RectWidth = width
+ obj.RectHeight = height
+ obj.CircRadius = height
+ obj.PipeRadius = height
+ obj.PipeThickness = 2.0
if FreeCAD.GuiUp:
import _ViewProviderFemBeamSection
_ViewProviderFemBeamSection._ViewProviderFemBeamSection(obj.ViewObject)
diff --git a/src/Mod/Fem/FemInputWriterCcx.py b/src/Mod/Fem/FemInputWriterCcx.py
index 85ac5a9132..f82aec1b03 100644
--- a/src/Mod/Fem/FemInputWriterCcx.py
+++ b/src/Mod/Fem/FemInputWriterCcx.py
@@ -543,15 +543,23 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
beamsec_obj = ccx_elset['beamsection_obj']
elsetdef = 'ELSET=' + ccx_elset['ccx_elset_name'] + ', '
material = 'MATERIAL=' + ccx_elset['mat_obj_name']
- height = beamsec_obj.Height.getValueAs('mm')
- width = beamsec_obj.Width.getValueAs('mm')
- if width == 0:
- section_type = ', SECTION=CIRC'
- setion_geo = str(height) + '\n'
- else:
+ if beamsec_obj.SectionType == 'Rectangular':
+ height = beamsec_obj.RectHeight.getValueAs('mm')
+ width = beamsec_obj.RectWidth.getValueAs('mm')
section_type = ', SECTION=RECT'
setion_geo = str(height) + ', ' + str(width) + '\n'
- setion_def = '*BEAM SECTION, ' + elsetdef + material + section_type + '\n'
+ setion_def = '*BEAM SECTION, ' + elsetdef + material + section_type + '\n'
+ elif beamsec_obj.SectionType == 'Circular':
+ radius = beamsec_obj.CircRadius.getValueAs('mm')
+ section_type = ', SECTION=CIRC'
+ setion_geo = str(radius) + '\n'
+ setion_def = '*BEAM SECTION, ' + elsetdef + material + section_type + '\n'
+ elif beamsec_obj.SectionType == 'Pipe':
+ radius = beamsec_obj.PipeRadius.getValueAs('mm')
+ thickness = beamsec_obj.PipeThickness.getValueAs('mm')
+ section_type = ', SECTION=PIPE'
+ setion_geo = str(radius) + ', ' + str(thickness) + '\n'
+ setion_def = '*BEAM GENERAL SECTION, ' + elsetdef + material + section_type + '\n'
f.write(setion_def)
f.write(setion_geo)
elif 'shellthickness_obj'in ccx_elset: # shell mesh
diff --git a/src/Mod/Fem/FemInputWriterZ88.py b/src/Mod/Fem/FemInputWriterZ88.py
index 9090496b6c..87d76cacbe 100644
--- a/src/Mod/Fem/FemInputWriterZ88.py
+++ b/src/Mod/Fem/FemInputWriterZ88.py
@@ -173,8 +173,8 @@ class FemInputWriterZ88(FemInputWriter.FemInputWriter):
if FemMeshTools.is_edge_femmesh(self.femmesh):
if len(self.beamsection_objects) == 1:
beam_obj = self.beamsection_objects[0]['Object']
- width = beam_obj.Width.getValueAs('mm')
- height = beam_obj.Height.getValueAs('mm')
+ width = beam_obj.RectWidth.getValueAs('mm')
+ height = beam_obj.RectHeight.getValueAs('mm')
area = str(width * height)
elements_data.append('1 ' + str(self.element_count) + ' ' + area + ' 0 0 0 0 0 0 ')
print("Be aware, only trusses are supported for edge meshes!")
diff --git a/src/Mod/Fem/TaskPanelFemBeamSection.ui b/src/Mod/Fem/TaskPanelFemBeamSection.ui
index 6162ea8c48..a8c551522d 100644
--- a/src/Mod/Fem/TaskPanelFemBeamSection.ui
+++ b/src/Mod/Fem/TaskPanelFemBeamSection.ui
@@ -6,8 +6,8 @@
0
0
- 249
- 379
+ 492
+ 560
@@ -25,7 +25,7 @@
Cross Section
-
+
-
@@ -40,6 +40,52 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Choose cross section type:
+
+
+
+ -
+
+
-
+
+
+ Rectangular
+
+
+
+ -
+
+
+ Circular
+
+
+
+ -
+
+
+ Pipe
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
@@ -48,7 +94,7 @@
References
-
+
-
@@ -76,22 +122,27 @@
-
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ l_label_text_1
+ l_label_text_2
+ pushButton_Reference
+ list_References
+ verticalSpacer
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
diff --git a/src/Mod/Fem/_FemBeamSection.py b/src/Mod/Fem/_FemBeamSection.py
index 032c815a4f..4c6c1f0d21 100644
--- a/src/Mod/Fem/_FemBeamSection.py
+++ b/src/Mod/Fem/_FemBeamSection.py
@@ -30,10 +30,17 @@ __url__ = "http://www.freecadweb.org"
class _FemBeamSection:
"The FemBeamSection object"
+ known_beam_types = ['Rectangular', 'Circular', 'Pipe']
def __init__(self, obj):
- obj.addProperty("App::PropertyLength", "Width", "BeamSection", "set width of the beam elements")
- obj.addProperty("App::PropertyLength", "Height", "BeamSection", "set height of the beam elements")
+ obj.addProperty("App::PropertyLength", "RectWidth", "RectBeamSection", "set width of the rectangular beam elements")
+ obj.addProperty("App::PropertyLength", "RectHeight", "RectBeamSection", "set height of therectangular beam elements")
+ obj.addProperty("App::PropertyLength", "CircRadius", "CircBeamSection", "set radius of the circular beam elements")
+ obj.addProperty("App::PropertyLength", "PipeRadius", "PipeBeamSection", "set height of the pipe beam elements")
+ obj.addProperty("App::PropertyLength", "PipeThickness", "PipeBeamSection", "set height of the pipe beam elements")
+ obj.addProperty("App::PropertyEnumeration", "SectionType", "BeamSection", "select beam section type")
obj.addProperty("App::PropertyLinkSubList", "References", "BeamSection", "List of beam section shapes")
+ obj.SectionType = _FemBeamSection.known_beam_types
+ obj.SectionType = 'Rectangular'
obj.Proxy = self
self.Type = "FemBeamSection"
diff --git a/src/Mod/Fem/_TaskPanelFemBeamSection.py b/src/Mod/Fem/_TaskPanelFemBeamSection.py
index 5333a5d8f1..ffd0703b53 100644
--- a/src/Mod/Fem/_TaskPanelFemBeamSection.py
+++ b/src/Mod/Fem/_TaskPanelFemBeamSection.py
@@ -45,7 +45,18 @@ class _TaskPanelFemBeamSection:
self.get_references()
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemBeamSection.ui")
+
+ if self.obj.SectionType == 'Rectangular':
+ self.form.rb_Rect.setChecked(True)
+ elif self.obj.SectionType == 'Circular':
+ self.form.rb_Circ.setChecked(True)
+ elif self.obj.SectionType == 'Pipe':
+ self.form.rb_Pipe.setChecked(True)
+
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
+ QtCore.QObject.connect(self.form.rb_Rect, QtCore.SIGNAL("clicked()"), self.rect_section)
+ QtCore.QObject.connect(self.form.rb_Circ, QtCore.SIGNAL("clicked()"), self.circ_section)
+ QtCore.QObject.connect(self.form.rb_Pipe, QtCore.SIGNAL("clicked()"), self.pipe_section)
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
@@ -100,6 +111,23 @@ class _TaskPanelFemBeamSection:
import FemSelectionObserver
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
+ def rect_section(self):
+ '''Called if Rectangular radio button is triggered'''
+ self.obj.SectionType = 'Rectangular'
+ self.obj.RectWidth = 20.0
+ self.obj.RectHeight = 20.0
+
+ def circ_section(self):
+ '''Called if Circular radio button is triggered'''
+ self.obj.SectionType = 'Circular'
+ self.obj.CircRadius = 20.0
+
+ def pipe_section(self):
+ '''Called if Pipe radio button is triggered'''
+ self.obj.SectionType = 'Pipe'
+ self.obj.PipeRadius = 20.0
+ self.obj.PipeThickness = 2.0
+
def selectionParser(self, selection):
# print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
if hasattr(selection[0], "Shape"):