我确实弄明白了。我将变体作为论据传递给该方法。它需要有一个点的列表形式。ie’(0)
我的工作代码如下:
(defun c:day () ;Please note that there is not any error trapping ;Load Visual Lisp Extensions (vl-load-com) ;Prompt User for the Line Object (setq line-obj (vlax-ename->vla-object (car (entsel "\nSelect Line Object: ")))) ;Prompt User for the Surface Object (setq surface-obj (vlax-ename->vla-object (car (entsel "\nSelect Surface Object: ")))) ;Define the Point to Vector function (defun pnt->vec (p1 p2 / vx vy vz) (if (equal p1 p2) (list 0 0 0) (progn(setq dist (distance p1 p2)) (setq vx (/ (- (nth 0 p2)(nth 0 p1)) dist)) (setq vy (/ (- (nth 1 p2)(nth 1 p1)) dist)) (setq vz (/ (- (nth 2 p2)(nth 2 p1)) dist)) (list vx vy vz)) ) ) ;Return the StartPoint of the Line (setq p1 (vlax-safearray->list (vlax-variant-value (vla-get-startpoint line-obj)))) ;Return the Vector using the Start and End Point of the Line (setq vec (pnt->vec (vlax-safearray->list (vlax-variant-value (vla-get-startpoint line-obj))) (vlax-safearray->list (vlax-variant-value (vla-get-endpoint line-obj))) )) ;Invoke the IntersectPointWithSurface Method (setq p (vlax-invoke surfobj 'IntersectPointWithSurface p1 vec)) )
好啊因此,在做了一些进一步的测试后,我发现上述代码在Civil 3D 2011上同样有效。然后,我使用了该代码并在Civil 3D 2009上进行了尝试,该方法期望该争论是变体。我没有收到我第一次描述的解卷错误。很抱歉在VBA和中发布此代码。NET论坛,但第一次寻找VBA/。这个谜题的答案。我似乎在使用这段代码时没有得到一致的结果。
当做
Hippe013