[VBA/VB/C#]efan2000 13:49:50
Sub testEntity()
Dim vl(0 To 7) As Double
vl(2) = 20
vl(4) = 20
vl(5) = 10
vl(7) = 10
Dim lwp As AcadLWPolyline
Set lwp = ThisDrawing.ModelSpace.AddLightWeightPolyline(vl)
Dim mh As mcArxProject1Lib.Entity
Set mh = New mcArxProject1Lib.Entity
Dim t As Variant
Dim v As Variant
mh.getDXFGroupCode lwp, t, v
Dim s As String
Dim ss() As String
ReDim ss(UBound(t))
Dim i As Integer
Dim j As Integer
For i = 0 To UBound(t)
s = s & vbCrLf & vbTab & i & ": " & t(i) & ": "
If IsEmpty(v(i)) Then
s = s & "空"
Else
If VarType(v(i)) = vbInteger Then
s = s & v(i)
ElseIf VarType(v(i)) = vbLong Then
s = s & v(i)
ElseIf VarType(v(i)) = vbSingle Then
s = s & v(i)
ElseIf VarType(v(i)) = vbDouble Then
s = s & v(i)
ElseIf VarType(v(i)) = vbString Then
s = s & v(i)
ElseIf VarType(v(i)) = (vbArray Or vbDouble) Then
For j = 0 To UBound(v(i))
If j UBound(v(i)) Then
ss(i) = ss(i) & v(i)(j) & ", "
Else
ss(i) = ss(i) & v(i)(j)
End If
Next
s = s & ss(i)
End If
End If
Next
Debug.Print "getDXFGroupCode: " & s
End Sub
getDXFGroupCode:
0: -1: 2129989240
1: 0: LWPOLYLINE
2: 330: 2129988856
3: 5: 87
4: 100: AcDbEntity
5: 67: 0
6: 410: Model
7: 8: 0
8: 100: AcDbPolyline
9: 90: 4
10: 70: 0
11: 43: 0
12: 38: 0
13: 39: 0
14: 10: 0, 0, 0
15: 40: 0
16: 41: 0
17: 42: 0
18: 10: 20, 0, 0
19: 40: 0
20: 41: 0
21: 42: 0
22: 10: 20, 10, 0
23: 40: 0
24: 41: 0
25: 42: 0
26: 10: 0, 10, 0
27: 40: 0
28: 41: 0
29: 42: 0
30: 210: 0, 0, 1
[VBA/VB/C#]efan2000 13:50:36
命令: (entget (entlast))
((-1 . ) (0 . "LWPOLYLINE") (330 . ) (5 .
"87") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 .
"AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 0.0 0.0)
(40 . 0.0) (41 . 0.0) (42 . 0.0) (10 20.0 0.0) (40 . 0.0) (41 . 0.0) (42 . 0.0)
(10 20.0 10.0) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 0.0 10.0) (40 . 0.0) (41 .
0.0) (42 . 0.0) (210 0.0 0.0 1.0))
[VB&.NET]ppyyff 13:52:46
你这干嘛用
[VBA/VB/C#]efan2000 13:53:18
获取实体的组码
[VB&.NET]ppyyff 13:54:15
组吗一般查一下就行了
[VBA/VB/C#]efan2000 13:54:39
Dim o As AcadObject
Set o = ThisDrawing.ObjectIdToObject(2129988856)
Debug.Print "ObjectName: " & o.ObjectName
输出:
ObjectName: AcDbBlockTableRecord
VBA里有的没有这个属性,查不到。
[VB&.NET]ppyyff 13:55:26
这个 是啥 2129989240
是句柄吗
[VBA/VB/C#]efan2000 13:55:59
不是,ObjectId
[VB&.NET]ppyyff 13:56:06
哦
就是这个线的 ID
[VBA/VB/C#]efan2000 13:57:03
0: -1: 2129989240
2129989240是ObjectId
3: 5: 87
这里的87是句柄Handle。
[VB&.NET]ppyyff 13:57:44
是不是每个图的ObjectId是唯一的
每次打开时都是一样的
是不是每个图的每个实体 ObjectId是唯一的
?
[VBA/VB/C#]efan2000 13:58:55
2: 330: 2129988856
330是OwnerId,这里其实就是模型空间的ObjectId。
[VBA/VB/C#]efan2000 13:59:41
整个CAD,ObjectId是唯一的。一张图里,句柄是唯一的。
[VBA/VB/C#]efan2000 14:00:23
ObjectId每次打开图时是变化的,只有Handle不变。
[VB&.NET]ppyyff 14:01:34
每个实体Handle唯一吧
[VBA/VB/C#]efan2000 14:02:14
是的,只对该图唯一,其它图纸里可能存在一样的。
[VB&.NET]ppyyff 14:03:34
这样我能不能图形的中需要更改数据实体的Handle给与Excel中数据对应,当EXCEl数据更改了,我再Updata一下,让CAD中实体也发生变化?
VBA-华仔 14:03:59
可以
[VB&.NET]ppyyff 14:04:05
还有Handle是自动生成还是手动指定
清风明月名字897 14:04:20
请问,VLA这些函数的帮助说明在哪里查?
即VBA如何转换成LISP?
VBA-华仔 14:04:26
自动
[VBA/VB/C#]efan2000 14:04:34
当然可以了,Handle、ObjectId都是自动生成的,
[VB&.NET]ppyyff 14:04:49
VBA如何转换成LISP差别很大
为啥要转换
清风明月名字897 14:07:30
LISP好用些
[VB&.NET]ppyyff 14:08:03
LISP繁琐一些 |