def ChangeColumnText(): pt=Point2D() res=kcs_ui.point2D_req('Please select the column',pt) if res[0]==kcs_util.ok(): hdView=kcs_draft.view_identify(res[1]) comp=kcs_draft.component_identify(res[1]) #get column index from comp name name=kcs_draft.subpicture_name_get(comp) colIndex=int(name[2:].split('X')[0]) table=Table(hdView) res=kcs_ui.string_req('Please enter the string','iknot') if res[0]==kcs_util.ok(): table.ChangeColumnText(colIndex, res[1])
def MoveColumn(): pt=Point2D() res=kcs_ui.point2D_req('Please select the column',pt) if res[0]==kcs_util.ok(): hdView=kcs_draft.view_identify(res[1]) comp=kcs_draft.component_identify(res[1]) #get column index from comp name name=kcs_draft.subpicture_name_get(comp) colIndex=int(name[2:].split('X')[0]) table=Table(hdView) res=kcs_ui.int_req('Please enter the offset',100) if res[0]==kcs_util.ok(): table.MoveColumn(colIndex, res[1])
def run(): actions=['View','Subview','Component','Element'] res,act=kcs_ui.choice_select('View info','Select the type',actions) if res==kcs_util.ok(): pt=Point2D() if act==1: ees=ktDraft.GetViews() printElements(ees) elif act==2: kcs_ui.point2D_req('Select',pt) hd=kcs_draft.view_identify(pt) ees=ktDraft.GetSubviews(hd) printElements(ees) elif act==3: kcs_ui.point2D_req('Select',pt) hd=kcs_draft.subview_identify(pt) ees=ktDraft.GetComponents(hd) printElements(ees) elif act==4: kcs_ui.point2D_req('Select',pt) hd=kcs_draft.component_identify(pt) ees=ktDraft.GetSubElements(hd) printElements(ees)
def GetKtView(): #obsolete, do not use it. """返回KNOT_VIEW handle""" try: return kcs_draft.view_identify("KNOT_VIEW") except: return kcs_draft.view_new("KNOT_VIEW")