當前位置: 首頁>>代碼示例>>Python>>正文


Python FreeCADGui.SendMsgToActiveView方法代碼示例

本文整理匯總了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) 
開發者ID:tomate44,項目名稱:CurvesWB,代碼行數:20,代碼來源:pasteSVG.py

示例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) 
開發者ID:tomate44,項目名稱:CurvesWB,代碼行數:10,代碼來源:gordon_profile_FP.py

示例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") 
開發者ID:looooo,項目名稱:freecad.gears,代碼行數:8,代碼來源:commands.py

示例4: GuiViewFit

# 需要導入模塊: import FreeCADGui [as 別名]
# 或者: from FreeCADGui import SendMsgToActiveView [as 別名]
def GuiViewFit(self):
        FreeCADGui.SendMsgToActiveView("ViewFit")
        self.timer.stop() 
開發者ID:kbwbe,項目名稱:A2plus,代碼行數:5,代碼來源:a2p_importpart.py

示例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() 
開發者ID:kbwbe,項目名稱:A2plus,代碼行數:17,代碼來源:a2p_importpart.py

示例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')
## 
開發者ID:shaise,項目名稱:FreeCAD_SheetMetal,代碼行數:35,代碼來源:SheetMetalUnfolder.py

示例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") 
開發者ID:microelly2,項目名稱:NodeEditor,代碼行數:50,代碼來源:Commands.py

示例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 
開發者ID:easyw,項目名稱:kicad-3d-models-in-freecad,代碼行數:58,代碼來源:main_generator.py

示例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 
開發者ID:easyw,項目名稱:kicad-3d-models-in-freecad,代碼行數:58,代碼來源:main_generator.py

示例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 
開發者ID:easyw,項目名稱:kicad-3d-models-in-freecad,代碼行數:56,代碼來源:main_generator.py


注:本文中的FreeCADGui.SendMsgToActiveView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。