本文整理汇总了Python中FreeCAD.ParamGet方法的典型用法代码示例。如果您正苦于以下问题:Python FreeCAD.ParamGet方法的具体用法?Python FreeCAD.ParamGet怎么用?Python FreeCAD.ParamGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FreeCAD
的用法示例。
在下文中一共展示了FreeCAD.ParamGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Activated
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def Activated(self):
# Grab our code editor so we can interact with it
cqCodePane = Shared.getActiveCodePane()
# If there are no windows open there is nothing to save
if cqCodePane == None:
FreeCAD.Console.PrintError("Nothing to save.\r\n")
return
# If the code pane doesn't have a filename, we need to present the save as dialog
if len(cqCodePane.get_path()) == 0 or os.path.basename(cqCodePane.get_path()) == 'script_template.py' \
or os.path.split(cqCodePane.get_path())[0].endswith('FreeCAD'):
FreeCAD.Console.PrintError("You cannot save over a blank file, example file or template file.\r\n")
CadQuerySaveAsScript().Activated()
return
# Rely on our export library to help us save the file
ExportCQ.save()
# Execute the script if the user has asked for it
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").GetBool("executeOnSave"):
CadQueryExecuteScript().Activated()
示例2: acceptSettings
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def acceptSettings(self):
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").SetInt("fontSize", self.ui_font_size.value())
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").SetString("executeKeybinding", self.ui_key_binding.text())
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").SetBool("executeOnSave", self.execute_on_save.checkState())
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").SetBool("showLineNumbers", self.show_line_numbers.checkState())
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/cadquery-freecad-module").SetBool("allowReload", self.allow_reload.checkState())
self.accept()
# def getValues(self):
# return {
# 'max': self.ui_max.value(),
# 'min': self.ui_min.value(),
# 'count': self.ui_count.value(),
# }
# def setValues(self, settings):
# self.ui_max.setValue(settings['max'])
# self.ui_min.setValue(settings['min'])
# self.ui_count.setValue(settings['count'])
示例3: unit_factor
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def unit_factor( self, unit_text, customScaleValue):
if unit_text != 'custom':
if unit_text == 'Edit->Preference->Unit':
#found using FreeCAD.ParamGet("User parameter:BaseApp/Preferences").Export('/tmp/p3')
UserSchema = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("UserSchema")
v = FreeCAD.Units.Quantity(1, FreeCAD.Units.Length ).getUserPreferred()[1]
else:
UserSchema = ['mm','m','inch'].index( unit_text )
if UserSchema == 0: #standard (mm/kg/s/degree
v = 1.0
elif UserSchema == 1: #standard (m/kg/s/degree)
v = 1000.0
else: #either US customary, or Imperial decimal
v = 25.4
else:
v = customScaleValue
return 1.0/v if v != 0 else 1.0
示例4: Activated
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def Activated(self):
try:
taskd = SMUnfoldTaskPanel()
except ValueError as e:
SMErrorBox(e.args[0])
return
pg = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/sheetmetal")
if pg.GetBool("bendSketch"):
taskd.checkSeparate.setCheckState(QtCore.Qt.CheckState.Checked)
else:
taskd.checkSeparate.setCheckState(QtCore.Qt.CheckState.Unchecked)
if pg.GetBool("genSketch"):
taskd.checkSketch.setCheckState(QtCore.Qt.CheckState.Checked)
else:
taskd.checkSketch.setCheckState(QtCore.Qt.CheckState.Unchecked)
taskd.bendColor.setColor(pg.GetString("bendColor"))
taskd.genColor.setColor(pg.GetString("genColor"))
taskd.internalColor.setColor(pg.GetString("intColor"))
FreeCADGui.Control.showDialog(taskd)
return
示例5: checkBOP
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def checkBOP(shape):
""" checking BOP errors of a shape
returns:
- True if Shape is Valid
- the Shape errors
"""
# enabling BOP check
paramGt = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Part/CheckGeometry")
paramGt.SetBool("RunBOPCheck",True)
try:
shape.check(True)
return True
except Exception:
return sys.exc_info()[1] #ValueError #sys.exc_info() #False
##
#from an argument string, extract a list of numbers
#numbers can be individual e.g. "3"
#numbers can be comma delimited e.g. "3,5"
#numbers can be in a range e.g. "3-8"
#numbers can't be < 1
示例6: checkBOP
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def checkBOP(shape):
""" checking BOP errors of a shape
returns:
- True if Shape is Valid
- the Shape errors
"""
# enabling BOP check
paramGt = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Part/CheckGeometry")
paramGt.SetBool("RunBOPCheck",True)
try:
shape.check(True)
return True
except:
return sys.exc_info()[1] #ValueError #sys.exc_info() #False
##
示例7: __init__
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def __init__(self):
self._attached = False
self.timer = QtCore.QTimer()
self.timer.setSingleShot(True)
self.timer.timeout.connect(self.onTimer)
self.cmds = []
self.elements = dict()
self.attach()
# Check for SoFCSwitch to see if we are running in a version of FC that
# actually supports ShowSelectionOnTop.
if coin.SoType.fromName("SoFCSwitch").isBad():
self.viewParam = None
else:
self.viewParam = FreeCAD.ParamGet('User parameter:BaseApp/Preferences/View')
示例8: getToolbarParams
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def getToolbarParams():
return FreeCAD.ParamGet('User parameter:BaseApp/MainWindow/Toolbars')
示例9: getParamGroup
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def getParamGroup(mcs):
return FreeCAD.ParamGet(
'User parameter:BaseApp/Preferences/Mod/Assembly3')
示例10: importMode
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def importMode(cls):
params = FreeCAD.ParamGet(
'User parameter:BaseApp/Preferences/Mod/Import')
mode = params.GetInt('ImportMode',0)
if not mode:
mode = 2
return mode
示例11: __init__
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def __init__(self,winTitle='Rotate WP', icon='rotWP.svg'):
super(rotWPForm,self).__init__()
self.move(QPoint(100,250))
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.setWindowTitle(winTitle)
iconPath=join(dirname(abspath(__file__)),"icons",icon)
from PySide.QtGui import QIcon
Icon=QIcon()
Icon.addFile(iconPath)
self.setWindowIcon(Icon)
self.grid=QGridLayout()
self.setLayout(self.grid)
self.radioX=QRadioButton('X')
self.radioX.setChecked(True)
self.radioY=QRadioButton('Y')
self.radioZ=QRadioButton('Z')
self.lab1=QLabel('Angle:')
self.edit1=QLineEdit('45')
self.edit1.setAlignment(Qt.AlignCenter)
self.edit1.setValidator(QDoubleValidator())
self.btn1=QPushButton('Rotate working plane')
self.btn1.clicked.connect(self.rotate)
self.grid.addWidget(self.radioX,0,0,1,1,Qt.AlignCenter)
self.grid.addWidget(self.radioY,0,1,1,1,Qt.AlignCenter)
self.grid.addWidget(self.radioZ,0,2,1,1,Qt.AlignCenter)
self.grid.addWidget(self.lab1,1,0,1,1)
self.grid.addWidget(self.edit1,1,1,1,2)
self.grid.addWidget(self.btn1,2,0,1,3,Qt.AlignCenter)
self.show()
self.sg=FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
sc=[float(x*s) for x in [1,1,.2]]
from polarUtilsCmd import arrow
self.arrow =arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
示例12: offsetWP
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def offsetWP(self):
if hasattr(FreeCAD,'DraftWorkingPlane') and hasattr(FreeCADGui,'Snapper'):
s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
sc=[float(x*s) for x in [1,1,.2]]
varrow =polarUtilsCmd.arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
offset=QInputDialog.getInteger(None,'Offset Work Plane','Offset: ')
if offset[1]:
polarUtilsCmd.offsetWP(offset[0])
FreeCADGui.ActiveDocument.ActiveView.getSceneGraph().removeChild(varrow.node)
示例13: offsetWP
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def offsetWP(self):
if hasattr(FreeCAD,'DraftWorkingPlane') and hasattr(FreeCADGui,'Snapper'):
s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
sc=[float(x*s) for x in [1,1,.2]]
varrow =arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
offset=QInputDialog.getInteger(None,'Offset Work Plane','Offset: ')
if offset[1]:
offsetWP(offset[0])
FreeCADGui.ActiveDocument.ActiveView.getSceneGraph().removeChild(varrow.node)
示例14: Activated
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def Activated(self):
if hasattr(FreeCAD,'DraftWorkingPlane') and hasattr(FreeCADGui,'Snapper'):
import polarUtilsCmd
s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
sc=[float(x*s) for x in [1,1,.2]]
arrow =polarUtilsCmd.arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
from PySide.QtGui import QInputDialog as qid
offset=qid.getInteger(None,'Offset Work Plane','Offset: ')
if offset[1]:
polarUtilsCmd.offsetWP(offset[0])
#FreeCADGui.ActiveDocument.ActiveView.getSceneGraph().removeChild(arrow.node)
arrow.closeArrow()
示例15: doNotImportInvisibleShapes
# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import ParamGet [as 别名]
def doNotImportInvisibleShapes():
preferences = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/A2plus")
return preferences.GetBool('doNotImportInvisibleShapes',True)
#------------------------------------------------------------------------------