Beispiel #1
0
def getEntityEntity(sympyEntity):
    """
        convert sympy object into PyCAD object
    """
    if isinstance(sympyEntity, geoSympy.Circle):
        arg = {
            "ARC_0": Point(0.0, 0.0),
            "ARC_1": 1,
            "ARC_2": None,
            "ARC_3": None
        }
        arc = Arc(arg)
        arc.setFromSympy(sympyEntity)
        return arc
    elif isinstance(sympyEntity, geoSympy.Point):
        p = Point(0.0, 0.0)
        p.setFromSympy(sympyEntity)
        return p
    elif isinstance(sympyEntity, geoSympy.Segment):
        segArg = {"SEGMENT_0": Point(0.0, 0.0), "SEGMENT_1": Point(1.0, 1.0)}
        seg = Segment(segArg)
        seg.setFromSympy(sympyEntity)
        return seg
    elif isinstance(sympyEntity, geoSympy.Ellipse):
        arg = {
            "ELLIPSE_0": Point(0.0, 0.0),
            "ELLIPSE_1": 1.0,
            "ELLIPSE_2": 2.0
        }
        e = Ellipse(arg)
        e.setFromSympy(sympyEntity)
        return e
    else:
        raise "not supported entity"
def getEntityEntity(sympyEntity):
    """
        convert sympy object into PyCAD object
    """
    if isinstance(sympyEntity, geoSympy.Circle):
        arg={"ARC_0":Point(0.0, 0.0), 
             "ARC_1":1, 
             "ARC_2":None, 
             "ARC_3":None
             }    
        arc=Arc(arg)
        arc.setFromSympy(sympyEntity)
        return arc
    elif isinstance(sympyEntity, geoSympy.Point):
        p=Point(0.0, 0.0)
        p.setFromSympy(sympyEntity)
        return p
    elif isinstance(sympyEntity, geoSympy.Segment):
        segArg={"SEGMENT_0":Point(0.0, 0.0), "SEGMENT_1":Point(1.0, 1.0)}
        seg=Segment(segArg)
        seg.setFromSympy(sympyEntity)
        return seg
    elif isinstance(sympyEntity, geoSympy.Ellipse):
        arg={"ELLIPSE_0":Point(0.0, 0.0), "ELLIPSE_1":1.0, "ELLIPSE_2":2.0}
        e=Ellipse(arg)
        e.setFromSympy(sympyEntity)
        return e
    else:
        raise "not supported entity"
def testSympySegment():
    print "++ Sympy Segment ++"
    p1 = Point(0, 1)
    p2 = Point(10, 20)
    arg = {"SEGMENT_0": p1, "SEGMENT_1": p2}
    seg = Segment(arg)
    symSeg = seg.getSympy()
    print symSeg
    p3 = Point(30, 40)
    arg1 = {"SEGMENT_0": p1, "SEGMENT_1": p3}
    seg1 = Segment(arg1)
    seg1.setFromSympy(symSeg)
    print "Segment ", seg1
    print "-- Sympy Segment --"
Beispiel #4
0
def testSympySegment():
    print "++ Sympy Segment ++"
    p1=Point(0, 1)
    p2=Point(10, 20)
    arg={"SEGMENT_0":p1, "SEGMENT_1":p2}
    seg=Segment(arg)
    symSeg=seg.getSympy()
    print symSeg
    p3=Point(30, 40)
    arg1={"SEGMENT_0":p1, "SEGMENT_1":p3}
    seg1=Segment(arg1)
    seg1.setFromSympy(symSeg)
    print "Segment ", seg1
    print "-- Sympy Segment --"