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


Python Mesh.show方法代码示例

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


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

示例1: makeMengerSponge

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
def makeMengerSponge(level=3,x0=0,y0=0,z0=0):
    mesh=Sierpinski(level,x0,y0,z0)
    mesh.removeDuplicatedPoints()
    mesh.removeFacets(mesh.getInternalFacets())
    mesh.rebuildNeighbourHood()
    print("Mesh is solid: %s" % (mesh.isSolid()))
    Mesh.show(mesh)
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:9,代码来源:MengerSponge.py

示例2: testRayPick

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
    def testRayPick(self):
        if not FreeCAD.GuiUp:
            return
        self.planarMesh.append([-16.097176, -29.891157, 15.987688])
        self.planarMesh.append([-16.176304, -29.859991, 15.947966])
        self.planarMesh.append([-16.071451, -29.900553, 15.912505])
        self.planarMesh.append([-16.092241, -29.893408, 16.020439])
        self.planarMesh.append([-16.007210, -29.926180, 15.967641])
        self.planarMesh.append([-16.064457, -29.904951, 16.090832])
        planarMeshObject = Mesh.Mesh(self.planarMesh)

        from pivy import coin
        import FreeCADGui

        Mesh.show(planarMeshObject)
        view = FreeCADGui.ActiveDocument.ActiveView.getViewer()
        rp = coin.SoRayPickAction(view.getSoRenderManager().getViewportRegion())
        rp.setRay(coin.SbVec3f(-16.05, 16.0, 16.0), coin.SbVec3f(0, -1, 0))
        rp.apply(view.getSoRenderManager().getSceneGraph())
        pp = rp.getPickedPoint()
        self.failUnless(pp != None)
        det = pp.getDetail()
        self.failUnless(det.getTypeId() == coin.SoFaceDetail.getClassTypeId())
        det = coin.cast(det, str(det.getTypeId().getName()))
        self.failUnless(det.getFaceIndex() == 1)
开发者ID:barclaac,项目名称:FreeCAD_sf_master,代码行数:27,代码来源:MeshTestsApp.py

示例3: makeMengerSponge_mt

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
def makeMengerSponge_mt(level=3,x0=0,y0=0,z0=0):
    """
    Is much slower than makeMengerSponge!!! :(
    """
    if level == 0:
        mesh=Sierpinski(level,x0,y0,z0)
        Mesh.show(mesh)
        return

    boxnums = pow(3,level)
    thirds = boxnums / 3
    twothirds = thirds * 2
    
    rangerx = [ x0, x0 + thirds, x0 + twothirds ]
    rangery = [ y0, y0 + thirds, y0 + twothirds ]
    rangerz = [ z0, z0 + thirds, z0 + twothirds ]
    block = 1
    skip=[5,11,13,14,15,17,23]

    # collect the arguments for the algorithm in a list
    args=[]
    for i in rangerx:
        for j in rangery:
            for k in rangerz:
                if block not in skip:
                    args.append((level-1,i,j,k))
                block+=1

    numJobs = 4
    threads=[]
    while numJobs > 0:
        size = len(args)
        count = size / numJobs
        numJobs-=1
        thr=MengerThread(args[:count])
        threads.append(thr)
        args=args[count:]

    print("Number of threads: %i" % (len(threads)))
    for thr in threads:
        thr.start()
    for thr in threads:
        thr.join()

    mesh=Mesh.Mesh()
    for thr in threads:
        mesh.addMesh(thr.mesh)
        del thr.mesh
        
    print(mesh)
    mesh.removeDuplicatedPoints()
    mesh.removeFacets(mesh.getInternalFacets())
    mesh.rebuildNeighbourHood()
    print("Mesh is solid: %s" % (mesh.isSolid()))
    Mesh.show(mesh)
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:57,代码来源:MengerSponge.py

示例4: Activated

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
    def Activated(self):
        pol=np.loadtxt(FreeCAD.getHomePath()+'Mod/glider/examples/p.dat', dtype=int)
        nod=np.loadtxt(FreeCAD.getHomePath()+'Mod/glider/examples/n.dat', dtype=float)
        planarMesh = []
        for i in pol:
            planarMesh.append(nod[i[0]])
            planarMesh.append(nod[i[1]])
            planarMesh.append(nod[i[2]])
            planarMesh.append(nod[i[0]])
            planarMesh.append(nod[i[2]])
            planarMesh.append(nod[i[3]])

        planarMeshObject = Mesh.Mesh(planarMesh)
        Mesh.show(planarMeshObject)
开发者ID:karl-friedrich,项目名称:OpenGlider,代码行数:16,代码来源:__init__.py

示例5: commonMesh

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
def commonMesh(mesh,box): 

	t=Mesh.Mesh()
	Mesh.show(t)
	m_out=App.ActiveDocument.ActiveObject
	App.ActiveDocument.ActiveObject.ViewObject.Lighting="Two side"
	m_out.ViewObject.ShapeColor=(random.random(),random.random(),random.random())
	

	[pts,tris]=mesh.Mesh.Topology

	filter=np.array([0]*len(pts))

	n=1
	for i,p in enumerate(pts):
		if box.Shape.BoundBox.isInside(p):
			filter[i]=n
			if i % 1000 == 0:
				FreeCAD.Console.PrintMessage(" ** " + str(i))

				tris2=[]
				for t in tris:
					(a,b,c)=t
					if filter[a] and filter[b] and filter[c]:
						tris2.append((filter[a]-1,filter[b]-1,filter[c]-1))

				pts2=[]
				for i,p in enumerate(pts):
					if filter[i]:
						pts2.append(pts[i])
				m_out.Mesh=Mesh.Mesh((pts2,tris2))
				m_out.ViewObject.DisplayMode = u"Flat Lines"
				

				Gui.updateGui()
			n += 1

	tris2=[]
	for t in tris:
		(a,b,c)=t
		if filter[a] and filter[b] and filter[c]:
			tris2.append((filter[a]-1,filter[b]-1,filter[c]-1))

	pts2=[]
	for i,p in enumerate(pts):
		if filter[i]:
			pts2.append(pts[i])

	m_out.Mesh=Mesh.Mesh((pts2,tris2))
开发者ID:microelly2,项目名称:freeCAD_macro,代码行数:51,代码来源:commonmesh.py

示例6: testPrimitiveCount

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
	def testPrimitiveCount(self):
		if not FreeCAD.GuiUp:
			return
		self.planarMesh.append( [-16.097176,-29.891157,15.987688] ) 
		self.planarMesh.append( [-16.176304,-29.859991,15.947966] )
		self.planarMesh.append( [-16.071451,-29.900553,15.912505] )
		self.planarMesh.append( [-16.092241,-29.893408,16.020439] )
		self.planarMesh.append( [-16.007210,-29.926180,15.967641] )
		self.planarMesh.append( [-16.064457,-29.904951,16.090832] )
		planarMeshObject = Mesh.Mesh(self.planarMesh)

		from pivy import coin; import FreeCADGui
		Mesh.show(planarMeshObject)
		view=FreeCADGui.ActiveDocument.ActiveView
		pc=coin.SoGetPrimitiveCountAction()
		pc.apply(view.getSceneGraph())
		self.failUnless(pc.getTriangleCount() == 2)
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:19,代码来源:MeshTestsApp.py

示例7: Console

# 需要导入模块: import Mesh [as 别名]
# 或者: from Mesh import show [as 别名]
#  - Open FreeCAD software
#      NOTE: Close and reopen if already opened to ensure the active document is the document that you would like to scale
#  - Open STL file that you would like to scale
#  - Open Python Console (View > Views > Python Console)
#  - Type into the console the code below
#  - Click the newly created mesh that was brought into the application to highlight it
#      NOTE: should be called "Mesh"
#  - Click Export (File > Export)
#  - Save the file as <name>.stl in the desired directory
#      NOTE: <name> is whatever name you want to save it as

# ---------------------------------------------------------------------
# IMPORTANT - NOTE: Scaling the file will most likely affect the origin location on your model. It is difficult to avoid this. To work around this, look at the walkthrough at "yumi_description/meshes/base/README.txt"
# ---------------------------------------------------------------------

# Asumming desired scaling of <0.001,0.001,0.001> meters
import Mesh, BuildRegularGeoms # import necessary libraries

scaleMatrix = FreeCAD.Matrix() # create matrix to transform an object
scaleMatrix.scale(0.001,0.001,0.001) # set the scale factor for the desired STL filed

stlMesh = App.ActiveDocument.ActiveObject.Mesh.copy() # get mesh of active object
stlMesh.transform(scaleMatrix) # scale the mesh of the active object

Mesh.show(stlMesh) # bring the mesh into the application





开发者ID:ethz-asl,项目名称:yumi,代码行数:27,代码来源:scaleSTL.py


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