几何尺寸与公差论坛------致力于产品几何量公差标准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二次开发例程 (http://www.dimcax.com/hust/showthread.php?t=9620)

yang686526 2009-04-21 11:34 AM

【转帖】学习vb.net二次开发例程
 
学习vb.net二次开发例程
www.dimcax.com
学习vb.net二次开发例程
<commandmethod("getcircle")> public sub getcircle()
dim ed as editor = application.documentmanager.mdiactivedocument.editor
'创建一个选择实体的选择集选项,并限制为只能选择圆(使用了addallowedclass函数)
dim entityselectionopts as promptentityoptions = new promptentityoptions("\nselect circle")
entityselectionopts.setrejectmessage("\nonly circles may be selected.")
entityselectionopts.addallowedclass(gettype(circle), true)
'开始选择圆的过程
dim entityselectionresult as promptentityresult = ed.getentity(entityselectionopts)
'如果成功选择了一个圆,就在命令行显示圆的半径
if entityselectionresult.status = promptstatus.ok then
dispalycircleradius(entityselectionresult.objectid)
end if
end sub
private sub dispalycircleradius(byval circleid as objectid)
dim ed as editor = application.documentmanager.mdiactivedocument.editor
dim trans as transaction
trans = ed.document.transactionmanager.starttransaction
dim selectedcircle as circle = ctype(trans.getobject(circleid, openmode.forread), circle)
application.showalertdialog("选择的园半径为:" + selectedcircle.radius.tostring)
trans.commit()
end sub
编译的时候,红色标示部分总是提示类型不能转换,请问大家遇到过吗?该怎么解决呢?
已经解决,呵呵
是由于同一个解决方案中其它项目加载了
楼上的朋友。请问你是如何设置。net环境的?能否教教我?谢谢


所有的时间均为北京时间。 现在的时间是 12:31 AM.