查看单个帖子
旧 2009-04-21, 10:45 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 如何用vb.net的arx方法生成面域

如何用vb.net的arx方法生成面域
www.dimcax.com
如何用vb.net的arx方法生成面域我写了一段代码,先画一个圆,再生成面域。结果圆能画出,面域却创建失败,请各位高手看看错在哪?先谢!
imports autodesk.autocad.applicationservices
imports autodesk.autocad.databaseservices
imports autodesk.autocad.geometry
imports autodesk.autocad.runtime
imports autodesk.autocad.interop
imports autodesk.autocad.interop.common
public class class1
<commandmethod("test")> public shared sub testtemp()
dim bt as blocktable
dim btr as blocktablerecord
dim cenpt as new point3d(0, 0, 0) '先画一个圆
dim circleobj as circle
try
dim db as database = hostapplicationservices.workingdatabase
dim objid as objectid = db.blocktableid
bt = objid.open(openmode.forread)
objid = bt.item(btr.modelspace)
btr = objid.open(openmode.forwrite)
circleobj = new circle
circleobj.center = cenpt
circleobj.radius = 300
btr.appendentity(circleobj)
catch
finally
circleobj.close()
btr.close()
bt.close()
end try
dim array as dbobjectcollection = new dbobjectcollection '建立一个集合
array.add(circleobj) '将圆添加到集合中
dim reginobj as region
try
dim db as database = hostapplicationservices.workingdatabase
dim objid as objectid = db.blocktableid
bt = objid.open(openmode.forread)
objid = bt.item(btr.modelspace)
btr = objid.open(openmode.forwrite)
reginobj = new region
region.createfromcurves(array)
btr.appendentity(reginobj)
catch
finally
reginobj.close()
btr.close()
bt.close()
end try
end sub

end class
region.createfromcurves(array)
返回的是dbobjectcollection类型
你的reginobj 还是null,并没有付给它
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)