FEM: beam section properties, use diameter instead of radius

This commit is contained in:
Bernd Hahnebach 2016-12-20 18:11:51 +01:00 committed by Yorik van Havre
parent 856b7844c0
commit c06c150d9b
4 changed files with 23 additions and 17 deletions

View File

@ -31,15 +31,21 @@ import FreeCAD
import _FemBeamSection
def makeFemBeamSection(width=20.0, height=20.0, name="BeamSection"):
def makeFemBeamSection(sectiontype='Rectangular', width=10.0, height=25.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)
sec_types = _FemBeamSection._FemBeamSection.known_beam_types
if sectiontype not in sec_types:
FreeCAD.Console.PrintError("Section type is not known. Set to " + sec_types[0] + " \n")
obj.SectionType = sec_types[0]
else:
obj.SectionType = sectiontype
obj.RectWidth = width
obj.RectHeight = height
obj.CircRadius = height
obj.PipeRadius = height
obj.PipeThickness = 2.0
obj.CircDiameter = height
obj.PipeDiameter = height
obj.PipeThickness = width
if FreeCAD.GuiUp:
import _ViewProviderFemBeamSection
_ViewProviderFemBeamSection._ViewProviderFemBeamSection(obj.ViewObject)

View File

@ -550,12 +550,12 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
setion_geo = str(height) + ', ' + str(width) + '\n'
setion_def = '*BEAM SECTION, ' + elsetdef + material + section_type + '\n'
elif beamsec_obj.SectionType == 'Circular':
radius = beamsec_obj.CircRadius.getValueAs('mm')
radius = 0.5 * beamsec_obj.CircDiameter.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')
radius = 0.5 * beamsec_obj.PipeDiameter.getValueAs('mm')
thickness = beamsec_obj.PipeThickness.getValueAs('mm')
section_type = ', SECTION=PIPE'
setion_geo = str(radius) + ', ' + str(thickness) + '\n'

View File

@ -36,9 +36,9 @@ class _FemBeamSection:
def __init__(self, obj):
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::PropertyLength", "CircDiameter", "CircBeamSection", "set diameter of the circular beam elements")
obj.addProperty("App::PropertyLength", "PipeDiameter", "PipeBeamSection", "set outer diameter of the pipe beam elements")
obj.addProperty("App::PropertyLength", "PipeThickness", "PipeBeamSection", "set thickness 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

View File

@ -79,8 +79,8 @@ class _TaskPanelFemBeamSection:
self.SectionType = self.obj.SectionType
self.RectHeight = self.obj.RectHeight
self.RectWidth = self.obj.RectWidth
self.CircRadius = self.obj.CircRadius
self.PipeRadius = self.obj.PipeRadius
self.CircDiameter = self.obj.CircDiameter
self.PipeDiameter = self.obj.PipeDiameter
self.PipeThickness = self.obj.PipeThickness
def set_beamsection_props(self):
@ -88,8 +88,8 @@ class _TaskPanelFemBeamSection:
self.obj.SectionType = self.SectionType
self.obj.RectHeight = self.RectHeight
self.obj.RectWidth = self.RectWidth
self.obj.CircRadius = self.CircRadius
self.obj.PipeRadius = self.PipeRadius
self.obj.CircDiameter = self.CircDiameter
self.obj.PipeDiameter = self.PipeDiameter
self.obj.PipeThickness = self.PipeThickness
def update(self):
@ -98,8 +98,8 @@ class _TaskPanelFemBeamSection:
self.form.cb_crosssectiontype.setCurrentIndex(index_crosssectiontype)
self.form.if_rec_height.setText(self.RectHeight.UserString)
self.form.if_rec_width.setText(self.RectWidth.UserString)
self.form.if_circ_diameter.setText(self.CircRadius.UserString)
self.form.if_pipe_diameter.setText(self.PipeRadius.UserString)
self.form.if_circ_diameter.setText(self.CircDiameter.UserString)
self.form.if_pipe_diameter.setText(self.PipeDiameter.UserString)
self.form.if_pipe_thickness.setText(self.PipeThickness.UserString)
self.rebuild_list_References()
@ -116,10 +116,10 @@ class _TaskPanelFemBeamSection:
self.RectWidth = base_quantity_value
def circ_diameter_changed(self, base_quantity_value):
self.CircRadius = base_quantity_value
self.CircDiameter = base_quantity_value
def pipe_diameter_changed(self, base_quantity_value):
self.PipeRadius = base_quantity_value
self.PipeDiameter = base_quantity_value
def pipe_thickness_changed(self, base_quantity_value):
self.PipeThickness = base_quantity_value