CAD把自定义实体,变成普通实体(com接口VB语言)

主要用到函数说明:


MxDrawXCustomEvent::MxDrawXCustomEntity::explode


把自定义实体,变成普通实体,详细说明如下:


参数 说明

LONGLONG lEntity

自定义实体id

LONGLONG lBlkRecId

用来临时普通实体的块表记录id


代码实现如下:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
If sEventName = "MxDrawXCustomEntity::explode" Then
 
Dim param66 As MxDrawResbuf
Set param66 = MxDrawX1.CustomEventParam()
 
 
Dim lBlockRecId As Long
 
lBlockRecId = param66.AtLong(1)
 
Dim customEntity As MxDrawCustomEntity
Set customEntity = MxDrawX1.CallEx("Mx_GetCustomEntity", param66)
 
If customEntity.IsHave("startpoint") Then
Else
Exit Sub
 
End If
 
If customEntity.IsHave("endpoint") Then
Else
Exit Sub
 
End If
 
 
 
 
Set database = MxDrawX1.GetDatabase
 
 
Dim blkRec As MxDrawBlockTableRecord
 
Set blkRec = database.ObjectIdToObject(lBlockRecId)
 
Dim sPt  As MxDrawPoint
Dim ePt  As MxDrawPoint
 
Set sPt = customEntity.GetPoint("startpoint")
Set ePt = customEntity.GetPoint("endpoint")
 
blkRec.AddLine sPt, ePt
 
End If

posted on 2019-06-11 16:25  梦想CAD控件  阅读(439)  评论(0)    收藏  举报

导航