几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(VB.NET/C#) (http://www.dimcax.com/hust/forumdisplay.php?f=176)
-   -   如何用vb.net的arx方法生成面域 (http://www.dimcax.com/hust/showthread.php?t=9567)

yang686526 2009-04-21 10:45 AM

如何用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,并没有付给它


所有的时间均为北京时间。 现在的时间是 01:18 PM.