在VS里新建了一个项目(已经将 为com生成互操作 选中)
下面是部分代码:
- Public Class PointEx
- Public Function GetPointZCoord(ByVal Pt As Object, ByRef ZCoord As Double) As Boolean
- Try
- If Pt Is Nothing OrElse Pt.ObjectName <> "AcDbPoint" Then
- Return False
- End If
- Dim Coord() As Double = Pt.Coordinates()
- ZCoord = Coord(2)
- Return True
- Catch ex As Exception
- Return False
- End Try
- End Function
- End Class
现在需要在lisp里调用 ,代码如下:
- (setq ptTool (vlax-create-object "VLispEx.PointEx")) ;此处能正常运行
- (setq Z 0)
- (vlax-invoke ptTool 'GetPointZCoord (vlax-ename->vla-object (car (entsel))) Z);此处也能正常运行,就是Z的值返回不了,为何?
- (vlax-release-object ptTool)
请问为什么返回不了 Z 的值?应该怎么处理?
|