def __init__(self, obj): # obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project") obj.addProperty("App::PropertyFile", "OutputFile", "CodeOutput", QtCore.QT_TRANSLATE_NOOP("App::Property","The NC output file for this project")) obj.OutputFile = PathPreferences.defaultOutputFile() obj.setEditorMode("OutputFile", 0) # set to default mode obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","An optional description for this job")) obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Select the Post Processor")) obj.PostProcessor = PathPreferences.allEnabledPostProcessors(['']) obj.PostProcessor = PathPreferences.defaultPostProcessor() obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property", "Arguments for the Post Processor (specific to the script)")) obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs() obj.addProperty("App::PropertyString", "MachineName", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Name of the Machine that will use the CNC program")) obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", QtCore.QT_TRANSLATE_NOOP("App::Property","The tooltable used for this CNC program")) obj.addProperty("App::PropertyEnumeration", "MachineUnits", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Units that the machine works in, ie Metric or Inch")) obj.MachineUnits = ['Metric', 'Inch'] obj.addProperty("App::PropertyDistance", "X_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Y_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Z_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "X_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Y_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Z_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyLink", "Base", "Base", "The base object for all operations") obj.Proxy = self if FreeCAD.GuiUp: ViewProviderJob(obj.ViewObject)
def __init__(self, obj): obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","The NC output file for this project")) obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile() obj.setEditorMode("PostProcessorOutputFile", 0) # set to default mode obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Select the Post Processor")) obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors() defaultPostProcessor = PathPreferences.defaultPostProcessor() # Check to see if default post processor hasn't been 'lost' (This can happen when Macro dir has changed) if defaultPostProcessor in postProcessors: obj.PostProcessor = defaultPostProcessor else: obj.PostProcessor = postProcessors[0] obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property", "Arguments for the Post Processor (specific to the script)")) obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs() obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","An optional description for this job")) obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("App::Property", "For computing Paths; smaller increases accuracy, but slows down computation")) obj.GeometryTolerance = PathPreferences.defaultGeometryTolerance() obj.addProperty("App::PropertyLink", "Base", "Base", "The base object for all operations") obj.Proxy = self if FreeCAD.GuiUp: ViewProviderJob(obj.ViewObject)
def __init__(self, obj): # obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project") obj.addProperty("App::PropertyFile", "OutputFile", "CodeOutput", QtCore.QT_TRANSLATE_NOOP("App::Property","The NC output file for this project")) obj.OutputFile = PathPreferences.defaultOutputFile() obj.setEditorMode("OutputFile", 0) # set to default mode obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","An optional description for this job")) obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Select the Post Processor")) obj.PostProcessor = PathPreferences.allEnabledPostProcessors(['']) obj.PostProcessor = PathPreferences.defaultPostProcessor() obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property", "Arguments for the Post Processor (specific to the script)")) obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs() obj.addProperty("App::PropertyString", "MachineName", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Name of the Machine that will use the CNC program")) obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", QtCore.QT_TRANSLATE_NOOP("App::Property","The tooltable used for this CNC program")) obj.addProperty("App::PropertyEnumeration", "MachineUnits", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Units that the machine works in, ie Metric or Inch")) obj.MachineUnits = ['Metric', 'Inch'] obj.addProperty("App::PropertyDistance", "X_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Y_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Z_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "X_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Y_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Z_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyLink", "Base", "Base", "The base object for all operations") obj.Proxy = self if FreeCAD.GuiUp: ViewProviderJob(obj.ViewObject)
def __init__(self, obj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction( translate("Path_Job", "Edit Job")) self.obj = obj self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/JobEdit.ui") #self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Path/JobEdit.ui") currentPostProcessor = obj.PostProcessor postProcessors = PathPreferences.allEnabledPostProcessors( ['', currentPostProcessor]) for post in postProcessors: self.form.cboPostProcessor.addItem(post) # update the enumeration values, just to make sure all selections are valid self.obj.PostProcessor = postProcessors self.obj.PostProcessor = currentPostProcessor self.form.cboBaseObject.addItem("") for o in FreeCAD.ActiveDocument.Objects: if hasattr(o, "Shape"): self.form.cboBaseObject.addItem(o.Name) self.postProcessorDefaultTooltip = self.form.cboPostProcessor.toolTip() self.postProcessorArgsDefaultTooltip = self.form.cboPostProcessorArgs.toolTip( )
def __init__(self, vobj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction( translate("Path_Job", "Edit Job")) self.vobj = vobj self.obj = vobj.Object self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/PathEdit.ui") vUnit = FreeCAD.Units.Quantity( 1, FreeCAD.Units.Velocity).getUserPreferred()[2] self.form.toolControllerList.horizontalHeaderItem(1).setText('#') self.form.toolControllerList.horizontalHeaderItem(2).setText(vUnit) self.form.toolControllerList.horizontalHeaderItem(3).setText(vUnit) self.form.toolControllerList.horizontalHeader().setResizeMode( 0, QtGui.QHeaderView.Stretch) self.form.toolControllerList.resizeColumnsToContents() currentPostProcessor = self.obj.PostProcessor postProcessors = PathPreferences.allEnabledPostProcessors( ['', currentPostProcessor]) for post in postProcessors: self.form.postProcessor.addItem(post) # update the enumeration values, just to make sure all selections are valid self.obj.PostProcessor = postProcessors self.obj.PostProcessor = currentPostProcessor for o in PathJob.ObjectJob.baseCandidates(): if o != self.obj.Base: self.form.jobModel.addItem(o.Label, o) self.selectComboBoxText(self.form.jobModel, self.obj.Proxy.baseObject(self.obj).Label) self.postProcessorDefaultTooltip = self.form.postProcessor.toolTip() self.postProcessorArgsDefaultTooltip = self.form.postProcessorArguments.toolTip( ) self.baseVisibility = False self.baseOrigVisibilty = False if self.obj.Base and self.obj.Base.ViewObject: self.baseVisibility = self.obj.Base.ViewObject.Visibility self.baseObjectSaveVisibility(self.obj) self.stockVisibility = False if self.obj.Stock and self.obj.Stock.ViewObject: self.stockVisibility = self.obj.Stock.ViewObject.Visibility self.obj.Stock.ViewObject.Visibility = True self.stockFromBase = None self.stockFromExisting = None self.stockCreateBox = None self.stockCreateCylinder = None self.stockEdit = None
def __init__(self, vobj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Edit Job")) self.vobj = vobj self.obj = vobj.Object self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/PathEdit.ui") vUnit = FreeCAD.Units.Quantity(1, FreeCAD.Units.Velocity).getUserPreferred()[2] self.form.toolControllerList.horizontalHeaderItem(1).setText('#') self.form.toolControllerList.horizontalHeaderItem(2).setText(vUnit) self.form.toolControllerList.horizontalHeaderItem(3).setText(vUnit) self.form.toolControllerList.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.Stretch) self.form.toolControllerList.resizeColumnsToContents() currentPostProcessor = self.obj.PostProcessor postProcessors = PathPreferences.allEnabledPostProcessors(['', currentPostProcessor]) for post in postProcessors: self.form.postProcessor.addItem(post) # update the enumeration values, just to make sure all selections are valid self.obj.PostProcessor = postProcessors self.obj.PostProcessor = currentPostProcessor for o in PathJob.ObjectJob.baseCandidates(): if o != self.obj.Base: self.form.jobModel.addItem(o.Label, o) self.selectComboBoxText(self.form.jobModel, self.obj.Proxy.baseObject(self.obj).Label) self.postProcessorDefaultTooltip = self.form.postProcessor.toolTip() self.postProcessorArgsDefaultTooltip = self.form.postProcessorArguments.toolTip() self.baseVisibility = False self.baseOrigVisibilty = False if self.obj.Base and self.obj.Base.ViewObject: self.baseVisibility = self.obj.Base.ViewObject.Visibility self.baseObjectSaveVisibility(self.obj) self.stockVisibility = False if self.obj.Stock and self.obj.Stock.ViewObject: self.stockVisibility = self.obj.Stock.ViewObject.Visibility self.obj.Stock.ViewObject.Visibility = True self.stockFromBase = None self.stockFromExisting = None self.stockCreateBox = None self.stockCreateCylinder = None self.stockEdit = None
def __init__(self, parent=None): self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui") firstItem = None for post in PathPreferences.allEnabledPostProcessors(): item = QtGui.QListWidgetItem(post) item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.dialog.lwPostProcessor.addItem(item) if not firstItem: firstItem = item if firstItem: self.dialog.lwPostProcessor.setCurrentItem(firstItem) else: self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) self.tooltips = {} self.dialog.lwPostProcessor.itemDoubleClicked.connect(self.dialog.accept) self.dialog.lwPostProcessor.setMouseTracking(True) self.dialog.lwPostProcessor.itemEntered.connect(self.updateTooltip)
def __init__(self, parent=None): self.dialog = FreeCADGui.PySideUic.loadUi(":/panels/DlgSelectPostProcessor.ui") firstItem = None for post in PathPreferences.allEnabledPostProcessors(): item = QtGui.QListWidgetItem(post) item.setFlags(QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled) self.dialog.lwPostProcessor.addItem(item) if not firstItem: firstItem = item if firstItem: self.dialog.lwPostProcessor.setCurrentItem(firstItem) else: self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) self.tooltips = {} self.dialog.lwPostProcessor.itemDoubleClicked.connect(self.dialog.accept) self.dialog.lwPostProcessor.setMouseTracking(True) self.dialog.lwPostProcessor.itemEntered.connect(self.updateTooltip)
def __init__(self, obj, base, templateFile = None): self.obj = obj obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","The NC output file for this project")) obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Select the Post Processor")) obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property", "Arguments for the Post Processor (specific to the script)")) obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","An optional description for this job")) obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("App::Property", "For computing Paths; smaller increases accuracy, but slows down computation")) obj.addProperty("App::PropertyLink", "Base", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "The base object for all operations")) obj.addProperty("App::PropertyLink", "Stock", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Solid object to be used as stock.")) obj.addProperty("App::PropertyLink", "Operations", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Compound path of all operations in the order they are processed.")) obj.addProperty("App::PropertyLinkList", "ToolController", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Collection of tool controllers available for this job.")) obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile() #obj.setEditorMode("PostProcessorOutputFile", 0) # set to default mode obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors() defaultPostProcessor = PathPreferences.defaultPostProcessor() # Check to see if default post processor hasn't been 'lost' (This can happen when Macro dir has changed) if defaultPostProcessor in postProcessors: obj.PostProcessor = defaultPostProcessor else: obj.PostProcessor = postProcessors[0] obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs() obj.GeometryTolerance = PathPreferences.defaultGeometryTolerance() ops = FreeCAD.ActiveDocument.addObject("Path::FeatureCompoundPython", "Operations") obj.Operations = ops obj.setEditorMode('Operations', 2) # hide obj.setEditorMode('Placement', 2) self.setupSetupSheet(obj) obj.Base = createResourceClone(obj, base, 'Base', 'BaseGeometry') obj.Proxy = self self.setFromTemplateFile(obj, templateFile) if not obj.Stock: stockTemplate = PathPreferences.defaultStockTemplate() if stockTemplate: obj.Stock = PathStock.CreateFromTemplate(obj, json.loads(stockTemplate)) if not obj.Stock: obj.Stock = PathStock.CreateFromBase(obj) if obj.Stock.ViewObject: obj.Stock.ViewObject.Visibility = False
def __init__(self, obj): # obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project") obj.addProperty("App::PropertyFile", "OutputFile", "CodeOutput", QtCore.QT_TRANSLATE_NOOP("App::Property","The NC output file for this project")) obj.OutputFile = PathPreferences.defaultOutputFile() obj.setEditorMode("OutputFile", 0) # set to default mode obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property","An optional description for this job")) obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Select the Post Processor")) obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors() defaultPostProcessor = PathPreferences.defaultPostProcessor() # Check to see if default post processor hasn't been 'lost' (This can happen when Macro dir has changed) if defaultPostProcessor in postProcessors: obj.PostProcessor = defaultPostProcessor else: obj.PostProcessor = postProcessors[0] obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property", "Arguments for the Post Processor (specific to the script)")) obj.PostProcessorArgs = PathPreferences.defaultPostProcessorArgs() obj.addProperty("App::PropertyString", "MachineName", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Name of the Machine that will use the CNC program")) #obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", QtCore.QT_TRANSLATE_NOOP("App::Property","The tooltable used for this CNC program")) obj.addProperty("App::PropertyEnumeration", "MachineUnits", "Output", QtCore.QT_TRANSLATE_NOOP("App::Property","Units that the machine works in, ie Metric or Inch")) obj.MachineUnits = ['Metric', 'Inch'] obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("App::Property", "For computing Paths; smaller increases accuracy, but slows down computation")) obj.GeometryTolerance = PathPreferences.defaultGeometryTolerance() obj.addProperty("App::PropertyDistance", "X_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Y_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Z_Max", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Maximum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "X_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Y_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyDistance", "Z_Min", "Limits", QtCore.QT_TRANSLATE_NOOP("App::Property","The Minimum distance in X the machine can travel")) obj.addProperty("App::PropertyLink", "Base", "Base", "The base object for all operations") obj.Proxy = self if FreeCAD.GuiUp: ViewProviderJob(obj.ViewObject)
def __init__(self, obj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Edit Job")) self.obj = obj self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/JobEdit.ui") #self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Path/JobEdit.ui") currentPostProcessor = obj.PostProcessor postProcessors = PathPreferences.allEnabledPostProcessors(['', currentPostProcessor]) for post in postProcessors: self.form.cboPostProcessor.addItem(post) # update the enumeration values, just to make sure all selections are valid self.obj.PostProcessor = postProcessors self.obj.PostProcessor = currentPostProcessor self.form.cboBaseObject.addItem("") for o in FreeCAD.ActiveDocument.Objects: if hasattr(o, "Shape"): self.form.cboBaseObject.addItem(o.Name) self.postProcessorDefaultTooltip = self.form.cboPostProcessor.toolTip() self.postProcessorArgsDefaultTooltip = self.form.cboPostProcessorArgs.toolTip()