Moved the UI from a dock window into a task window
Added menu entry in PartDesign workbench menu
This commit is contained in:
parent
a375f6b4a9
commit
0a98b35fea
|
@ -214,7 +214,9 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "PartDesign_LinearPattern"
|
||||
<< "PartDesign_PolarPattern"
|
||||
// << "PartDesign_Scaled"
|
||||
<< "PartDesign_MultiTransform";
|
||||
<< "PartDesign_MultiTransform"
|
||||
<< "Separator"
|
||||
<< "PartDesign_WizardShaft";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,38 @@ class Shaft:
|
|||
self.equilibrium()
|
||||
self.updateDiagrams()
|
||||
|
||||
def updateEdge(self, column, start):
|
||||
App.Console.PrintMessage("Not implemented yet - waiting for robust references...")
|
||||
return
|
||||
if self.sketchClosed is not True:
|
||||
return
|
||||
# Create a chamfer or fillet at the start or end edge of the segment
|
||||
if start is True:
|
||||
row = rowStartEdgeType
|
||||
idx = 0
|
||||
else:
|
||||
row = rowEndEdgeType
|
||||
idx = 1
|
||||
|
||||
edgeType = self.tableWidget.item(row, column).text().toAscii()[0].upper()
|
||||
if not ((edgeType == "C") or (edgeType == "F")):
|
||||
return # neither chamfer nor fillet defined
|
||||
|
||||
if edgeType == "C":
|
||||
objName = self.doc.addObject("PartDesign::Chamfer","ChamferShaft%u" % (column * 2 + idx))
|
||||
else:
|
||||
objName = self.doc.addObject("PartDesign::Fillet","FilletShaft%u" % (column * 2 + idx))
|
||||
if objName == "":
|
||||
return
|
||||
|
||||
edgeName = "Edge%u" % self.getEdgeIndex(column, idx, edgeType)
|
||||
self.doc.getObject(objName).Base = (self.doc.getObject("RevolutionShaft"),"[%s]" % edgeName)
|
||||
# etc. etc.
|
||||
|
||||
def getEdgeIndex(self, column, startIdx):
|
||||
# FIXME: This is impossible without robust references anchored in the sketch!!!
|
||||
return
|
||||
|
||||
def updateDiagrams(self):
|
||||
if (self.Qy == 0) or (self.Mbz == 0):
|
||||
return
|
||||
|
|
|
@ -21,33 +21,28 @@
|
|||
# ******************************************************************************/
|
||||
|
||||
import FreeCAD, FreeCADGui
|
||||
import os
|
||||
#import os
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from WizardShaftTable import WizardShaftTable
|
||||
from Shaft import Shaft
|
||||
|
||||
class WizardShaft:
|
||||
class TaskWizardShaft:
|
||||
"Shaft Wizard"
|
||||
# GUI
|
||||
App = FreeCAD
|
||||
Gui = FreeCADGui
|
||||
doc = Gui.ActiveDocument
|
||||
# Table and widget
|
||||
table = 0
|
||||
form = 0
|
||||
# Shaft
|
||||
shaft = 0
|
||||
# Feature
|
||||
sketch = 0
|
||||
featureWindow = 0
|
||||
|
||||
def __init__(self):
|
||||
#FreeCADGui.activeWorkbench()
|
||||
#
|
||||
"Initialize the user interface"
|
||||
### Create a dock window
|
||||
wizardWidget = QtGui.QDockWidget("Shaft Wizard")
|
||||
wizardWidget.setObjectName("Shaft Wizard")
|
||||
def __init__(self):
|
||||
mw = QtGui.qApp.activeWindow()
|
||||
mw.addDockWidget(QtCore.Qt.TopDockWidgetArea,wizardWidget)
|
||||
cw = mw.centralWidget() # This is a qmdiarea widget
|
||||
|
||||
# Get active document or create a new one
|
||||
|
@ -63,51 +58,18 @@ class WizardShaft:
|
|||
|
||||
# Create Shaft object
|
||||
self.shaft = Shaft(self.doc)
|
||||
#self.shaft.featureWindow = featureWindow
|
||||
|
||||
# Assign a table widget to the dock window
|
||||
self.table = WizardShaftTable(self, self.shaft)
|
||||
wizardWidget.setWidget(self.table.widget)
|
||||
# Grab the newly created HTML window
|
||||
cw = mw.centralWidget()
|
||||
htmlWindow = cw.subWindowList()[-1]
|
||||
#self.shaft.htmlWindow = htmlWindow
|
||||
self.form = self.table.widget
|
||||
self.form.setWindowTitle("Shaft wizard")
|
||||
|
||||
def updateEdge(self, column, start):
|
||||
App.Console.PrintMessage("Not implemented yet - waiting for robust references...")
|
||||
return
|
||||
if self.sketchClosed is not True:
|
||||
return
|
||||
# Create a chamfer or fillet at the start or end edge of the segment
|
||||
if start is True:
|
||||
row = rowStartEdgeType
|
||||
idx = 0
|
||||
else:
|
||||
row = rowEndEdgeType
|
||||
idx = 1
|
||||
|
||||
edgeType = self.tableWidget.item(row, column).text().toAscii()[0].upper()
|
||||
if not ((edgeType == "C") or (edgeType == "F")):
|
||||
return # neither chamfer nor fillet defined
|
||||
|
||||
if edgeType == "C":
|
||||
objName = self.doc.addObject("PartDesign::Chamfer","ChamferShaft%u" % (column * 2 + idx))
|
||||
else:
|
||||
objName = self.doc.addObject("PartDesign::Fillet","FilletShaft%u" % (column * 2 + idx))
|
||||
if objName == "":
|
||||
return
|
||||
|
||||
edgeName = "Edge%u" % self.getEdgeIndex(column, idx, edgeType)
|
||||
self.doc.getObject(objName).Base = (self.doc.getObject("RevolutionShaft"),"[%s]" % edgeName)
|
||||
# etc. etc.
|
||||
|
||||
def getEdgeIndex(self, column, startIdx):
|
||||
# FIXME: This is impossible without robust references anchored in the sketch!!!
|
||||
return
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok)
|
||||
|
||||
class WizardShaftGui:
|
||||
def Activated(self):
|
||||
WizardShaft()
|
||||
FreeCADGui.Control.showDialog(TaskWizardShaft())
|
||||
|
||||
def GetResources(self):
|
||||
IconPath = FreeCAD.ConfigGet("AppHomePath") + "Mod/PartDesign/Gui/Resources/icons/WizardShaftIcon.png"
|
||||
|
|
Loading…
Reference in New Issue
Block a user