![]() |
【转帖】各位高手:添加一多义线并设置线型错在什么地方
各位高手:添加一多义线并设置线型错在什么地方
www.dimcax.com 各位高手:添加一多义线并设置线型错在什么地方 '绘多义线 <commandmethod("addpl")> _ public sub addpl() dim pl as new polyline dim db as database dim trans as transaction dim btr as blocktablerecord dim bt as blocktable 'dim li as object db = hostapplicationservices.workingdatabase trans = db.transactionmanager.starttransaction bt = trans.getobject(db.blocktableid, openmode.forwrite) btr = trans.getobject(bt(blocktablerecord.modelspace), openmode.forwrite) 'dim plinetypetbl as linetypetable = trans.getobject(db.linetypetableid, openmode.forread) 'if plinetypetbl.has("dashdot") then 'db.loadlinetypefile("dashdot", "acadiso.lin") 'end if dim point2d(2) as point2d point2d(0) = new point2d(10, 10) point2d(1) = new point2d(10, 5) point2d(2) = new point2d(30, 40) pl.addvertexat(0, point2d(0), 0, 1, 1) pl.addvertexat(1, point2d(1), 0, 1, 1) pl.addvertexat(2, point2d(2), 0, 1, 1) pl.linetypeid = creatlinetype("dashdot") ' pl.linetype = "dashdot" btr.appendentity(pl) trans.addnewlycreateddbobject(pl, true) trans.commit() trans.dispose() end sub private function creatlinetype(byval linetypename as string) as objectid dim linetypeid as objectid dim db as database = hostapplicationservices.workingdatabase using trans as transaction = db.transactionmanager.starttransaction dim it as linetypetable = trans.getobject(db.linetypetableid, openmode.forread) if it.has(linetypename) then linetypeid = it.item(linetypename) else db.loadlinetypefile(linetypename, "acadiso.lin") dim ltr as new linetypetablerecord ltr.name = linetypename it.upgradeopen() linetypeid = it.add(ltr) trans.addnewlycreateddbobject(ltr, true) end if trans.commit() end using return linetypeid end function dim it as linetypetable = trans.getobject(db.linetypetableid, openmode.forread) openmode.forread 改为openmode.forwrite 没有测试过,只是看见这个地方有问题 |
| 所有的时间均为北京时间。 现在的时间是 02:32 PM. |