def __init__(self, obj, models, templateFile = None): self.obj = obj obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","The NC output file for this project")) obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","Select the Post Processor")) obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Arguments for the Post Processor (specific to the script)")) obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("PathJob","An optional description for this job")) obj.addProperty("App::PropertyString", "CycleTime", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Operations Cycle Time Estimation")) obj.setEditorMode('CycleTime', 1) # read-only obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("PathJob", "For computing Paths; smaller increases accuracy, but slows down computation")) 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.addProperty("App::PropertyBool", "SplitOutput", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","Split output into multiple gcode files")) obj.addProperty("App::PropertyEnumeration", "OrderOutputBy", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "If multiple WCS, order the output this way")) obj.addProperty("App::PropertyStringList", "Fixtures", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "The Work Coordinate Systems for the Job")) obj.OrderOutputBy = ['Fixture', 'Tool', 'Operation'] obj.Fixtures = ['G54'] 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") if ops.ViewObject: ops.ViewObject.Proxy = 0 ops.ViewObject.Visibility = False obj.Operations = ops obj.setEditorMode('Operations', 2) # hide obj.setEditorMode('Placement', 2) self.setupSetupSheet(obj) self.setupBaseModel(obj, models) self.tooltip = None self.tooltipArgs = None 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, models, templateFile = None): self.obj = obj obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","The NC output file for this project")) obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","Select the Post Processor")) obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Arguments for the Post Processor (specific to the script)")) obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("PathJob","An optional description for this job")) obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("PathJob", "For computing Paths; smaller increases accuracy, but slows down computation")) 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.addProperty("App::PropertyBool", "SplitOutput", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","Split output into multiple gcode files")) obj.addProperty("App::PropertyEnumeration", "OrderOutputBy", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "If multiple WCS, order the output this way")) obj.addProperty("App::PropertyStringList", "Fixtures", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "The Work Coordinate Systems for the Job")) obj.OrderOutputBy = ['Fixture', 'Tool', 'Operation'] obj.Fixtures = ['G54'] 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") if ops.ViewObject: ops.ViewObject.Proxy = 0 ops.ViewObject.Visibility = False obj.Operations = ops obj.setEditorMode('Operations', 2) # hide obj.setEditorMode('Placement', 2) self.setupSetupSheet(obj) self.setupBaseModel(obj, models) 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, vobj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction( translate("Path_Job", "Edit Job")) self.vobj = vobj self.vproxy = vobj.Proxy self.obj = vobj.Object self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/PathEdit.ui") self.template = PathJobCmd.DlgJobTemplateExport( self.obj, self.form.jobBox.widget(1)) 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 base = self.obj.Base if PathJob.isResourceClone(self.obj, 'Base') else None stock = self.obj.Stock for o in PathJob.ObjectJob.baseCandidates(): if o != base and o != stock: 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.vproxy.setupEditVisibility(self.obj) self.stockFromBase = None self.stockFromExisting = None self.stockCreateBox = None self.stockCreateCylinder = None self.stockEdit = None self.setupGlobal = PathSetupSheetGui.GlobalEditor( self.obj.SetupSheet, self.form) self.setupOps = PathSetupSheetGui.OpsDefaultEditor( self.obj.SetupSheet, self.form)
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, vobj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction(translate("Path_Job", "Edit Job")) self.vobj = vobj self.vproxy = vobj.Proxy self.obj = vobj.Object self.deleteOnReject = deleteOnReject self.form = FreeCADGui.PySideUic.loadUi(":/panels/PathEdit.ui") self.template = PathJobCmd.DlgJobTemplateExport(self.obj, self.form.jobBox.widget(1)) 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 base = self.obj.Base if PathJob.isResourceClone(self.obj, 'Base') else None stock = self.obj.Stock for o in PathJob.ObjectJob.baseCandidates(): if o != base and o != stock: 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.vproxy.setupEditVisibility(self.obj) self.stockFromBase = None self.stockFromExisting = None self.stockCreateBox = None self.stockCreateCylinder = None self.stockEdit = None self.setupGlobal = PathSetupSheetGui.GlobalEditor(self.obj.SetupSheet, self.form) self.setupOps = PathSetupSheetGui.OpsDefaultEditor(self.obj.SetupSheet, self.form)
def __init__(self, obj, models, templateFile=None): self.obj = obj self.tooltip = None self.tooltipArgs = None obj.Proxy = self obj.addProperty( "App::PropertyFile", "PostProcessorOutputFile", "Output", QT_TRANSLATE_NOOP("App::Property", "The NC output file for this project"), ) obj.addProperty( "App::PropertyEnumeration", "PostProcessor", "Output", QT_TRANSLATE_NOOP("App::Property", "Select the Post Processor"), ) obj.addProperty( "App::PropertyString", "PostProcessorArgs", "Output", QT_TRANSLATE_NOOP( "App::Property", "Arguments for the Post Processor (specific to the script)", ), ) obj.addProperty( "App::PropertyString", "LastPostProcessDate", "Output", QT_TRANSLATE_NOOP("App::Property", "Last Time the Job was post-processed"), ) obj.setEditorMode("LastPostProcessDate", 2) # Hide obj.addProperty( "App::PropertyString", "LastPostProcessOutput", "Output", QT_TRANSLATE_NOOP("App::Property", "Last Time the Job was post-processed"), ) obj.setEditorMode("LastPostProcessOutput", 2) # Hide obj.addProperty( "App::PropertyString", "Description", "Path", QT_TRANSLATE_NOOP("App::Property", "An optional description for this job"), ) obj.addProperty( "App::PropertyString", "CycleTime", "Path", QT_TRANSLATE_NOOP("App::Property", "Job Cycle Time Estimation"), ) obj.setEditorMode("CycleTime", 1) # read-only obj.addProperty( "App::PropertyDistance", "GeometryTolerance", "Geometry", QT_TRANSLATE_NOOP( "App::Property", "For computing Paths; smaller increases accuracy, but slows down computation", ), ) obj.addProperty( "App::PropertyLink", "Stock", "Base", QT_TRANSLATE_NOOP("App::Property", "Solid object to be used as stock."), ) obj.addProperty( "App::PropertyLink", "Operations", "Base", QT_TRANSLATE_NOOP( "App::Property", "Compound path of all operations in the order they are processed.", ), ) obj.addProperty( "App::PropertyEnumeration", "JobType", "Base", QT_TRANSLATE_NOOP("App::Property", "Select the Type of Job"), ) obj.setEditorMode("JobType", 2) # Hide obj.addProperty( "App::PropertyBool", "SplitOutput", "Output", QT_TRANSLATE_NOOP("App::Property", "Split output into multiple gcode files"), ) obj.addProperty( "App::PropertyEnumeration", "OrderOutputBy", "WCS", QT_TRANSLATE_NOOP("App::Property", "If multiple WCS, order the output this way"), ) obj.addProperty( "App::PropertyStringList", "Fixtures", "WCS", QT_TRANSLATE_NOOP("App::Property", "The Work Coordinate Systems for the Job"), ) obj.Fixtures = ["G54"] for n in self.propertyEnumerations(): setattr(obj, n[0], n[1]) obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile() 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() self.setupOperations(obj) self.setupSetupSheet(obj) self.setupBaseModel(obj, models) self.setupToolTable(obj) self.setFromTemplateFile(obj, templateFile) self.setupStock(obj)
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") if ops.ViewObject: ops.ViewObject.Proxy = 0 ops.ViewObject.Visibility = False 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