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


Python Wrappers.make_vertex方法代碼示例

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


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

示例1: displayPixelGrid

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import make_vertex [as 別名]
def displayPixelGrid(pixelGrid):
	"show all the points in a pixel grid"
	l = [];
	for k in pixelGrid.keys():
		l.append(Wrappers.make_vertex(gp.gp_Pnt(k[0],k[1],0.00)));
		
	display.DisplayShape(l);
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:9,代碼來源:OccSliceLib2.py

示例2: makeEdgeIndicator

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import make_vertex [as 別名]
def makeEdgeIndicator(edge):
	"makes an indicator showing which way the edge goes"
	ew = Wrappers.Edge(edge);
	fp = ew.firstParameter;
	lp = ew.lastParameter;
	
	if ew.reversed:
		p = fp + (( lp - fp ) * 1 / 5 );
	else:
		p = fp + ((lp - fp) * 4 /5 );
	midPnt = ew.curve.Value(p);
	return Wrappers.make_vertex(midPnt);
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:14,代碼來源:TestDisplay.py

示例3: splitPerfTest

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import make_vertex [as 別名]
def splitPerfTest():
	"make a long wire of lots of edges"
	"""
		performance of the wire split routine is surprisingly bad!
		
	"""
	
	WIDTH=0.1
	edges = [];

		
	
	#trick here. after building a wire, the edges change identity.
	#evidently, BRepBuilder_MakeWire makes copies of the underliying edges.
	h = hexagonlib.Hexagon(2.0,0 );
	wirelist = h.makeHexForBoundingBox((0,0,0), (100,100,0));
	w = wirelist[0];
	ee = Wrappers.Wire(w).edgesAsList();
	TestDisplay.display.showShape(w);
	#compute two intersections
	e1 = Wrappers.Edge(ee[5]);
	e2 = Wrappers.Edge(ee[60]);
	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));
	TestDisplay.display.showShape( Wrappers.make_vertex(p1.point));
	TestDisplay.display.showShape( Wrappers.make_vertex(p2.point));
	cProfile.runctx('for i in range(1,2): ee=splitWire(w,[p2,p1])', globals(), locals(), filename="slicer.prof")
	p = pstats.Stats('slicer.prof')
	p.sort_stats('cum')
	p.print_stats(.98);		

	t = Wrappers.Timer();
	ee = None;
	for i in range(1,2):
		ee = splitWire(w,[p2,p1]);
	
	print "Elapsed for 100splits:",t.finishedString();
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:41,代碼來源:edgegraph3__old.py

示例4: testProjectingPointInaccurately

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import make_vertex [as 別名]
def testProjectingPointInaccurately():
    """
		test projecting a point onto a curve
	"""
    h = makeHeartWire()

    # convert to twod curves
    curves = []
    for e in Wrappers.Wire(h).edges2():
        curves.append(get2dCurveFrom3dEdge(e))

        # project a point onto the wire. we want to see if slight inaccurcies will project.
        # this simulates trying to find points on a curve that were put there via pixels
    display.DisplayShape(h)
    DISTANCE = 0.004
    p = gp.gp_Pnt2d(2.0 + DISTANCE, 2.0 - DISTANCE)
    display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(p.X(), p.Y(), 0)))
    for c in curves:
        r = projectPointOnCurve2d(c, p, 0.005)
        if r is not None:
            (param, pnt) = r
            print "found point: parmater-%0.3f, point-(%0.3f,%0.3f)" % (param, pnt.X(), pnt.Y())
            display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(pnt.X(), pnt.Y(), 0)))
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:25,代碼來源:test2dStuff.py

示例5:

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import make_vertex [as 別名]
	
	#TestDisplay.display.showShape(testWire);
	resultEdge = TopoDS.TopoDS_Edge();
	#try to get edge from paramter
	p = 0.5;
	eP = curve.Edge(p,resultEdge);
	print "CompCurve Parameter %0.2f = edge parameter %0.2f" % ( p, eP) ;
	TestDisplay.display.showShape(resultEdge);
	
	#show the selected point also
	point = curve.Value(p);
	
	#get all of the intervals for the wire
	print "Getting %d Intervals" % nB;
	array = TColStd.TColStd_Array1OfReal(1,nB+2);
	
	curve.Intervals(array,2);
	print "Bounding Parameters: ",listFromArray(array);
	TestDisplay.display.showShape(Wrappers.make_vertex(point));
	
	
	wr = Wrappers.Wire(testWire);
	edgeList = []
	for e in wr.edges2():
		edgeList.append(e);
		
	print "Edges:",edgeList
	
	
	
	TestDisplay.display.run();
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:33,代碼來源:TestCompCurve.py

示例6: findIntersectionsUsingCurvesNoSorting

# 需要導入模塊: import Wrappers [as 別名]
# 或者: from Wrappers import make_vertex [as 別名]
    # flatten all of these edges into one list
    # allHexLines = []
    # for a in hexarray:
    # 	allHexLines.extend(a);

    # fine all intersections using curves directly,  with no sorting or boudning boxes
    # q = time.clock();
    # (count,ipoints) = findIntersectionsUsingCurvesNoSorting(h3,fillCurves);
    # print ("Computed %d intersections in %0.3f: %d intersections found" ) % ( count, (time.clock() - q),len(ipoints));

    q = time.clock()
    # (count,ipoints) = findIntersectionsUsingCurves(h3,fillCurves);
    (count, ipoints) = findIntersectionsUsingCurvesNoSorting(h2, fillCurves)
    print ("Computed %d intersections in %0.3f: %d intersections found") % (count, (time.clock() - q), len(ipoints))

    for p in ipoints:
        display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(p.X(), p.Y(), 0)), update=False)
        # annoying-- no 2d vertex exists really
        # display wire
    print "Done"
    # for p in ipoints:
    # 	display.DisplayShape(Wrappers.make_vertex(gp.gp_Pnt(p.X(),p.Y(),0)) ,update=False );
    # displayCurveList(fillCurves);

    # 	for w in fillWires:
    # 		TestDisplay.display.showShape(w);
    # display.DisplayShape(h3);
    display.FitAll()
    # TestDisplay.display.showShape(offset2dWire(h,-0.1))
    start_display()
開發者ID:adam-urbanczyk,項目名稱:emcfab,代碼行數:32,代碼來源:test2dStuff.py


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