Skip to content

Commit

Permalink
FEM: beam section properties, use diameter instead of radius
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and yorikvanhavre committed Dec 21, 2016
1 parent 856b784 commit c06c150
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
14 changes: 10 additions & 4 deletions src/Mod/Fem/FemBeamSection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@
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)
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/FemInputWriterCcx.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,12 @@ def write_femelementsets(self, f):
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'
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Fem/_FemBeamSection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/Mod/Fem/_TaskPanelFemBeamSection.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ def get_beamsection_props(self):
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):
self.obj.References = self.references
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):
Expand All @@ -98,8 +98,8 @@ def update(self):
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()

Expand All @@ -116,10 +116,10 @@ def rec_width_changed(self, base_quantity_value):
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
Expand Down

0 comments on commit c06c150

Please sign in to comment.