Arch: Added default pref settings for stairs

This commit is contained in:
Yorik van Havre 2014-05-21 18:10:33 -03:00
parent e587fe2dba
commit 0a71f4a8a7
4 changed files with 189 additions and 16 deletions

View File

@ -36,18 +36,31 @@ else:
return txt
def makeStairs(base=None,length=4.5,width=1,height=3,steps=17,name=translate("Arch","Stairs")):
def makeStairs(base=None,length=None,width=None,height=None,steps=None,name=translate("Arch","Stairs")):
"""makeStairs([base,length,width,height,steps]): creates a Stairs
objects with given attributes."""
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
_Stairs(obj)
_ViewProviderStairs(obj.ViewObject)
if base:
obj.Base = base
obj.Length = length
obj.Width = width
obj.Height = height
obj.NumberOfSteps = steps
if length:
obj.Length = length
else:
obj.Length = p.GetFloat("StairsLength",4500.0)
if width:
obj.Width = width
else:
obj.Width = p.GetFloat("StairsWidth",1000.0)
if height:
obj.Height = height
else:
obj.Height = p.GetFloat("StairsHeight",3000.0)
if steps:
obj.NumberOfSteps = steps
else:
obj.NumberOfSteps = p.GetInt("StairsSteps",17)
return obj

File diff suppressed because one or more lines are too long

View File

@ -633,6 +633,163 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>Stairs</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Length:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="doubleSpinBox">
<property name="suffix">
<string> mm</string>
</property>
<property name="maximum">
<double>9999.989999999999782</double>
</property>
<property name="value">
<double>4500.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsLength</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="doubleSpinBox_2">
<property name="suffix">
<string> mm</string>
</property>
<property name="maximum">
<double>9999.989999999999782</double>
</property>
<property name="value">
<double>1000.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsWidth</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefDoubleSpinBox" name="doubleSpinBox_3">
<property name="suffix">
<string> mm</string>
</property>
<property name="maximum">
<double>9999.989999999999782</double>
</property>
<property name="value">
<double>3000.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsHeight</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Number of steps:</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefSpinBox" name="spinBox_2">
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>17</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>StairsSteps</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -46,6 +46,7 @@ if not hasattr(IfcImport,"IfcFile"):
sys.exit()
PRECISION = 4 # rounding value, in number of digits
APPLYFIX = True # if true, the ifcopenshell bug-fixing function is applied when saving files
# Basic functions #################################################################
@ -346,7 +347,9 @@ class IfcDocument(object):
if path:
try:
self._fileobject.write(path)
self._fix(path)
if APPLYFIX:
print ("IfcWriter: Applying fix...")
self._fix(path)
except:
print ("IfcWriter: Error writing to "+path)
else:
@ -364,16 +367,16 @@ class IfcDocument(object):
if "IFCPLANEANGLEMEASURE" in l:
# bug 1: adding ifcPlaneAngleMeasure in a ifcMeasureWithUnit adds an unwanted = sign
l = l.replace("=IFCPLANEANGLEMEASURE","IFCPLANEANGLEMEASURE")
elif ("FACEBOUND" in l) or ("FACEOUTERBOUND" in l):
#elif ("FACEBOUND" in l) or ("FACEOUTERBOUND" in l): # FIXED
# bug 2: booleans are exported as ints
l = l.replace(",1);",",.T.);")
l = l.replace(",0);",",.F.);")
elif "FILE_DESCRIPTION" in l:
#l = l.replace(",1);",",.T.);")
#l = l.replace(",0);",",.F.);")
#elif "FILE_DESCRIPTION" in l: # FIXED
# bug 3: incomplete file description header
l = l.replace("ViewDefinition []","ViewDefinition [CoordinationView_V2.0]")
elif "FILE_NAME" in l:
#l = l.replace("ViewDefinition []","ViewDefinition [CoordinationView_V2.0]")
#elif "FILE_NAME" in l: # FIXED
# bug 4: incomplete file name entry
l = l.replace("FILE_NAME('','',(''),('',''),'IfcOpenShell','IfcOpenShell','');","FILE_NAME('"+path+"','"+now(string=True)+"',('"+self.Owner+"'),('',''),'IfcOpenShell','IfcOpenShell','');")
#l = l.replace("FILE_NAME('','',(''),('',''),'IfcOpenShell','IfcOpenShell','');","FILE_NAME('"+path+"','"+now(string=True)+"',('"+self.Owner+"'),('',''),'IfcOpenShell','IfcOpenShell','');")
elif "IFCSIUNIT" in l:
# bug 5: no way to insert * character
l = l.replace("IFCSIUNIT(#13,","IFCSIUNIT(*,")