Exemple #1
0
def TestWireJoiner():
    heartWire = TestObjects.makeHeartWire()

    #man this is hard to test without resorting to graphical test.
    #this is sort of a semi-automatic method
    testPoints = []

    testPoints.append([gp.gp_Pnt(-1.0, 0, 0), 5])
    testPoints.append([gp.gp_Pnt(0, -1.0, 0), 5])
    testPoints.append([gp.gp_Pnt(-1.0, -1.0, 0), 5])
    testPoints.append([gp.gp_Pnt(1.0, 0, 0), 5])
    testPoints.append([gp.gp_Pnt(1.6, 1.8, 0), 6])
    testPoints.append([gp.gp_Pnt(4.15, 4.4, 0), 5])
    testPoints.append([gp.gp_Pnt(0.5, 3.5, 0), 5])
    testPoints.append([gp.gp_Pnt(4.0, 4.7, 0), 6])

    for tp in testPoints:
        display.EraseAll()
        display.DisplayColoredShape(heartWire, 'GREEN')
        wj = WireJoiner(heartWire, tp[0], 0.08)
        result = wj.build()
        assert len(Wrappers.Wire(result).edgesAsList()) == tp[1]
        display.DisplayColoredShape(result, 'RED')
        time.sleep(1)
Exemple #2
0
def TestWireJoiner():
	heartWire = TestObjects.makeHeartWire();
	
	#man this is hard to test without resorting to graphical test.
	#this is sort of a semi-automatic method
	testPoints = [];

	testPoints.append ( [ gp.gp_Pnt(-1.0,0,0),5]);
	testPoints.append ( [ gp.gp_Pnt(0,-1.0,0),5]);
	testPoints.append ( [ gp.gp_Pnt(-1.0,-1.0,0),5]);		
	testPoints.append ( [ gp.gp_Pnt(1.0,0,0 ),5]);
	testPoints.append ( [ gp.gp_Pnt(1.6,1.8,0),6]);
	testPoints.append ( [ gp.gp_Pnt(4.15,4.4,0),5] );
	testPoints.append ( [ gp.gp_Pnt(0.5,3.5,0),5] );	
	testPoints.append ( [ gp.gp_Pnt(4.0,4.7,0),6] );
		
	for tp in testPoints:
		display.EraseAll();
		display.DisplayColoredShape(heartWire,'GREEN');
		wj = WireJoiner(heartWire,tp[0],0.08);
		result = wj.build();
		assert len(Wrappers.Wire(result).edgesAsList()) == tp[1]
		display.DisplayColoredShape(result,'RED');
		time.sleep(1);
Exemple #3
0
            wb.add ( e3); 
        
        for e in topoWire.edges():
            if e.IsSame(e1): continue;                
            if e2 and e.IsSame(e2): continue;            
            wb.add ( e );
            
    return wb.wire();


if __name__=='__main__':
    
    from OCC.Display.SimpleGui import *
    display, start_display, add_menu, add_function_to_menu = init_display()
    
    heart = TestObjects.makeHeartWire();
    
    #p1 = gp.gp_Pnt(0.0,-0.5,0.0);
    p1 = gp.gp_Pnt(2.1,1.5,0.0);
    v1 = OCCUtil.make_vertex ( gp.gp_Pnt(2.0,3.1,0.0));
    #t = time.clock();
    #for i in range(1000):
    #    p2 = distToPoint(heart,v1 );    
    #print "dist time %0.3f" % ( time.clock() - t ); #about 1.6ms per call for a simple heart wire . not too shabby
    
    #v2 = OCCUtil.make_vertex ( p2 );
    #display.DisplayShape([heart,v1,v2]);
    
    
    #test splitting a wire
    newWire= makeExtrusionWire(heart,p1,0.25);
Exemple #4
0
		display.DisplayShape(OCCUtil.make_vertex(p),update=False);
	print "%d nodes total" % i

if __name__=='__main__':

	from OCC.Display.SimpleGui import *
	display, start_display, add_menu, add_function_to_menu = init_display()		
					
	print "******************************"
	print " HatchLib Unit Tests...."
	print "******************************"
	#w = TestDisplay.makeSquareWire(); #box around 0,0 <--> 5,5 
	#w2=TestDisplay.makeCircleWire(); #circle centered at 2,2, radius 1
	#h = Hatcher([w,w2],0.0,( 0,0,5.0,5.0) );

	w = TestObjects.makeHeartWire();
	w2=TestObjects.makeCircleWire2();
	h = Hatcher([w,w2],0.0,( -6,0,10.0,10.0), 0.25, 45 );

	#display.DisplayShape(w);
	#display.DisplayShape(w2);
		
	#runProfiled('h.hatch()',0.9);
	t = Util.Timer();
	h.hatch();
	q = time.clock();
	ww = h.getWires();
	print "got Wires in %0.3f" % ( time.clock() - q );
	display.DisplayShape(ww,False );
	display.FitAll();
	g = h.graphBuilder.graph;