added export button to arch schedule UI
This commit is contained in:
parent
b8163a03dc
commit
d515fbc05a
|
@ -99,7 +99,7 @@ class _ArchSchedule:
|
|||
# blank line
|
||||
continue
|
||||
# write description
|
||||
obj.Result.set("A"+str(i+2),obj.Description[i])
|
||||
obj.Result.set("A"+str(i+2),obj.Description[i].encode("utf8"))
|
||||
if verbose:
|
||||
l= "OPERATION: "+obj.Description[i]
|
||||
print l
|
||||
|
@ -114,6 +114,10 @@ class _ArchSchedule:
|
|||
objs = [FreeCAD.ActiveDocument.getObject(o) for o in objs]
|
||||
else:
|
||||
objs = FreeCAD.ActiveDocument.Objects
|
||||
if len(objs) == 1:
|
||||
# remove object itself if the object is a group
|
||||
if objs[0].isDerivedFrom("App::DocumentObjectGroup"):
|
||||
objs = objs[0].Group
|
||||
objs = Draft.getGroupContents(objs,walls=True,addgroups=True)
|
||||
objs = Arch.pruneIncluded(objs)
|
||||
if obj.Filter[i]:
|
||||
|
@ -183,17 +187,20 @@ class _ArchSchedule:
|
|||
val = sumval
|
||||
# get unit
|
||||
if obj.Unit[i]:
|
||||
if "2" in obj.Unit[i]:
|
||||
ustr = obj.Unit[i].encode("utf8")
|
||||
unit = ustr.replace("²","^2")
|
||||
unit = unit.replace("³","^3")
|
||||
if "2" in unit:
|
||||
tp = FreeCAD.Units.Area
|
||||
elif "3" in obj.Unit[i]:
|
||||
elif "3" in unit:
|
||||
tp = FreeCAD.Units.Volume
|
||||
elif "deg" in obj.Unit[i]:
|
||||
elif "deg" in unit:
|
||||
tp = FreeCAD.Units.Angle
|
||||
else:
|
||||
tp = FreeCAD.Units.Length
|
||||
q = FreeCAD.Units.Quantity(val,tp)
|
||||
obj.Result.set("B"+str(i+2),str(q.getValueAs(obj.Unit[i]).Value))
|
||||
obj.Result.set("C"+str(i+2),obj.Unit[i])
|
||||
obj.Result.set("B"+str(i+2),str(q.getValueAs(unit).Value))
|
||||
obj.Result.set("C"+str(i+2),ustr)
|
||||
else:
|
||||
obj.Result.set("B"+str(i+2),str(val))
|
||||
if verbose:
|
||||
|
@ -267,6 +274,7 @@ class _ArchScheduleTaskPanel:
|
|||
QtCore.QObject.connect(self.form.buttonDel, QtCore.SIGNAL("clicked()"), self.remove)
|
||||
QtCore.QObject.connect(self.form.buttonClear, QtCore.SIGNAL("clicked()"), self.clear)
|
||||
QtCore.QObject.connect(self.form.buttonImport, QtCore.SIGNAL("clicked()"), self.importCSV)
|
||||
QtCore.QObject.connect(self.form.buttonExport, QtCore.SIGNAL("clicked()"), self.exportCSV)
|
||||
QtCore.QObject.connect(self.form.buttonSelect, QtCore.SIGNAL("clicked()"), self.select)
|
||||
self.form.list.clearContents()
|
||||
|
||||
|
@ -310,6 +318,12 @@ class _ArchScheduleTaskPanel:
|
|||
self.form.list.setItem(r,i,QtGui.QTableWidgetItem(t))
|
||||
r += 1
|
||||
|
||||
def exportCSV(self):
|
||||
if self.obj:
|
||||
filename = QtGui.QFileDialog.getSaveFileName(QtGui.qApp.activeWindow(), translate("Arch","Export CSV File"), None, "CSV file (*.csv)");
|
||||
if filename:
|
||||
self.obj.Result.exportFile(str(filename[0].encode("utf8")))
|
||||
|
||||
def select(self):
|
||||
if self.form.list.currentRow() >= 0:
|
||||
sel = ""
|
||||
|
|
|
@ -253,6 +253,7 @@ class _Space(ArchComponent.Component):
|
|||
obj.SpaceType = SpaceTypes
|
||||
obj.Conditioning = ConditioningTypes
|
||||
obj.Role = Roles
|
||||
obj.setEditorMode("HorizontalArea",2)
|
||||
|
||||
def execute(self,obj):
|
||||
|
||||
|
@ -375,9 +376,21 @@ class _Space(ArchComponent.Component):
|
|||
e = Part.__sortEdges__(e.Edges)
|
||||
w = Part.Wire(e)
|
||||
f = Part.Face(w)
|
||||
return f.Area
|
||||
except Part.OCCError:
|
||||
return 0
|
||||
else:
|
||||
if hasattr(obj,"PerimeterLength"):
|
||||
if w.Length != obj.PerimeterLength.Value:
|
||||
obj.PerimeterLength = w.Length
|
||||
if hasattr(obj,"VerticalArea"):
|
||||
a = 0
|
||||
for f in sh.Faces:
|
||||
ang = f.normalAt(0,0).getAngle(FreeCAD.Vector(0,0,1))
|
||||
if (ang > 1.57) and (ang < 1.571):
|
||||
a += f.Area
|
||||
if a != obj.VerticalArea.Value:
|
||||
obj.VerticalArea = a
|
||||
return f.Area
|
||||
|
||||
|
||||
class _ViewProviderSpace(ArchComponent.ViewProviderComponent):
|
||||
|
|
|
@ -634,6 +634,7 @@ class _Window(ArchComponent.Component):
|
|||
obj.addProperty("App::PropertyInteger","Preset","Arch","")
|
||||
obj.addProperty("App::PropertyLink","PanelMaterial","Material",QT_TRANSLATE_NOOP("App::Property","A material for this object"))
|
||||
obj.addProperty("App::PropertyLink","GlassMaterial","Material",QT_TRANSLATE_NOOP("App::Property","A material for this object"))
|
||||
obj.addProperty("App::PropertyArea","Area","Arch",QT_TRANSLATE_NOOP("App::Property","The area of this window"))
|
||||
obj.setEditorMode("Preset",2)
|
||||
|
||||
self.Type = "Window"
|
||||
|
@ -735,6 +736,8 @@ class _Window(ArchComponent.Component):
|
|||
if base:
|
||||
if not base.isNull():
|
||||
self.applyShape(obj,base,pl,allowinvalid=True,allownosolid=True)
|
||||
if hasattr(obj,"Area"):
|
||||
obj.Area = obj.Width.Value * obj.Height.Value
|
||||
|
||||
def getSubVolume(self,obj,plac=None):
|
||||
"returns a subvolume for cutting in a base object"
|
||||
|
|
|
@ -149,6 +149,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonExport">
|
||||
<property name="toolTip">
|
||||
<string>This exports the contents of the "Result" spreadsheet to a csv file. In Libreoffice, you can keep this csv file linked by right-clicking the sheets tab bar -> New sheet -> From file -> Link</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-export">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in New Issue
Block a user