def test(self): from pyincad import core pro = core.incadproject() sta = pro.openproject("c:\\incadtest\\test1.fdb") id = pro.nametoid('a') cset = pro.crossset(id) cset.load() csec = cset.item(0) clin = csec.addline(55) csec.save() print csec.refid() pro.closeproject()
def inputhdx(databasename, hdxfilename, rampid, groundid, hdxid): import string thepro = core.incadproject() thepro.openproject(databasename) cset = thepro.crossset(rampid) cset.removeall() grd = thepro.ground(rampid, groundid) grd.load() hdxfi = file(hdxfilename) iii = 1 for lines in hdxfi: #print i,":",lines if iii == 1: cursec = core.crosssection() curline = core.crossline() #输入桩号 ch = string.atof(lines) dmxhigh = grd.high(ch) print "横断面地面线桩号", ch, "中心高程", dmxhigh cursec = cset.append(ch) curline = cursec.addline(hdxid) curline.append1(0, dmxhigh) cursec.save() if iii == 2: #左侧点 lpts = lines.split() for (offset, pt) in enumerate(lpts): lpts[offset] = string.atof(pt) for i in range(0, len(lpts), 2): curline.append1(-lpts[i], lpts[i + 1], 0, True) if iii == 3: #右侧点 rpts = lines.split() for (offset, pt) in enumerate(rpts): rpts[offset] = string.atof(pt) for i in range(0, len(rpts), 2): curline.append1(rpts[i], rpts[i + 1]) if iii == 4: curline.save() iii = 0 iii = iii + 1 #print fi hdxfi.close() thepro.closeproject() print "完成读入横断面地面线"
def inputhdx(databasename,hdxfilename,rampid,groundid,hdxid): import string thepro=core.incadproject() thepro.openproject(databasename) cset=thepro.crossset(rampid) cset.removeall() grd=thepro.ground(rampid,groundid) grd.load() hdxfi=file(hdxfilename) iii=1 for lines in hdxfi: #print i,":",lines if iii == 1: cursec=core.crosssection() curline=core.crossline() #输入桩号 ch=string.atof(lines) dmxhigh=grd.high(ch) print "横断面地面线桩号",ch,"中心高程",dmxhigh cursec=cset.append(ch) curline=cursec.addline(hdxid) curline.append1(0,dmxhigh) cursec.save() if iii == 2: #左侧点 lpts=lines.split() for (offset,pt) in enumerate(lpts): lpts[offset]=string.atof(pt) for i in range(0,len(lpts),2): curline.append1(-lpts[i],lpts[i+1],0,True) if iii == 3: #右侧点 rpts=lines.split() for (offset,pt) in enumerate(rpts): rpts[offset]=string.atof(pt) for i in range(0,len(rpts),2): curline.append1(rpts[i],rpts[i+1]) if iii==4 : curline.save() iii=0 iii=iii+1 #print fi hdxfi.close() thepro.closeproject() print "完成读入横断面地面线"
def test1(databasename, rampid): #测试横断面取值 thepro = core.incadproject() thepro.openproject(databasename) cset = thepro.crossset(rampid) cset.load() for i in range(0, cset.count()): sec = cset.item(i) sec.load() secline = sec.getat(55) h1 = secline.high(1.50) h2 = secline.high(2.0) dh = h2 - h1 if abs(dh) > 2.0 / 100. * 0.5 + 0.05: #print "aleart:",sec.ch(),h2-h1 drawhdm(secline) break print "finished" thepro.closeproject()
def test1(databasename,rampid): #测试横断面取值 thepro=core.incadproject() thepro.openproject(databasename) cset=thepro.crossset(rampid) cset.load() for i in range(0,cset.count()): sec=cset.item(i) sec.load() secline=sec.getat(55) h1=secline.high(1.50) h2=secline.high(2.0) dh=h2-h1 if abs(dh) > 2.0/100.*0.5+0.05: #print "aleart:",sec.ch(),h2-h1 drawhdm(secline) break print "finished" thepro.closeproject()
# -*- coding: utf-8 -*- # 测试incadproject # __author__ = 'leiwei' from pyincad import core pro=core.incadproject() sta=pro.openproject("c:\\incadtest\\test1.fdb") #id=pro.nametoid('b') #pro.modifycomment('test project12345 ') id=pro.nametoid('a') print id print pro.projectpath() print "OK"