Accoes 发表于 2022-7-6 17:05:38

添加revcloud+另一个命令

大家好
我一直在尝试使用revcloud命令创建lisp。此命令之前的所有操作都有效,但一旦它到达revcloud,lisp将在绘制云后终止。我需要再添加一个命令以将ucs重置为world。我想使用acad命令,而不是自制的。

lpseifert 发表于 2022-7-6 17:36:00

尝试将其放在revcloud命令之后和UCS之前

(while (> (getvar 'CmdActive) 0) (command pause))
顺便提一下如果您真的发布了代码,那么调试代码会更容易。

Accoes 发表于 2022-7-6 17:59:22

谢谢,做得很好。下次我会发帖子,因为我没有发表评论

Lee Mac 发表于 2022-7-6 18:15:44

不确定这是否有用
 
 


;|

   .: Revision Marker :.

   .: by Lee McDonnell:.

    .: December 2008 :.

      SYNTAX: REV

    BASE VARIABLES SYNTAX: REVSET

|;

(defun c:rev () (c:RevisionMarker)) ; Program Shortcut

(defun Laymake ()
   (if    (not (tblsearch "layer" "REV"))
   (progn
       (command "-layer" "m" "REV" "c" "2" "REV" "")
       (princ "\nCreating Revision Layer: ")
   ) ;_end progn
   (setvar "clayer" "REV")
   ) ;_end if
) ;_end defun

(defun c:RevisionMarker    (/ *error* varLst oldVars revpt pt1 txt txtpt)

; --- Error Trap ---

   (defun *error* (msg)
   (mapcar 'setvar varLst oldVars)
   (if (= msg "")
       (princ "\nFunction Complete.")
       (princ "\nError or Esc pressed... ")
   ) ;_end if
   (princ)
   ) ;_end defun

; --- Error Trap ---

   (or (getenv "Rev:Side") (setenv "Rev:Side" "6"))
   (or (getenv "Rev:Text") (setenv "Rev:Text" "2.5"))
   (or (getenv "Rev:Amin") (setenv "Rev:Amin" "2"))
   (or (getenv "Rev:Amax") (setenv "Rev:Amax" "2"))
   (princ
   (strcat
       "\nType \"RevSet\" to set Base Variables - Current Settings: \nSide Length: "
       (getenv "Rev:Side")
       ", Text Height: "
       (getenv "Rev:Text")
       ", Arc Length Min: "
       (getenv "Rev:Amin")
       ", Arc Length Max: "
       (getenv "Rev:Amax")
   ) ;_end strcat
   ) ;_end princ
   (setq varLst(list "CMDECHO" "CLAYER" "BLIPMODE" "OSMODE")
   oldVars (mapcar 'getvar varLst)
   ) ;_end setq
   (setvar "cmdecho" 0)
   (setvar "blipmode" 0)
   (Laymake)
   (command "_revcloud"
      "A"
      (atof (getenv "Rev:Amin"))
      (atof (getenv "Rev:Amax"))
   ) ;_end command
   (while (> (getvar "CmdActive") 0) (command pause))
   (setvar "osmode" 0)
   (if
   (and (/= (setq
            pt1
         (getpoint "\nSelect Point for Rev Triangle: "
         ) ;_end getpoint
      ) ;_end setq
      nil
      ) ;_end /=
      (/= (setq
            txt (getstring
                t
                "\nSpecify Text for Rev Triangle: "
            ) ;_end getstring
      ) ;_end setq
      ""
      ) ;_end /=
   ) ;_end and
      (progn
          (setq txt (strcase txt))
          (command
          "_.pline"
          "_non"
          pt1
          "_non"
          (polar pt1
             (/ (* -1 pi) 3)
             (atof (getenv "Rev:Side"))
          ) ;_end polar
          "_non"
          (polar pt1
             (/ (* -2 pi) 3)
             (atof (getenv "Rev:Side"))
          ) ;_end polar
          "_C"
          ) ;_end command
          (setq txtpt
         (polar
               pt1
               (/ (* pi 3) 2)
               (/ (/ (atof (getenv "Rev:Side")) 2)
                  (cos (/ pi 6))
               ) ;_end /
         ) ;_end polar
          ) ;_end setq
          (entmake
          (list '(0 . "TEXT")
            '(8 . "REV")
            (cons 10 txtpt)
            (cons 40 (atof (getenv "Rev:Text")))
            (cons 1 txt)
            '(50 . 0.0)
            '(7 . "STANDARD")
            '(71 . 0)
            '(72 . 1)
            '(73 . 2)
            (cons 11 txtpt)
          ) ; end list
          ) ; end entmake
      ) ;_end progn
   ) ;_end if
   (*error* "")
   (princ)
) ;_end defun

(defun c:RevSet    (/ side text amin amax)
   (or (getenv "Rev:Side") (setenv "Rev:Side" "6"))
   (or (getenv "Rev:Text") (setenv "Rev:Text" "2.5"))
   (or (getenv "Rev:Amin") (setenv "Rev:Amin" "2"))
   (or (getenv "Rev:Amax") (setenv "Rev:Amax" "2"))
   (princ (strcat "\nCurrent Settings: \nSide Length: "
          (getenv "Rev:Side")
          ", Text Height: "
          (getenv "Rev:Text")
          ", Arc Length Min: "
          (getenv "Rev:Amin")
          ", Arc Length Max: "
          (getenv "Rev:Amax")
      ) ;_end strcat
   ) ;_end princ
   (if    (setq side (getreal (strcat "\nSpecify Side Length <"
                   (getenv "Rev:Side")
                   "> : "
               ) ;_end strcat
          ) ;_end getreal
   ) ;_end setq
   (setenv "Rev:Side" (rtos side))
   ) ;_end if
   (if    (setq text (getreal (strcat "\nSpecify Text Height <"
                   (getenv "Rev:Text")
                   "> : "
               ) ;_end strcat
          ) ;_end getreal
   ) ;_end setq
   (setenv "Rev:Text" (rtos text))
   ) ;_end if
   (if    (setq amin (getreal (strcat "\nSpecify Min Arc Length <"
                   (getenv "Rev:Amin")
                   "> : "
               ) ;_end strcat
          ) ;_end getreal
   ) ;_end setq
   (setenv "Rev:Amin" (rtos amin))
   ) ;_end if
   (if    (setq amax (getreal (strcat "\nSpecify Max Arc Length <"
                   (getenv "Rev:Amax")
                   "> : "
               ) ;_end strcat
          ) ;_end getreal
   ) ;_end setq
   (setenv "Rev:Amax" (rtos amax))
   ) ;_end if
   (princ "\nBase Variables Set. ")
   (princ)
) ;_end defun

(princ
   "\nRevision Marker by Lee Mac Loaded. Type \"REV\" to Invoke."
) ;_end princ

页: [1]
查看完整版本: 添加revcloud+另一个命令