Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jun 1, 2018
1 parent 2d21bab commit c41eecb
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 63 deletions.
9 changes: 6 additions & 3 deletions BimProject.py
Expand Up @@ -77,7 +77,10 @@ def accept(self):
site.Address = self.form.siteAddress.text()
site.Longitude = self.form.siteLongitude.value()
site.Latitude = self.form.siteLatitude.value()
site.NorthDeviation = self.form.siteDeviation.value()
if hasattr(site,"NorthDeviation"):
site.NorthDeviation = self.form.siteDeviation.value()
if hasattr(site,"Declination"):
site.NorthDeviation = self.form.siteDeviation.value()
site.Elevation = FreeCAD.Units.Quantity(self.form.siteElevation.text()).Value
if self.form.groupBuilding.isChecked():
building = Arch.makeBuilding()
Expand Down Expand Up @@ -134,7 +137,7 @@ def accept(self):
axisH.setExpression('Placement.Base.x', outline.Name+'.Placement.Base.x + '+axisH.Name+'.Length * 0.945')
axisH.setExpression('Placement.Base.y', outline.Name+'.Placement.Base.y')
grp.addObject(axisH)
if self.form.countLevels.value() and levelHeight:
if self.form.countLevels.value() and levelHeight:
h = 0
alabels = []
for i in range(self.form.countLevels.value()):
Expand Down Expand Up @@ -230,7 +233,7 @@ def savePreset(self):
s += "lineWidth="+str(self.form.lineWidth.value())+"\n"
s += "lineColor="+str(self.form.lineColor.property("color").getRgbF()[:3])+"\n"
s += "groups="+";;".join(groups)+"\n"

s += "levelsWP="+str(int(self.form.levelsWP.isChecked()))+"\n"
s += "levelsAxis="+str(int(self.form.levelsAxis.isChecked()))+"\n"

Expand Down
30 changes: 21 additions & 9 deletions BimViews.py
Expand Up @@ -27,7 +27,6 @@
def QT_TRANSLATE_NOOP(ctx,txt): return txt # dummy function for the QT translator



class BIM_Views:


Expand All @@ -39,9 +38,7 @@ def GetResources(self):

def Activated(self):
from PySide import QtCore,QtGui
mw = FreeCADGui.getMainWindow()
combo = mw.findChild(QtGui.QDockWidget,"Combo View")
vm = combo.findChild(QtGui.QListWidget,"Views Manager")
vm = findWidget()
if vm:
if vm.isVisible():
vm.hide()
Expand All @@ -54,26 +51,41 @@ def Activated(self):
vm.setSortingEnabled(True)
vm.setIconSize(QtCore.QSize(16,16))
QtCore.QObject.connect(vm, QtCore.SIGNAL("itemDoubleClicked(QListWidgetItem*)"),show)
s = combo.findChild(QtGui.QSplitter)
s.addWidget(vm)
mw = FreeCADGui.getMainWindow()
combo = mw.findChild(QtGui.QDockWidget,"Combo View")
if combo:
s = combo.findChild(QtGui.QSplitter)
if s:
s.addWidget(vm)
update()


FreeCADGui.addCommand('BIM_Views',BIM_Views())


def update():

"updates the view manager"
def findWidget():
"finds the manager widget, if present"

from PySide import QtGui
mw = FreeCADGui.getMainWindow()
combo = mw.findChild(QtGui.QDockWidget,"Combo View")
vm = combo.findChild(QtGui.QListWidget,"Views Manager")
if vm:
return vm
return None


def update():

"updates the view manager"

vm = findWidget()
if vm:
if vm.isVisible():
vm.clear()
import Draft
from PySide import QtGui
for obj in FreeCAD.ActiveDocument.Objects:
if Draft.getType(obj) == "WorkingPlaneProxy":
it = QtGui.QListWidgetItem(vm)
Expand Down
98 changes: 49 additions & 49 deletions dialogProject.ui
Expand Up @@ -86,31 +86,7 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="siteAddress"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="siteName">
<property name="text">
<string>Default Site</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="siteLongitude">
<property name="suffix">
<string> E</string>
Expand All @@ -123,41 +99,35 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<item row="6" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Latitude</string>
<string>Elevation</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="siteLatitude">
<property name="suffix">
<string> N</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>9999.989999999999782</double>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Declination</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<item row="0" column="1">
<widget class="QLineEdit" name="siteName">
<property name="text">
<string>True North direction</string>
<string>Default Site</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Longitude</string>
<string>Name</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="siteDeviation">
<property name="suffix">
<string> °</string>
Expand All @@ -167,20 +137,50 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Elevation</string>
<string>Longitude</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="Gui::InputField" name="siteElevation">
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="siteAddress"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Latitude</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="siteLatitude">
<property name="suffix">
<string> N</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>9999.989999999999782</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down
2 changes: 1 addition & 1 deletion dialogSetup.ui
Expand Up @@ -20,7 +20,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>This dialog will help you to set FreeCAD up for efficient BIM workflow, by setting a couple of typical FreeCAD options. This dialog can be accessed again anytime from menu Utils, and more options are available under menu Edit -&gt; Preferences.</string>
<string>This dialog will help you to set FreeCAD up for efficient BIM workflow, by setting a couple of typical FreeCAD options. This dialog can be accessed again anytime from menu Manage-&gt;Setup, and more options are available under menu Edit -&gt; Preferences.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down
2 changes: 1 addition & 1 deletion dialogWelcome.ui
Expand Up @@ -29,7 +29,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>This appears to be the first time that you are using the BIM workbench. If you press OK, the next screen will propose you to set a couple of typical FreeCAD options that are suitable for BIM work. You can change these options anytime later under menu Utils -&gt; Setup, or access directly the complete FreeCAD preferences under menu Edit -&gt;Preferences.</string>
<string>This appears to be the first time that you are using the BIM workbench. If you press OK, the next screen will propose you to set a couple of typical FreeCAD options that are suitable for BIM work. You can change these options anytime later under menu Manage -&gt; Setup, or access directly the complete FreeCAD preferences under menu Edit -&gt;Preferences.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down

0 comments on commit c41eecb

Please sign in to comment.