本文整理匯總了Python中FreeCADGui.SendMsgToActiveView方法的典型用法代碼示例。如果您正苦於以下問題:Python FreeCADGui.SendMsgToActiveView方法的具體用法?Python FreeCADGui.SendMsgToActiveView怎麽用?Python FreeCADGui.SendMsgToActiveView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FreeCADGui
的用法示例。
在下文中一共展示了FreeCADGui.SendMsgToActiveView方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Activated
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def Activated(self):
cb = QtGui.QApplication.clipboard()
t=cb.text()
if t[0:5] == '<?xml':
h = importSVG.svgHandler()
doc = FreeCAD.ActiveDocument
if not doc:
doc = FreeCAD.newDocument("SvgImport")
h.doc = doc
xml.sax.parseString(t,h)
doc.recompute()
FreeCADGui.SendMsgToActiveView("ViewFit")
else:
FreeCAD.Console.PrintError('Invalid clipboard content.\n')
#def IsActive(self):
#return(True)
示例2: makeFeature
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def makeFeature(self, sub, pts, typ):
fp = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Freehand BSpline")
proxy = GordonProfileFP(fp,sub,pts,typ)
GordonProfileVP(fp.ViewObject)
FreeCAD.Console.PrintMessage(GordonProfileCommand.docu)
FreeCAD.ActiveDocument.recompute()
FreeCADGui.SendMsgToActiveView("ViewFit")
fp.ViewObject.Document.setEdit(fp.ViewObject)
示例3: Activated
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def Activated(self):
Gui.doCommandGui("import freecad.gears.commands")
Gui.doCommandGui("freecad.gears.commands.{}.create()".format(
self.__class__.__name__))
FreeCAD.ActiveDocument.recompute()
Gui.SendMsgToActiveView("ViewFit")
示例4: GuiViewFit
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def GuiViewFit(self):
FreeCADGui.SendMsgToActiveView("ViewFit")
self.timer.stop()
示例5: Activated
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def Activated(self):
doc = FreeCAD.activeDocument()
try:
doc.save()
FreeCAD.closeDocument(doc.Name)
except:
FreeCADGui.SendMsgToActiveView("Save")
if not FreeCADGui.activeDocument().Modified: # user really saved the file
FreeCAD.closeDocument(doc.Name)
#
mw = FreeCADGui.getMainWindow()
mdi = mw.findChild(QtGui.QMdiArea)
sub = mdi.activeSubWindow()
if sub != None:
sub.showMaximized()
示例6: makeSolidExpSTEP
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def makeSolidExpSTEP():
doc=FreeCAD.ActiveDocument
docG = FreeCADGui.ActiveDocument
if doc is not None:
fname = doc.FileName
if len(fname) == 0:
fileNm='untitled'
else:
fileNm = os.path.basename(fname)
fileNm = os.path.splitext(fileNm)[0]
tempdir = tempfile.gettempdir() # get the current temporary directory
#print(tempdir)
#fileNm = os.path.basename(fname)
# tempfilepath = os.path.join(tempdir,fname.rstrip(".fcstd").rstrip(".FCStd") + u'_cp.stp')
tempfilepath = os.path.join(tempdir,fileNm + u'_cp.stp')
print(tempfilepath)
sel=FreeCADGui.Selection.getSelection()
if len (sel) == 1:
__objs__=[]
__objs__.append(sel[0])
import ImportGui
stop
ImportGui.export(__objs__,tempfilepath)
del __objs__
# docG.getObject(sel[0].Name).Visibility = False
ImportGui.insert(tempfilepath,doc.Name)
FreeCADGui.SendMsgToActiveView("ViewFit")
else:
FreeCAD.Console.PrintError('Select only one object')
else:
FreeCAD.Console.PrintError('Select only one object')
##
示例7: refresh_gui
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def refresh_gui():
store=saveGraph(False)
# say(store)
loadGraph(store)
return
sayl("REFRESH---------")
hidePyFlow()
# tempd=pfwrap.getInstance().getTempDirectory()
instance=pfwrap.getInstance()
saveData = instance.graphManager.get().serialize()
gg=pfwrap.getGraphManager().getAllGraphs()[0]
say(gg)
#geaendert
# saveData = pfwrap.getGraphManager().serialize()
# saveData = pfwrap.getGraphManager().serialize()
# json.dump(saveData, f, indent=4)
#saveData = gg.serialize()
sayl("naCH SE")
import tempfile
f = tempfile.NamedTemporaryFile(delete=False)
fpath= f.name
say("HUEW")
say(saveData)
say(f)
say("---------------")
json.dump(saveData, f, indent=4)
f.close()
say("fname",fpath)
sayl("CCC")
with open(fpath, 'r') as f:
data = json.load(f)
FreeCAD.data=data
pfwrap.getInstance().loadFromData(data, fpath)
sayl("huhu")
pfwrap.getInstance().show()
clearLogger()
FreeCADGui.activeDocument().activeView().viewIsometric()
FreeCADGui.SendMsgToActiveView("ViewFit")
示例8: make_3D_model
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def make_3D_model(models_dir, model_class, modelID):
LIST_license = ["",]
CheckedmodelName = modelID.replace('.', '').replace('-', '_').replace('(', '').replace(')', '')
Newdoc = App.newDocument(CheckedmodelName)
App.setActiveDocument(CheckedmodelName)
Gui.ActiveDocument=Gui.getDocument(CheckedmodelName)
destination_dir = model_class.get_dest_3D_dir(modelID)
material_substitutions = model_class.make_3D_model(modelID)
modelName = model_class.get_model_name(modelID)
doc = FreeCAD.ActiveDocument
doc.Label = CheckedmodelName
objs=GetListOfObjects(FreeCAD, doc)
objs[0].Label = CheckedmodelName
restore_Main_Tools()
script_dir=os.path.dirname(os.path.realpath(__file__))
expVRML.say(models_dir)
out_dir=models_dir+os.sep+destination_dir
if not os.path.exists(out_dir):
os.makedirs(out_dir)
exportSTEP(doc, modelName, out_dir)
if LIST_license[0]=="":
LIST_license=Lic.LIST_int_license
LIST_license.append("")
Lic.addLicenseToStep(out_dir + os.sep, modelName+".step", LIST_license,\
STR_licAuthor, STR_licEmail, STR_licOrgSys, STR_licOrg, STR_licPreProc)
# scale and export Vrml model
scale=1/2.54
#exportVRML(doc,modelName,scale,out_dir)
del objs
objs=GetListOfObjects(FreeCAD, doc)
expVRML.say("######################################################################")
expVRML.say(objs)
expVRML.say("######################################################################")
export_objects, used_color_keys = expVRML.determineColors(Gui, objs, material_substitutions)
export_file_name=out_dir+os.sep+modelName+'.wrl'
colored_meshes = expVRML.getColoredMesh(Gui, export_objects , scale)
#expVRML.writeVRMLFile(colored_meshes, export_file_name, used_color_keys)# , LIST_license
expVRML.writeVRMLFile(colored_meshes, export_file_name, used_color_keys, LIST_license)
#scale=0.3937001
#exportVRML(doc,modelName,scale,out_dir)
# Save the doc in Native FC format
saveFCdoc(App, Gui, doc, modelName,out_dir)
#display BBox
Gui.activateWorkbench("PartWorkbench")
Gui.SendMsgToActiveView("ViewFit")
Gui.activeDocument().activeView().viewAxometric()
#FreeCADGui.ActiveDocument.activeObject.BoundingBox = True
示例9: make_3D_model
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def make_3D_model(models_dir, model_class, modelID):
LIST_license = ["",]
CheckedmodelName = 'A_' + modelID.replace('.', '').replace('-', '_').replace('(', '').replace(')', '')
CheckedmodelName = CheckedmodelName
Newdoc = App.newDocument(CheckedmodelName)
App.setActiveDocument(CheckedmodelName)
Gui.ActiveDocument=Gui.getDocument(CheckedmodelName)
destination_dir = model_class.get_dest_3D_dir(modelID)
material_substitutions = model_class.make_3D_model(modelID)
modelName = model_class.get_model_name(modelID)
doc = FreeCAD.ActiveDocument
doc.Label = CheckedmodelName
objs=GetListOfObjects(FreeCAD, doc)
objs[0].Label = CheckedmodelName
restore_Main_Tools()
script_dir=os.path.dirname(os.path.realpath(__file__))
expVRML.say(models_dir)
out_dir=models_dir+os.sep+destination_dir
if not os.path.exists(out_dir):
os.makedirs(out_dir)
exportSTEP(doc, modelName, out_dir)
if LIST_license[0]=="":
LIST_license=Lic.LIST_int_license
LIST_license.append("")
Lic.addLicenseToStep(out_dir + os.sep, modelName+".step", LIST_license,\
STR_licAuthor, STR_licEmail, STR_licOrgSys, STR_licOrg, STR_licPreProc)
# scale and export Vrml model
scale=1/2.54
#exportVRML(doc,modelName,scale,out_dir)
del objs
objs=GetListOfObjects(FreeCAD, doc)
expVRML.say("######################################################################")
expVRML.say(objs)
expVRML.say("######################################################################")
export_objects, used_color_keys = expVRML.determineColors(Gui, objs, material_substitutions)
export_file_name=out_dir+os.sep+modelName+'.wrl'
colored_meshes = expVRML.getColoredMesh(Gui, export_objects , scale)
#expVRML.writeVRMLFile(colored_meshes, export_file_name, used_color_keys)# , LIST_license
expVRML.writeVRMLFile(colored_meshes, export_file_name, used_color_keys, LIST_license)
#scale=0.3937001
#exportVRML(doc,modelName,scale,out_dir)
# Save the doc in Native FC format
saveFCdoc(App, Gui, doc, modelName,out_dir)
#display BBox
Gui.activateWorkbench("PartWorkbench")
Gui.SendMsgToActiveView("ViewFit")
Gui.activeDocument().activeView().viewAxometric()
#FreeCADGui.ActiveDocument.activeObject.BoundingBox = True
示例10: make_3D_model
# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def make_3D_model(models_dir, model_class, modelName):
LIST_license = ["",]
CheckedmodelName = modelName.replace('.', '').replace('-', '_').replace('(', '').replace(')', '')
Newdoc = App.newDocument(CheckedmodelName)
App.setActiveDocument(CheckedmodelName)
Gui.ActiveDocument=Gui.getDocument(CheckedmodelName)
destination_dir = model_class.get_dest_3D_dir()
material_substitutions = model_class.make_3D_model(modelName)
doc = FreeCAD.ActiveDocument
doc.Label = CheckedmodelName
objs=GetListOfObjects(FreeCAD, doc)
objs[0].Label = CheckedmodelName
restore_Main_Tools()
script_dir=os.path.dirname(os.path.realpath(__file__))
expVRML.say(models_dir)
out_dir=models_dir+os.sep+destination_dir
if not os.path.exists(out_dir):
os.makedirs(out_dir)
exportSTEP(doc, modelName, out_dir)
if LIST_license[0]=="":
LIST_license=Lic.LIST_int_license
LIST_license.append("")
Lic.addLicenseToStep(out_dir+'/', modelName+".step", LIST_license,\
STR_licAuthor, STR_licEmail, STR_licOrgSys, STR_licOrg, STR_licPreProc)
# scale and export Vrml model
scale=1/2.54
#exportVRML(doc,modelName,scale,out_dir)
del objs
objs=GetListOfObjects(FreeCAD, doc)
expVRML.say("######################################################################")
expVRML.say(objs)
expVRML.say("######################################################################")
export_objects, used_color_keys = expVRML.determineColors(Gui, objs, material_substitutions)
export_file_name=out_dir+os.sep+modelName+'.wrl'
colored_meshes = expVRML.getColoredMesh(Gui, export_objects , scale)
#expVRML.writeVRMLFile(colored_meshes, export_file_name, used_color_keys)# , LIST_license
expVRML.writeVRMLFile(colored_meshes, export_file_name, used_color_keys, LIST_license)
#scale=0.3937001
#exportVRML(doc,modelName,scale,out_dir)
# Save the doc in Native FC format
saveFCdoc(App, Gui, doc, modelName,out_dir)
#display BBox
Gui.activateWorkbench("PartWorkbench")
Gui.SendMsgToActiveView("ViewFit")
Gui.activeDocument().activeView().viewAxometric()
#FreeCADGui.ActiveDocument.activeObject.BoundingBox = True