FEM: BeamSection: Allow other beam section types
This commit is contained in:
parent
cb6baaaf90
commit
7110a4e2c7
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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!")
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>249</width>
|
||||
<height>379</height>
|
||||
<width>492</width>
|
||||
<height>560</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -25,7 +25,7 @@
|
|||
<property name="title">
|
||||
<string>Cross Section</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_label_text_3">
|
||||
<property name="text">
|
||||
|
@ -40,6 +40,52 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Choose cross section type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_Rect">
|
||||
<property name="text">
|
||||
<string>Rectangular</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_Circ">
|
||||
<property name="text">
|
||||
<string>Circular</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_Pipe">
|
||||
<property name="text">
|
||||
<string>Pipe</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -48,7 +94,7 @@
|
|||
<property name="title">
|
||||
<string>References</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_label_text_1">
|
||||
<property name="text">
|
||||
|
@ -76,22 +122,27 @@
|
|||
<item>
|
||||
<widget class="QListWidget" name="list_References"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>l_label_text_1</zorder>
|
||||
<zorder>l_label_text_2</zorder>
|
||||
<zorder>pushButton_Reference</zorder>
|
||||
<zorder>list_References</zorder>
|
||||
<zorder>verticalSpacer</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"):
|
||||
|
|
Loading…
Reference in New Issue
Block a user