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


Python Wrappers.wireFromEdges方法代码示例

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


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

示例1: testSplitWire2

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def testSplitWire2():
	"intersections on different edges. one edge completely inside"
	
	e1 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(0,0,0),gp.gp_Pnt(2,0,0));
	e2 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(2,0,0),gp.gp_Pnt(5,0,0));
	e3 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(5,0,0),gp.gp_Pnt(6,0,0));
	
	
	#trick here. after building a wire, the edges change identity.
	#evidently, BRepBuilder_MakeWire makes copies of the underliying edges.
	
	w = Wrappers.wireFromEdges([e1,e2,e3]);
	ee = Wrappers.Wire(w).edgesAsList();
	print "Original Edges: %d %d %d " % ( hashE(ee[0]),hashE(ee[1]),hashE(ee[2]));
	p1 = PointOnAnEdge(ee[0],1.0,gp.gp_Pnt(1.0,0,0));
	p2 = PointOnAnEdge(ee[2],0.5,gp.gp_Pnt(5.0,0,0));
	
	
	ee = splitWire(w,[p2,p1]);
	
	assert len(ee) == 3;
	
	length = 0;
	for e in ee:
		ew = Wrappers.Edge(e);
		length += ew.distanceBetweenEnds();
		TestDisplay.display.showShape(e);
	print "length=%0.3f" % length;
	assert length == 4.5;
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:31,代码来源:edgegraph3__old.py

示例2: testSplitWire1

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def testSplitWire1():
	"""
		Test split wire function. there are two main cases:
		wires with intersection on different edges,
		and a wire with a single edge split in many places
	"""
		
	#case 1: a single edge with lots of intersections along its length
	e  = Wrappers.edgeFromTwoPoints( gp.gp_Pnt(0,0,0),gp.gp_Pnt(5,0,0));
	w = Wrappers.wireFromEdges([e]);
	
	#out of order on purpose
	p1 = PointOnAnEdge(e,1.0,gp.gp_Pnt(1.0,0,0));
	p3 = PointOnAnEdge(e,3.0,gp.gp_Pnt(3.0,0,0));
	p2 = PointOnAnEdge(e,2.0,gp.gp_Pnt(2.0,0,0));	
	p4 = PointOnAnEdge(e,4.0,gp.gp_Pnt(4.0,0,0));
	ee = splitWire(w,[p1,p3,p2,p4] );

	assert len(ee) ==  2;
	length = 0;
	for e in ee:
		ew = Wrappers.Edge(e);
		length += ew.distanceBetweenEnds();
		TestDisplay.display.showShape(e);

	assert length == 2.0;
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:28,代码来源:edgegraph3__old.py

示例3: makeHeartWire

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def makeHeartWire():
	"make a heart wire"
	e1 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(0,0,0), gp.gp_Pnt(4.0,4.0,0));
	circle = gp.gp_Circ(gp.gp_Ax2(gp.gp_Pnt(2,4,0),gp.gp().DZ()),2);
	e2 = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(circle, gp.gp_Pnt(4,4,0),gp.gp_Pnt(0,4,0)).Edge();
	circle = gp.gp_Circ(gp.gp_Ax2(gp.gp_Pnt(-2,4,0),gp.gp().DZ()),2);
	e3 = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(circle, gp.gp_Pnt(0,4,0),gp.gp_Pnt(-4,4,0)).Edge();
	e4 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(-4,4,0), gp.gp_Pnt(0,0,0));
	return Wrappers.wireFromEdges([e1,e2,e3,e4]);
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:11,代码来源:pixMapFromWire.py

示例4: scanlinesFromBoundingBox

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def scanlinesFromBoundingBox(boundingBox,interval):
	(xMin,yMin,zMin,xMax,yMax,zMax) = boundingBox;
	print boundingBox;
	edges = [];
	for y in Wrappers.frange6(yMin,yMax,interval):
		e = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(xMin,y,0),gp.gp_Pnt(xMax,y,0));
		#TestDisplay.display.showShape(e);
		edges.append((y,Wrappers.wireFromEdges([e])));
	return edges;
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:11,代码来源:pixMapFromWire.py

示例5: squareWire

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def squareWire(centerPt,w ):
	"makes a square wire with center at the desired point"
	w2 = w/2.0;
	p1 = gp.gp_Pnt(centerPt.X() - w2,centerPt.Y() -w2 , centerPt.Z() )
	p2 = gp.gp_Pnt(centerPt.X() - w2,centerPt.Y() +w2, centerPt.Z() )
	p3 = gp.gp_Pnt(centerPt.X() + w2,centerPt.Y() +w2, centerPt.Z() )
	p4 = gp.gp_Pnt(centerPt.X() + w2,centerPt.Y() -w2, centerPt.Z() )
	e1 = Wrappers.edgeFromTwoPoints(p1,p4);
	e2 = Wrappers.edgeFromTwoPoints(p4,p3);
	e3 = Wrappers.edgeFromTwoPoints(p3,p2);
	e4 = Wrappers.edgeFromTwoPoints(p2,p1);
	return Wrappers.wireFromEdges([e1,e2,e3,e4] );
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:14,代码来源:solidoffset.py

示例6: makeHeartWire2d

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def makeHeartWire2d():
    "make a heart wire in 2d"
    e1 = edgeFromTwoPoints((0, 0), (4.0, 4.0))

    circle = gp.gp_Circ2d(gp.gp_Ax2d(tP(2, 4), gp.gp().DX2d()), 2)
    e2 = BRepBuilderAPI.BRepBuilderAPI_MakeEdge2d(circle, tP(4, 4), tP(0, 4)).Edge()

    circle = gp.gp_Circ2d(gp.gp_Ax2d(tP(-2, 4), gp.gp().DX2d()), 2)
    e3 = BRepBuilderAPI.BRepBuilderAPI_MakeEdge2d(circle, tP(0, 4), tP(-4, 4)).Edge()

    e4 = edgeFromTwoPoints((-4, 4), (0, 0))
    return Wrappers.wireFromEdges([e1, e2, e3, e4])
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:14,代码来源:test2dStuff.py

示例7: approximatedWire

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def approximatedWire(wire):
	"returns a bezier approximation of the specified wire as an edge"
	#make a parameterized approximation of the wire
	adaptor = BRepAdaptor.BRepAdaptor_CompCurve (wire);
	curve = BRepAdaptor.BRepAdaptor_HCompCurve(adaptor);
	curveHandle = curve.GetHandle();
	
	#approximate the curve using a tolerance
	approx = Approx.Approx_Curve3d(curveHandle,0.01,GeomAbs.GeomAbs_C2,1000,8);
	if approx.IsDone() and  approx.HasResult():
		# have the result
		anApproximatedCurve=approx.Curve();

		builder =  BRepLib.BRepLib_MakeEdge(anApproximatedCurve);
		e = builder.Edge();
		return Wrappers.wireFromEdges([e]);
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:18,代码来源:hexagonlib.py

示例8: makePeriodic

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
	def makePeriodic(self,center,positive=1.0):
		"""
			center is the center of the first hex, as an (x,y,z) tuple.
			positive is 1 for the upper portion, -1 for the lower portion
			
			makes the upper part of a periodic hex pattern.
			
			Note that the upper and lower flats are adjusted
			for line width, so that they can be stacked and allow
			double-drawing of the horizontal flats. this offset is controlled by
			the linewidth parameter.
			the points are numbered below
			
			    (2)  (3)
			     /-----\
			____/   +   \_____
		   (0) (1)      (4)   (5)
		"""
		cX = center[0];
		cY = center[1];
		cZ = center[2];
		(XA,YA) = self.lineWidthAdjust();
		baselineY = (cY +  YA ) * positive;
		topY = (cY + ( self.width/2.0 - YA )) * positive ;

		p0 = gp.gp_Pnt(cX -  self.cartesianSpacing()[0], baselineY,cZ);
		p1 = gp.gp_Pnt( cX - self.centerToCorner() + XA, baselineY ,cZ );
		p2 = gp.gp_Pnt( cX - self.halfAflat() - XA, topY , cZ );
		p3 = gp.gp_Pnt( cX + self.halfAflat() + XA , topY, cZ );
		p4 = gp.gp_Pnt(  cX + self.centerToCorner() - XA , baselineY , cZ );
		p5 = gp.gp_Pnt(  cX + self.cartesianSpacing()[0], baselineY , cZ );
	
		#make the edges and the wires
		edges = [];
		edges.append( Wrappers.edgeFromTwoPoints(p0,p1) );
		edges.append( Wrappers.edgeFromTwoPoints(p1,p2) );
		edges.append( Wrappers.edgeFromTwoPoints(p2,p3) );
		edges.append( Wrappers.edgeFromTwoPoints(p3,p4) );
		edges.append( Wrappers.edgeFromTwoPoints(p4,p5) );
		
		wire =  Wrappers.wireFromEdges(edges);
		return wire;
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:44,代码来源:hexagonlib.py

示例9: splitPerfTest

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def splitPerfTest():
	"make a long wire of lots of edges"
	"""
		performance of the wire split routine is surprisingly bad!
		
	"""
	
	WIDTH=0.1
	edges = [];
	for i in range(1,50):
		e = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(i*WIDTH,0,0),gp.gp_Pnt((i+1)*WIDTH,0,0))
		TestDisplay.display.showShape(e);
		edges.append(e);
		
	
	#trick here. after building a wire, the edges change identity.
	#evidently, BRepBuilder_MakeWire makes copies of the underliying edges.
	
	w = Wrappers.wireFromEdges(edges);
	ee = Wrappers.Wire(w).edgesAsList();
	
	#compute two intersections
	e1 = Wrappers.Edge(ee[5]);
	e2 = Wrappers.Edge(ee[30]);
	e1p = (e1.lastParameter - e1.firstParameter )/ 2;
	e2p = (e2.lastParameter - e2.firstParameter )/ 2;
	p1 = PointOnAnEdge(e1.edge,e1p ,e1.pointAtParameter(e1p));
	p2 = PointOnAnEdge(e2.edge,e2p ,e2.pointAtParameter(e2p));
	
	#cProfile.runctx('for i in range(1,100): ee=splitWire(w,[p2,p1])', globals(), locals(), filename="slicer.prof")
	#p = pstats.Stats('slicer.prof')
	#p.sort_stats('time')
	#p.print_stats(.98);		

	t = Wrappers.Timer();
	for i in range(1,100):
		ee = splitWire(w,[p2,p1]);
	print "Elapsed for 100 splits:",t.finishedString();
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:40,代码来源:edgegraph3_b.py

示例10: makePieWire

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def makePieWire():
	e1 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(0,0,0), gp.gp_Pnt(4.0,0,0));
	e2 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(4.0,0,0), gp.gp_Pnt(2.0,0.1,0));
	e3 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(2.0,0.1,0), gp.gp_Pnt(3.0,1.0,0));
	e4 = Wrappers.edgeFromTwoPoints(gp.gp_Pnt(3.0,1.0,0), gp.gp_Pnt(00,0,0));
	return Wrappers.wireFromEdges([e1,e2,e3,e4]);	
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:8,代码来源:pixMapFromWire.py

示例11: makeCircleWire

# 需要导入模块: import Wrappers [as 别名]
# 或者: from Wrappers import wireFromEdges [as 别名]
def makeCircleWire():
	circle = gp.gp_Circ(gp.gp_Ax2(gp.gp_Pnt(0,2,0),gp.gp().DZ()),.75);
	e2 = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(circle, gp.gp_Pnt(0,1.25,0),gp.gp_Pnt(0,1.25,0)).Edge();
	return Wrappers.wireFromEdges([e2]);
开发者ID:adam-urbanczyk,项目名称:emcfab,代码行数:6,代码来源:pixMapFromWire.py


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