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


Python Wrappers.frange6方法代碼示例

本文整理匯總了Python中Wrappers.frange6方法的典型用法代碼示例。如果您正苦於以下問題:Python Wrappers.frange6方法的具體用法?Python Wrappers.frange6怎麽用?Python Wrappers.frange6使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Wrappers的用法示例。


在下文中一共展示了Wrappers.frange6方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: makeFillEdges2d

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import frange6 [as 別名]
def makeFillEdges2d(xMin, yMin, xMax, yMax, spacing):
    "make straight hatch lines."
    edges = []
    for y in Wrappers.frange6(yMin, yMax, spacing):
        e = edgeFromTwoPoints((xMin, y), (xMax, y))
        # TestDisplay.display.showShape(e);
        edges.append(e)
    return edges
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:10,代碼來源:test2dStuff.py

示例2: scanlinesFromBoundingBox

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import frange6 [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

示例3: makeFillCurves2d

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import frange6 [as 別名]
def makeFillCurves2d(xMin, yMin, xMax, yMax, spacing):
    """ 
		makes a set of lines that are curves not edges
		probably the minimal possible construction
	"""
    lines = []
    for y in Wrappers.frange6(yMin, yMax, spacing):
        l = GCE2d.GCE2d_MakeSegment(tP(xMin, y), tP(xMax, y)).Value()
        lines.append(l)
    return lines
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:12,代碼來源:test2dStuff.py

示例4: computePixelGrid

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import frange6 [as 別名]
def computePixelGrid(face, resolution=0.1):
	"""
	   makes a pixel grid of a face at the requested resolution."
		A dictionary is used to store the values.
	"""
	box = Bnd.Bnd_Box();
	b = BRepBndLib.BRepBndLib();
	b.Add(face,box);
	TOLERANCE = 5;
	bounds = box.Get();
	xMin = bounds[0];
	xMax = bounds[3];
	xDim = abs(xMax - xMin);
	yMin = bounds[1];
	yMax = bounds[4];
	yDim = abs(yMax - yMin);
	zMin = bounds[2];
	pixelTable = {};
	
	for y in Wrappers.frange6(yMin,yMax,resolution):
		#create a horizontal scan line
		edge =  Wrappers.edgeFromTwoPoints(
		 gp.gp_Pnt(xMin - TOLERANCE,y,zMin),
			gp.gp_Pnt(xMax + TOLERANCE,y,zMin) );
			
		#get list of wires from the face
		#TODO:// this should be encapsulated by a face abstraction
		wires = []
		ow = brt.OuterWire(face);
		wires.append(ow);
		for w in Topo(face).wires():
			if not w.IsSame(ow):
				wires.append(w);
				
		
		#compute intersection points with each wire
		#this is a hack because i know how to make edges from lines
		#but really, it would be better to do 2d here and use
		#Geom2dAPI_InterCurveCurve
		xIntersections = [];		
		for w in wires:
			#display.DisplayShape(w);
			brp = BRepExtrema.BRepExtrema_DistShapeShape();
			#display.DisplayShape(edge);
			brp.LoadS1(w);
			brp.LoadS2(edge);

			if brp.Perform() and brp.Value() < 0.01:
				for k in range(1,brp.NbSolution()+1):
					if brp.SupportTypeShape1(k) == BRepExtrema.BRepExtrema_IsOnEdge:
						xIntersections.append(brp.PointOnShape1(k).X() );
		
		
		if len(xIntersections) == 0:
			print "No intersection found.";
			continue;
		#else:
			#print "there are %d intersections " % len(xIntersections);
		#sort intersection points by x value
		xIntersections.sort();
		
		#fill pixel table with values on surface based on scanlines
		#TODO: for now ignore horizontals and edge vertices, this is just a test
		#better to use a generator here too
		#also need to implement edge table of scanline fill
		if (len(xIntersections) % 2 == 0) :
			i = 0;
			inside = False;
			cx = xMin;
			
			#print xIntersections;
			while i < len(xIntersections):
				cint = xIntersections[i];
				if inside:
					while cx < cint:
						key = ( cx, y );
						pixelTable[key] = 1;
						#print cx;
						cx += resolution;
				else:
					while cx<cint:
						cx += resolution;
						#print cx;
						continue;
						
				i += 1;
				inside = not inside;
		else:
			print "Odd number of intersections encountred."

	#displayPixelGrid(pixelTable);
	return pixelTable;
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:94,代碼來源:OccSliceLib2.py


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