axis = parentPart.newObject('Part::FeaturePython', 'HoleAxis_'+str(instanceNum)) axis.ViewObject.Proxy = Asm4.setCustomIcon(axis,'Asm4_Hole.svg') axis.Shape = Part.Wire(Part.makeLine(pt1,pt2)) axis.Placement = circle.Placement axis.ViewObject.DrawStyle = 'Dashdot' axis.ViewObject.LineColor = (0.0,0.0,1.0) ''' axis.recompute() parentPart.recompute() """ +-----------------------------------------------+ | add the commands to the workbench | +-----------------------------------------------+ """ Gui.addCommand('Asm4_newPoint', newDatum('Point')) Gui.addCommand('Asm4_newAxis', newDatum('Axis')) Gui.addCommand('Asm4_newPlane', newDatum('Plane')) Gui.addCommand('Asm4_newLCS', newDatum('LCS')) Gui.addCommand('Asm4_newSketch', newDatum('Sketch')) Gui.addCommand('Asm4_newHole', newHole()) # defines the drop-down button for Datum objects createDatumList = [ 'Asm4_newLCS', 'Asm4_newPlane', 'Asm4_newAxis', 'Asm4_newPoint', 'Asm4_newHole' ] Gui.addCommand('Asm4_createDatum', Asm4.dropDownCmd(createDatumList, 'Create Datum Object'))
if not 'FSChangeParams' in Gui.listCommands(): Gui.activateWorkbench('FastenersWorkbench') Gui.activateWorkbench('Assembly4Workbench') # check that we have selected a Fastener from the Fastener WB selection = getSelectionFS() if selection == None: return Gui.runCommand('FSChangeParams') """ +-----------------------------------------------+ | add the commands to the workbench | +-----------------------------------------------+ """ Gui.addCommand( 'Asm4_insertScrew', insertFastener('Screw') ) Gui.addCommand( 'Asm4_insertNut', insertFastener('Nut') ) Gui.addCommand( 'Asm4_insertWasher', insertFastener('Washer') ) Gui.addCommand( 'Asm4_insertRod', insertFastener('ThreadedRod') ) Gui.addCommand( 'Asm4_placeFastener', placeFastenerCmd() ) Gui.addCommand( 'Asm4_FSparameters', changeFSparametersCmd() ) # defines the drop-down button for Fasteners: FastenersCmdList = [ 'Asm4_insertScrew', 'Asm4_insertNut', 'Asm4_insertWasher', 'Asm4_insertRod', 'Asm4_FSparameters'] Gui.addCommand( 'Asm4_Fasteners', Asm4.dropDownCmd( FastenersCmdList, 'Fasteners'))
# Cancel button self.CancelButton = QtGui.QPushButton('Cancel') # Delete button self.DelButton = QtGui.QPushButton('Delete') self.DelButton.setDefault(True) # the button layout self.buttonLayout.addWidget(self.CancelButton) self.buttonLayout.addStretch() self.buttonLayout.addWidget(self.DelButton) self.mainLayout.addLayout(self.buttonLayout) # finally, apply the layout to the main window self.UI.setLayout(self.mainLayout) # Actions self.varList.currentIndexChanged.connect(self.onSelectProp) self.CancelButton.clicked.connect(self.onCancel) self.DelButton.clicked.connect(self.onDel) """ +-----------------------------------------------+ | add the command to the workbench | +-----------------------------------------------+ """ Gui.addCommand('Asm4_addVariable', addVariable()) Gui.addCommand('Asm4_delVariable', delVariable()) variablesCmdList = ['Asm4_addVariable', 'Asm4_delVariable'] Gui.addCommand('Asm4_variablesCmd', Asm4.dropDownCmd(variablesCmdList, 'Variables'))
axis.MapMode = 'AxisOfCurvature' axis.MapReversed = False axis.ResizeMode = 'Manual' axis.Length = edgeObj.BoundBox.DiagonalLength axis.ViewObject.ShapeColor = (0.0,0.0,1.0) axis.ViewObject.Transparency = 50 axis.recompute() parentPart.recompute() """ +-----------------------------------------------+ | add the commands to the workbench | +-----------------------------------------------+ """ Gui.addCommand( 'Asm4_newPoint', newDatum('Point') ) Gui.addCommand( 'Asm4_newAxis', newDatum('Axis') ) Gui.addCommand( 'Asm4_newPlane', newDatum('Plane') ) Gui.addCommand( 'Asm4_newLCS', newDatum('LCS') ) Gui.addCommand( 'Asm4_newSketch',newDatum('Sketch')) Gui.addCommand( 'Asm4_newHole', newHole() ) # defines the drop-down button for Datum objects createDatumList = [ 'Asm4_newLCS', 'Asm4_newPlane', 'Asm4_newAxis', 'Asm4_newPoint', 'Asm4_newHole' ] Gui.addCommand( 'Asm4_createDatum', Asm4.dropDownCmd( createDatumList, 'Create Datum Object'))