예제 #1
0
def moveobjects(objects, x, y):
    moveObjects = [objects]
    if isinstance(objects, ListType):
        moveObjects = objects

    script = ""
    for object in moveObjects:
        script += "MOVE " + object + (" (%f %f);" % (x, y))
    instance().executeCommand(COMMAND.executescr, [script])
예제 #2
0
def setGridUnitValue(value=-1):
    script = "GRID "
    if value == GRID.VALUE.FINEST:
        script += "FINEST;"
    elif value == GRID.VALUE.LAST:
        script += "LAST;"
    elif value == GRID.VALUE.DEFAULT or value == 0:
        script += "DEFAULT;"
    else:
        script += str(value)

    instance().executeCommand(COMMAND.executescr, [script])
예제 #3
0
def setGridUnitType(value):
    script = "GRID "
    if value == GRID.UNIT.MIC:
        script += "MIC;"
    elif value == GRID.UNIT.MM:
        script += "MM;"
    elif value == GRID.UNIT.MIL:
        script += "MIL;"
    elif value == GRID.UNIT.INCH:
        script += "INCH;"
    else:
        raise EaglepyException("Invalid unit type %s." % value)

    instance().executeCommand(COMMAND.executescr, [script])
예제 #4
0
def setgroup(objects):
    multi = False
    if isinstance(objects, ListType):
        multi = True

    objectsArg = objects if not multi else ";".join(objects)
    clrgroupall()
    result = instance().executeCommand(COMMAND.setgroup, [objectsArg])
예제 #5
0
def palette(index, type=PALETTE.DEFAULT):
    if index < 0 or index > PALETTE.ENTRIES - 1:
        raise EaglepyException("Invalid index %d. 0<index<%d" % (index, PALETTE.ENTRIES))
    if type < PALETTE.DEFAULT or type > 2:
        raise EaglepyException("Invalie type index %d" % type)

    result = instance().executeCommand(COMMAND.palette, [index, type])
    result = int(result)
    color = (result >> 16 & 255, result >> 8 & 255, result & 255, result >> 24 & 255)
    return color
예제 #6
0
def paletteall(type=PALETTE.DEFAULT):
    if type < PALETTE.DEFAULT or type > 2:
        raise EaglepyException("Invalie type index %d" % type)

    result = instance().executeCommand(COMMAND.paletteall, [type])
    entries = []
    for colorstr in result[1:].split(":"):
        color = int(colorstr)
        entries.append((color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255))

    return entries
예제 #7
0
def executescr(script):
    result = handleReplyError(instance().executeCommand(COMMAND.executescr, [script]))
예제 #8
0
def dlgMessageBox(message):
    return handleReplyError(instance().executeCommand(COMMAND.dlgMessageBox, [message]))
예제 #9
0
def getcontext():
    return int(instance().executeCommand(COMMAND.getcontext))
예제 #10
0
def clrgroupall():
    result = instance().executeCommand(COMMAND.clrgroupall)
예제 #11
0
def window():
    instance().executeCommand(COMMAND.executescr, ["Window;"])
예제 #12
0
def status(message):
    instance().executeCommand(COMMAND.status, [message])
예제 #13
0
def executescr(script):
    instance().executeCommand(COMMAND.executescr, [script])
예제 #14
0
def selected():
    return _objectsFromIndicies(handleReplyError(instance().executeCommand(COMMAND.getselected)))
예제 #15
0
def allobjects():
    for index in range(len(__allobjects_cached_list)):
        __allobjects_cached_list.pop(0)
    for item in _objectsFromIndicies(handleReplyError(instance().executeCommand(COMMAND.allobjects))):
        __allobjects_cached_list.append(item)
    return __allobjects_cached_list