Esempio n. 1
0
    yield startNode
    nD = startNode.next
    while len(nD) > 0:
        nextNode = nD.values()[0]
        if nextNode == startNode:
            return
        yield nextNode
        nD = nextNode.next

    return


if __name__ == '__main__':
    print "Basic Wrappers and Utilities Module"
    w = TestDisplay.makeCircleWire()
    w = TestDisplay.makeSquareWire()
    w = TestDisplay.makeReversedWire()

    eg = EdgeGraph()
    eg.addWire(w, 'BOUND')

    #the big test-- split one of the edges
    e = eg.firstNode().edge
    newNode = eg.divideEdge(e, 2.5)

    e2 = newNode.edge
    newNode2 = eg.divideEdge(e2, 0.2333)

    for en in followForwardGenerator(eg):
        time.sleep(1)
        e = en.newEdge()
Esempio n. 2
0
		if refVal != None and theVal != None:			
			#if  abs(refVal - theVal) <= self.options.machineResolution:
			if abs(refVal - theVal ) <= 0.000001:
				return None;
		
		return theVal;

	def comment(self,txt):
		return self.options.commentFormat  % txt;
		
if __name__=='__main__':

	###Logging Configuration
	logging.basicConfig(level=logging.WARN,
						format='%(asctime)s [%(funcName)s] %(levelname)s %(message)s',
						stream=sys.stdout)	
						
	w1 = TestDisplay.makeSquareWire();
	w2 = TestDisplay.makeCircleWire();
	w3 = TestDisplay.makeReversedWire();
	TestDisplay.display.showShape([w1,w2,w3]);
	o = SlicerConfig.GcodeOptions();
	o.setDefaults();
	o.computeExtraAxis=False;
	ge = GcodeExporter(o );
	#ge.useArcs = False;
	for line in ge.gcode([w1,w2,w3]):
		print line,;

		
	TestDisplay.display.run();
Esempio n. 3
0
from OCC import TColStd

import Wrappers
import TestDisplay

def listFromArray( stdArray ):
	results= []
	for i in range(stdArray.Lower(),stdArray.Upper() ):
		results.append(stdArray.Value(i));
	return results;

if __name__=='__main__':
	
	#make test wire, which has two edges
	[testWire,circleEdge,lineEdge] = TestDisplay.makeKeyHoleWire();
	testWire2 = TestDisplay.makeSquareWire();
	
	if testWire2.Closed():
		print "testWire2 is closed";
	else:
		print "testWire2 is not closed.";
	TOLERANCE = 0.00001;
	curve  = BRepAdaptor.BRepAdaptor_CompCurve (testWire);
	
	print "CompCurve is parameterized between %0.5f and %0.5f " % (  curve.FirstParameter(), curve.LastParameter() );
	print "%d Continuity" % curve.Continuity();
	print "%d Intervals(C0)" % curve.NbIntervals(0);
	print "%d Intervals(C1)" % curve.NbIntervals(1);
	print "%d Intervals(C2)" % curve.NbIntervals(2);
	print "%d Intervals(C3)" % curve.NbIntervals(3);
	
Esempio n. 4
0
    # DrawTo 3,2.2
    assert testMoves([edge1, edge2, edge3]) == 3, "There should be Thee Moves"
    print "[OK]"

    print "Disconnected Edges"
    #the correct answer is:
    #  MoveTo 0,0
    #  Lineto 1,1
    #  MoveTo 2,2
    #  LineTo 3,2.2
    assert testMoves([edge1, edge3]) == 4, "Should be four moves"
    print "[OK]"

    print "Arcs And Lines"
    wire = makeTestWire()
    #the correct answer is:
    #  Moveto 40,50
    #  ArcTo  50,40 with center 40,40, ccw direction
    #  LineTo 80,40
    assert testMoves([wire]) == 3, "Should be 3 moves?"
    print "[OK]"

    print "Arcs and Lines-- No Arcs"
    # should MoveTo 40,50
    # draw to 50,40 in a lot of little moves
    # draw to 80,40 in one move
    assert testMoves([wire], False) > 10, "Should be lots of moves"

    print "Square Wire"
    assert testMoves([TestDisplay.makeSquareWire()], False) > 3
Esempio n. 5
0
import Wrappers
import TestDisplay


def listFromArray(stdArray):
    results = []
    for i in range(stdArray.Lower(), stdArray.Upper()):
        results.append(stdArray.Value(i))
    return results


if __name__ == '__main__':

    #make test wire, which has two edges
    [testWire, circleEdge, lineEdge] = TestDisplay.makeKeyHoleWire()
    testWire2 = TestDisplay.makeSquareWire()

    if testWire2.Closed():
        print "testWire2 is closed"
    else:
        print "testWire2 is not closed."
    TOLERANCE = 0.00001
    curve = BRepAdaptor.BRepAdaptor_CompCurve(testWire)

    print "CompCurve is parameterized between %0.5f and %0.5f " % (
        curve.FirstParameter(), curve.LastParameter())
    print "%d Continuity" % curve.Continuity()
    print "%d Intervals(C0)" % curve.NbIntervals(0)
    print "%d Intervals(C1)" % curve.NbIntervals(1)
    print "%d Intervals(C2)" % curve.NbIntervals(2)
    print "%d Intervals(C3)" % curve.NbIntervals(3)
Esempio n. 6
0
	# DrawTo 3,2.2
	assert testMoves([edge1,edge2,edge3]) == 3,"There should be Thee Moves"
	print "[OK]"
	
	print "Disconnected Edges"
	#the correct answer is:
	#  MoveTo 0,0
	#  Lineto 1,1
	#  MoveTo 2,2
	#  LineTo 3,2.2
	assert testMoves([edge1,edge3]) == 4,"Should be four moves"
	print "[OK]"
	
	print "Arcs And Lines"
	wire = makeTestWire();
	#the correct answer is:
	#  Moveto 40,50
	#  ArcTo  50,40 with center 40,40, ccw direction
	#  LineTo 80,40
	assert testMoves([wire]) == 3,"Should be 3 moves?"
	print "[OK]"
	
	print "Arcs and Lines-- No Arcs"
	# should MoveTo 40,50
	# draw to 50,40 in a lot of little moves
	# draw to 80,40 in one move
	assert testMoves([wire],False) > 10,"Should be lots of moves"
	
	print "Square Wire"
	assert testMoves([TestDisplay.makeSquareWire()],False) > 3;