Coder 发表于 2015-4-16 06:49:34

将对话框与类文件链接

大家好,我需要用一个按钮链接一个对话框,用类文件中写的代码画一条线,我该怎么做?类别档案代码。   导入Autodesk,AutoCAD.Runtime。
导入Autodesk,AutoCAD . application services 。
导入Autodesk,AutoCAD.DatabaseServices。
导入Autodesk,AutoCAD.Geometry。

命名空间myspace。
公共类rocks。

Public Sub AddLine()。
' '获取当前文档和数据库。
Dim acDoc As Document = Application,document manager . MdiActiveDocument 。
Dim acCurDb As Database = acDoc,数据库。
' '开始事务处理。
使用acTrans作为Transaction = acCurDb,transaction manager . start transaction()。
' '打开块表进行读取。
Dim acBlkTbl As block table 。
acBlkTbl = acTrans,GetObject(acCurDb,BlockTableId,OpenMode。ForRead)。
' '打开块表记录模型空间进行写操作。
Dim acBlkTblRec As block table record 。
acBlkTblRec = acTrans,GetObject(acBlkTbl(BlockTableRecord,ModelSpace)、OpenMode。ForWrite)。
Dim acLine As Line = New Line(新点3d(0,0,0),新点3d(12,3,0))。


将ltt调成LinetypeTable。
ltt = acTrans,GetObject(acCurDb,LinetypeTableId,OpenMode。ForRead)。
如果不是ltt,Has("HIDDEN") Then。
acCurDb,LoadLineTypeFile("HIDDEN "," acad.lin")。
结束If。


' '将新对象添加到块表记录和事务中。
acBlkTblRec,AppendEntity(acLine)。
acTrans,AddNewlyCreatedDBObject(acLine,True)。
' '将新对象保存到数据库中。
acTrans,Commit()。
结束使用。
结束Sub。
结束课程。
结束命名空间。

对话框表单代码,我按如下所示进行了尝试,但仍然不起作用。    Public Class form 1()。
Private Sub Button1 _ Click(sender As Object,e As EventArgs)处理button 1。单击。
Dim a As MySpace . rocks = New MySpace . rocks 。
a.AddLine()。

结束Sub。
结束课程。

**** Hidden Message *****

MexicanCustard 发表于 2015-4-16 09:29:46

翻译错误代码(429):请求 QPS 超过限制。

Coder 发表于 2015-4-16 12:16:21

翻译错误代码(429):请求 QPS 超过限制。

MexicanCustard 发表于 2015-4-16 12:57:29

翻译错误代码(429):请求 QPS 超过限制。

Coder 发表于 2015-4-16 13:14:44

翻译错误代码(429):请求 QPS 超过限制。

CADbloke 发表于 2015-4-16 18:53:36

翻译错误代码(429):请求 QPS 超过限制。

CADbloke 发表于 2015-4-28 06:02:54

翻译错误代码(429):请求 QPS 超过限制。

MexicanCustard 发表于 2015-4-28 07:46:18

翻译错误代码(429):请求 QPS 超过限制。
页: [1]
查看完整版本: 将对话框与类文件链接