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'''
|
'''makeFemBeamSection([width], [height], [name]): creates an beamsection object to define a cross section'''
|
||||||
obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name)
|
obj = FreeCAD.ActiveDocument.addObject("Fem::FeaturePython", name)
|
||||||
_FemBeamSection._FemBeamSection(obj)
|
_FemBeamSection._FemBeamSection(obj)
|
||||||
obj.Width = width
|
obj.RectWidth = width
|
||||||
obj.Height = height
|
obj.RectHeight = height
|
||||||
|
obj.CircRadius = height
|
||||||
|
obj.PipeRadius = height
|
||||||
|
obj.PipeThickness = 2.0
|
||||||
if FreeCAD.GuiUp:
|
if FreeCAD.GuiUp:
|
||||||
import _ViewProviderFemBeamSection
|
import _ViewProviderFemBeamSection
|
||||||
_ViewProviderFemBeamSection._ViewProviderFemBeamSection(obj.ViewObject)
|
_ViewProviderFemBeamSection._ViewProviderFemBeamSection(obj.ViewObject)
|
||||||
|
|
|
@ -543,15 +543,23 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
||||||
beamsec_obj = ccx_elset['beamsection_obj']
|
beamsec_obj = ccx_elset['beamsection_obj']
|
||||||
elsetdef = 'ELSET=' + ccx_elset['ccx_elset_name'] + ', '
|
elsetdef = 'ELSET=' + ccx_elset['ccx_elset_name'] + ', '
|
||||||
material = 'MATERIAL=' + ccx_elset['mat_obj_name']
|
material = 'MATERIAL=' + ccx_elset['mat_obj_name']
|
||||||
height = beamsec_obj.Height.getValueAs('mm')
|
if beamsec_obj.SectionType == 'Rectangular':
|
||||||
width = beamsec_obj.Width.getValueAs('mm')
|
height = beamsec_obj.RectHeight.getValueAs('mm')
|
||||||
if width == 0:
|
width = beamsec_obj.RectWidth.getValueAs('mm')
|
||||||
section_type = ', SECTION=CIRC'
|
|
||||||
setion_geo = str(height) + '\n'
|
|
||||||
else:
|
|
||||||
section_type = ', SECTION=RECT'
|
section_type = ', SECTION=RECT'
|
||||||
setion_geo = str(height) + ', ' + str(width) + '\n'
|
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_def)
|
||||||
f.write(setion_geo)
|
f.write(setion_geo)
|
||||||
elif 'shellthickness_obj'in ccx_elset: # shell mesh
|
elif 'shellthickness_obj'in ccx_elset: # shell mesh
|
||||||
|
|
|
@ -173,8 +173,8 @@ class FemInputWriterZ88(FemInputWriter.FemInputWriter):
|
||||||
if FemMeshTools.is_edge_femmesh(self.femmesh):
|
if FemMeshTools.is_edge_femmesh(self.femmesh):
|
||||||
if len(self.beamsection_objects) == 1:
|
if len(self.beamsection_objects) == 1:
|
||||||
beam_obj = self.beamsection_objects[0]['Object']
|
beam_obj = self.beamsection_objects[0]['Object']
|
||||||
width = beam_obj.Width.getValueAs('mm')
|
width = beam_obj.RectWidth.getValueAs('mm')
|
||||||
height = beam_obj.Height.getValueAs('mm')
|
height = beam_obj.RectHeight.getValueAs('mm')
|
||||||
area = str(width * height)
|
area = str(width * height)
|
||||||
elements_data.append('1 ' + str(self.element_count) + ' ' + area + ' 0 0 0 0 0 0 ')
|
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!")
|
print("Be aware, only trusses are supported for edge meshes!")
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>249</width>
|
<width>492</width>
|
||||||
<height>379</height>
|
<height>560</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Cross Section</string>
|
<string>Cross Section</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="l_label_text_3">
|
<widget class="QLabel" name="l_label_text_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -40,6 +40,52 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -48,7 +94,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>References</string>
|
<string>References</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="l_label_text_1">
|
<widget class="QLabel" name="l_label_text_1">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -76,11 +122,8 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="list_References"/>
|
<widget class="QListWidget" name="list_References"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -93,6 +136,14 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</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>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
|
@ -30,10 +30,17 @@ __url__ = "http://www.freecadweb.org"
|
||||||
|
|
||||||
class _FemBeamSection:
|
class _FemBeamSection:
|
||||||
"The FemBeamSection object"
|
"The FemBeamSection object"
|
||||||
|
known_beam_types = ['Rectangular', 'Circular', 'Pipe']
|
||||||
def __init__(self, obj):
|
def __init__(self, obj):
|
||||||
obj.addProperty("App::PropertyLength", "Width", "BeamSection", "set width of the beam elements")
|
obj.addProperty("App::PropertyLength", "RectWidth", "RectBeamSection", "set width of the rectangular beam elements")
|
||||||
obj.addProperty("App::PropertyLength", "Height", "BeamSection", "set height of the 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.addProperty("App::PropertyLinkSubList", "References", "BeamSection", "List of beam section shapes")
|
||||||
|
obj.SectionType = _FemBeamSection.known_beam_types
|
||||||
|
obj.SectionType = 'Rectangular'
|
||||||
obj.Proxy = self
|
obj.Proxy = self
|
||||||
self.Type = "FemBeamSection"
|
self.Type = "FemBeamSection"
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,18 @@ class _TaskPanelFemBeamSection:
|
||||||
self.get_references()
|
self.get_references()
|
||||||
|
|
||||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemBeamSection.ui")
|
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.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.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||||
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
|
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
|
import FemSelectionObserver
|
||||||
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
|
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):
|
def selectionParser(self, selection):
|
||||||
# print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
# print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||||
if hasattr(selection[0], "Shape"):
|
if hasattr(selection[0], "Shape"):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user