def CleanDwg(): oldSize = kcs_draft.dwg_size_get() # in Kbyes name = kcs_draft.dwg_name_get() kcs_draft.dwg_pack() kcs_draft.dwg_purge() kcs_util.clean_workspace() newSize = kcs_draft.dwg_size_get() msg = """图纸:%s清理完毕 清理前大小:%s Kbytes 清理后大小:%s Kbytes """ % (name, oldSize, newSize) kcs_ui.message_noconfirm(msg)
def CreateForm(): "create a form with n pages." #check whether view exist. ViewName = 'KT_FORM' for view in ktDraft.GetViews(): if view[1] == 'KT_FORM': print 'view already exist.' return hd = kcs_draft.view_new(ViewName) res = kcs_ui.int_req("How many pages do you want?", 1) if res[0] == kcs_util.ok(): for i in range(res[1]): pg = Page() pg.Location = Point2D(i * 420, 0) pg.Index = i + 1 kcs_draft.subpicture_current_set(hd) pg.Draw() kcs_draft.dwg_purge()
pt=Point2D() res=kcs_ui.point2D_req('Please pick the left-top corner of table.',pt) if res[0]==kcs_util.ok(): t=Table() t.Init(m, n, width, res[1]) t.Draw() 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]) if __name__=='__main__': li=[('IAN','23','shanghai','13482488167'), ('jiang','32','jiangsu','13469952399'), ('hua','24','xuhui,shanghai,china','64685500')] # t=Table() # t.ReadList(li) # t.Draw() # MoveColumn() # ChangeColumnWidth() kcs_draft.dwg_purge() kcs_draft.dwg_repaint()