peifei 发表于 2003-5-28 23:46:00

[求助]怎样在Visual LISP调用Laycur命令?

我用Visual LISP编写一个小程序,调用laycur(将所选对象置于当前层),执行时报错:“未知命令!”请大虾指点!!

sealive 发表于 2003-5-28 23:49:00

(defun C:Laycur()

meflying 发表于 2003-5-29 08:41:00

可是LAYCUR并没有这个命令

龙龙仔 发表于 2003-5-29 12:28:00

是ai_molc命令

spring 发表于 2003-5-29 21:34:00

ai_molc

(defun c:ai_molc(/ old_error end_undo old_cmdecho set1 ent undo_control)

(defun molc_error (s)
        (if old_error (setq *error* old_error))
        (if (eq end_undo 1) (command "_.undo" "_end"))
        (if old_cmdecho (setvar "cmdecho" old_cmdecho))
        (princ)
)
(setq old_error *error*)
(setq *error* molc_error)
(setq old_cmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if (and (eq 1 (logand 1 (getvar "pickfirst")))
            (setq set1 (ssget"_i"))
                (eq 1 (sslength set1))
          )
   (progn
           (setq ent (entget (ssname set1 0)))          
       (sssetfirst nil nil)
       )
       (progn
           (sssetfirst nil nil)
           (setq ent (entget (car (entsel "\nSelect object whose layer will become current: "))))
       )
)

(setq undo_control (getvar "undoctl"))

(setq end_undo 0)
(if (and (= 1 (logand 1 undo_control))   ; undo on
         (/= 2 (logand 2 undo_control)); not single undo
                 (/= 8 (logand 8 undo_control)); no active group
          )
          (progn
                (command "_.undo" "_begin")
          (setq end_undo 1)
      )
)
(setvar "clayer" (cdr (assoc '8 ent)))
(princ (strcat "\n" (getvar "clayer") " is now the current layer."))
(if (eq 1 end_undo)
    (command "_.undo" "_end")
)
(setvar "cmdecho" old_cmdecho)
(setq *error* old_error)
(princ)
)

xazhji 发表于 2003-6-20 11:58:00

意思好像不大

zzl9105 发表于 2011-11-8 11:21:54

03年的帖子
请问下,那要调用这个命令laycur,要加一句什么样的话呀
页: [1]
查看完整版本: [求助]怎样在Visual LISP调用Laycur命令?