newer 发表于 2021-1-16 21:05:32

创建不带annotation 的 leader

Creating a leader without annotation

问题:

When I create a leader without annotation in Visual LISP with vla-addLeader. I
use NIL for the annotation-parameter but Visual LISP does not accept NIL for the
annotation-object, and VBA permits "a nothing object" for this parameter. Is
there an analogous object in VLISP ActiveX that can be used?

解答:

VLISP ActiveX does not have a provision for creating a leader with a null
annotation. Although you can specify a nothing object in VBA for the parameter,
there is no parallel object in Visual LISP. Nil nor the constructs of
vlax-vbEmpty or vlax-vbNull will be accepted.

The workaround is to associate an MTEXT object that has an empty string with the
leader, and align the MTEXT object with the last point that is specified in the
leader:


(vl-load-com)

(defun test ()
(setq mspace (vla-get-modelspace
                         (vla-get-activedocument (VLAX-GET-ACAD-OBJECT))
                   )
)

(setq pt1 (vlax-3d-point (list 3 1 )))
(setq width 3 text "")
(setq mtxtObj (vla-addmtext mspace pt1 width text))

(setq ptlist (apply 'append (list '(1 1 0) '(3 1 0))))
(setq pts (vlax-make-safearray vlax-vbDouble '(0 . 5)))
(vlax-safearray-fill pts ptlist)
(setq ptsVar (vlax-make-variant pts))

(setq ldr (vla-addleader mspace ptsVar mtxtObj acLineWithArrow))
)


hh_lj007 发表于 2021-1-27 09:19:27

谢谢大神分享,学习理解中

香远益清 发表于 2021-2-4 10:24:56

当我用vla addLeader在visuallisp中创建不带注释的引线时。我

使用NIL作为注释参数,但是visuallisp不接受NIL作为注释参数

注释对象,VBA允许此参数使用“无对象”。是

在VLISP ActiveX中有一个类似的对象可以使用吗?
页: [1]
查看完整版本: 创建不带annotation 的 leader