有什么办法可以取得天正对象的坐标么
本帖最后由 lennie 于 2014-8-22 20:14 编辑我想用VBA获取天正文字的坐标,用网站提供的函数GetDXFCodeValuePublic Function GetDXFCodeValue(ent As Object, gCode As Integer) As Variant
Dim retval
Dim obj As New CL
retval = obj.EvalLispExpression("(cdr (assoc " & gCode & " (entget(handent " & Chr(34) & ent.Handle & Chr(34) & "))))")
GetDXFCodeValue = retval
Set obj = Nothing
End FunctionGetDXFCodeValue(ent,10) 时出错,请问有什么办法可以取得天正对象的坐标么?
自己解决了'获取图元组码
Public Function GetDXFCodeValue(Ent As Object, gCode As Integer) As Variant
Dim retval
Dim Obj As New CL
retval = Obj.EvalLispExpression("(cdr (assoc " & gCode & " (entget (handent " & Chr(34) & Ent.Handle & Chr(34) & "))))")
GetDXFCodeValue = retval
Set Obj = Nothing
End Function
'获取图元组码(点坐标)
Function GetDxfPoint(Ent As Object, gCode As Integer) As Variant
Dim retval
Dim aPoint(2) As Double
Dim Obj As New CL
retval = Obj.EvalLispExpression("(car(cdr (assoc " & gCode & " (entget (handent " & Chr(34) & Ent.Handle & Chr(34) & ")))))")
aPoint(0) = retval
retval = Obj.EvalLispExpression("(car (cdr (cdr (assoc " & gCode & " (entget (handent " & Chr(34) & Ent.Handle & Chr(34) & "))))))")
aPoint(1) = retval
GetDxfPoint = aPoint
Set Obj = Nothing
End Function 自己的问题自己解决啊! Dim Obj As New CL
CL是VL类吧?在VB中如何加载VL类?
页:
[1]