Example #1
0
def FindText():
    res=kcs_ui.string_req('请输入需要查找的文字','')
    if res[0]==kcs_util.ok():
        hdList=FindString(res[1])
        if len(hdList) == 1:
            ZoomElement(hdList[0])
            res=kcs_ui.answer_req('Find','是否要替换文本?')
            if res[0]==kcs_util.yes():
                ReplaceOne(hdList[0])
        elif len(hdList) > 1:
            ZoomElement(hdList[0])
            index=1
            while True:
                if index>len(hdList):
                    kcs_ui.message_noconfirm("已经是最后一个")
                    return
                res=kcs_ui.answer_req(r'共找到%s个,当前第%s个'%(len(hdList),index),'是否要替换文本?')
                if res==kcs_util.yes():
                    ReplaceOne(hdList[index-1])
                    index+=1
                    continue
                elif res==kcs_util.no():
                    ZoomElement(hdList[index])
                    index+=1
                    continue
                else:
                    return
        elif len(hdList) == 0:
            kcs_ui.message_confirm("没有找到任何匹配的文字")
Example #2
0
def SpliteFlange():
    flange = GetFlange()
    group = kcs_hullpan.group_get(flange.Name, flange.PartId)
    stmt = kcs_hullpan.stmt_get(flange.Name, group)
    pos = GetPosition()
    newStmt = GetNewStmt(stmt, pos[0], pos[1])
    kcs_ui.message_confirm(stmt + '\n' + newStmt[0] + '\n' + newStmt[1])
    kcs_hullpan.stmt_exec(0, newStmt[0])
    kcs_hullpan.stmt_exec(0, newStmt[1])
    stmt2 = 'DEL, ' + stmt
    kcs_hullpan.stmt_exec(group, stmt2)
def run():
    model = CommonSample.SelectModel('plane panel', 'select part')
    group = kcs_hullpan.group_get(model.Name, model.PartId)
    stmt = kcs_hullpan.stmt_get(model.Name, group)
    
    kcs_ui.message_confirm(stmt)
    panel2 = CommonSample.SelectModel('plane panel', 'select part')
    kcs_hullpan.pan_activate([panel2.Name])
    kcs_hullpan.stmt_exec_single(0, stmt, panel2.Name)
    kcs_hullpan.pan_store([panel2.Name])
    kcs_hullpan.pan_skip([panel2.Name])
Example #4
0
def run():
    model = CommonSample.SelectModel('plane panel', 'select part')
    group = kcs_hullpan.group_get(model.Name, model.PartId)
    stmt = kcs_hullpan.stmt_get(model.Name, group)

    kcs_ui.message_confirm(stmt)
    panel2 = CommonSample.SelectModel('plane panel', 'select part')
    kcs_hullpan.pan_activate([panel2.Name])
    kcs_hullpan.stmt_exec_single(0, stmt, panel2.Name)
    kcs_hullpan.pan_store([panel2.Name])
    kcs_hullpan.pan_skip([panel2.Name])
Example #5
0
def FindAndReplace():
    res, txt = kcs_ui.string_req("请输入需要查找的内容", "")
    if res == kcs_util.ok():
        hdList = FindString(txt)
        if len(hdList) == 1:
            ZoomElement(hdList[0])
            Replace(hdList)
        elif len(hdList) > 1:
            kcs_ui.message_noconfirm("找到" + str(len(hdList)) + "个匹配的文字,将显示第一个")
            ZoomElement(hdList[0])
            Replace(hdList)
        elif len(hdList) == 0:
            kcs_ui.message_confirm("没有找到任何匹配的文字")
Example #6
0
def run():
    if not kcs_util.app_planar_hull():
        kcs_ui.message_confirm('该功能只能在Plannar Hull模块下使用.')
        return
    
    SpliteFlange()