当前位置: 首页>>代码示例>>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;未经允许,请勿转载。