当前位置: 首页>>代码示例>>Python>>正文


Python FreeCAD.setActiveDocument方法代码示例

本文整理汇总了Python中FreeCAD.setActiveDocument方法的典型用法代码示例。如果您正苦于以下问题:Python FreeCAD.setActiveDocument方法的具体用法?Python FreeCAD.setActiveDocument怎么用?Python FreeCAD.setActiveDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FreeCAD的用法示例。


在下文中一共展示了FreeCAD.setActiveDocument方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_AA

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def  test_AA():
    import FreeCAD
    import FreeCADGui
    App=FreeCAD
    Gui=FreeCADGui
    ### Begin command Std_RecentFiles
    try:
        App.closeDocument('Unnamed')
    except:
        pass
        App.setActiveDocument("")
        App.ActiveDocument=None
        Gui.ActiveDocument=None

    FreeCAD.open(u"/home/thomas/Schreibtisch/move_2.FCStd")
    App.setActiveDocument("move_2")
    App.ActiveDocument=App.getDocument("move_2")
    Gui.ActiveDocument=Gui.getDocument("move_2")
    ### End command Std_RecentFiles
    loadGraph() 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:22,代码来源:Commands.py

示例2: test_store_serial

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def test_store_serial(datadir, fix_FCDoc):
    """Test serialisation to memory."""
    import FreeCAD

    # Serialise document
    obj = fix_FCDoc.addObject("App::FeaturePython", "some_content")
    serial_data = store_serial(fix_FCDoc, lambda d, p: d.saveAs(p), "fcstd")

    # Write to a file
    file_path = os.path.join(datadir, "test.fcstd")

    data = codecs.decode(serial_data.encode(), "base64")
    with open(file_path, "wb") as of:
        of.write(data)

    # Load back and check
    doc = FreeCAD.newDocument("instance")
    FreeCAD.setActiveDocument("instance")
    doc.load(file_path)

    assert doc.getObject("some_content") is not None
    FreeCAD.closeDocument("instance") 
开发者ID:microsoft,项目名称:qmt,代码行数:24,代码来源:test_data_data_utils.py

示例3: Activated

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def Activated(self):

        # check what we have selected
        selectedLink = self.checkSelection()
        if not selectedLink:
            return
        elif not selectedLink.TypeId=='App::Link':
            return
        linkedObj = selectedLink.LinkedObject

        # in case linking to a sub-object
        if isinstance(linkedObj, tuple):
            linkedObj = linkedObj[0].getSubObject(linkedObj[1], retType=1)
        
        # the non-magical command
        App.setActiveDocument(linkedObj.Document.Name)
        Gui.activateView('Gui::View3DInventor', True) 
开发者ID:Zolko-123,项目名称:FreeCAD_Assembly4,代码行数:19,代码来源:gotoDocumentCmd.py

示例4: reset

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def reset():
    '''file laden und graph anzeigen testcase'''

    if 'aa' not in FreeCAD.listDocuments().keys():
        FreeCAD.open(u"/home/thomas/aa.FCStd")
    FreeCAD.setActiveDocument("aa")

    try:
        pfwrap.deleteInstance()
        del(FreeCAD.PF)
    except:
        pass
    instance=pfwrap.getInstance()
    clearGraph()
    loadGraph() 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:17,代码来源:Commands.py

示例5: loadFile

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def loadFile():

    hidePyFlow()
    if 'graph' not in FreeCAD.listDocuments().keys():
        FreeCAD.open(u"/home/thomas/graph.FCStd")
    FreeCAD.setActiveDocument("graph")
    clearGraph()
    loadGraph() 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:10,代码来源:Commands.py

示例6: loadAll

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def loadAll():
    showPyFlow()
    try:
        FreeCAD.getDocument(fn)
    except:
        FreeCAD.open(u"/home/thomas/{}.FCStd".format(fn))

    FreeCAD.setActiveDocument(fn)
    FreeCAD.ActiveDocument=FreeCAD.getDocument(fn)
    FreeCADGui.ActiveDocument=FreeCADGui.getDocument(fn)
    loadGraph()
    pass 
开发者ID:microelly2,项目名称:NodeEditor,代码行数:14,代码来源:Commands.py

示例7: test_overlapping_parts

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def test_overlapping_parts(datadir):
    """
    This tests that two parts that were generated from lithography over a wire register as intersecting. Due to
    an OCC bug, FC 0.18 at one point would claim that these didn't intersect, resulting in geometry and meshing errors.
    """
    path = os.path.join(datadir, "intersection_test.FCStd")
    doc = FreeCAD.newDocument("instance")
    FreeCAD.setActiveDocument("instance")
    doc.load(path)
    shape_1 = doc.Objects[0]
    shape_2 = doc.Objects[1]
    assert checkOverlap([shape_1, shape_2])
    FreeCAD.closeDocument(doc.Name) 
开发者ID:microsoft,项目名称:qmt,代码行数:15,代码来源:test_geo_objects.py

示例8: get_data

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def get_data(self, data_name: str, scratch_dir: Optional[str] = None):
        """Get data from stored serial format.

        Parameters
        ----------
        data_name : str
            "fcdoc" freeCAD document.
        scratch_dir : str
            Optional existing temporary (fast) storage location. (Default value = None)
        mesh :
            (Default value = None)
        Returns
        -------
        data
        """
        if data_name == "fcdoc":

            def _load_fct(path):
                doc = FreeCAD.newDocument("instance")
                FreeCAD.setActiveDocument("instance")
                doc.load(path)
                return doc

            return load_serial(self.serial_fcdoc, _load_fct, scratch_dir=scratch_dir)
        else:
            raise ValueError(f"{data_name} was not a valid data_name.") 
开发者ID:microsoft,项目名称:qmt,代码行数:28,代码来源:geo_3d_data.py

示例9: setUp

# 需要导入模块: import FreeCAD [as 别名]
# 或者: from FreeCAD import setActiveDocument [as 别名]
def setUp(self):
		# setting a new document to hold the tests
		if FreeCAD.ActiveDocument:
			if FreeCAD.ActiveDocument.Name != "AnimTest":
				FreeCAD.newDocument("AnimTest")
		else:
			FreeCAD.newDocument("AnimTest")
		FreeCAD.setActiveDocument("AnimTest") 
开发者ID:microelly2,项目名称:Animation,代码行数:10,代码来源:TestAnim.py


注:本文中的FreeCAD.setActiveDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。