ksperopoulos 发表于 2022-7-6 07:12:14

将注释移动到集合标高

我有一个三维图形,其中一些管道的所有对象都高于0的标高。放置尺寸标注、多重引线和其他注释时,它们被插入到不同的高程。当我们在图纸空间中为视口进行隐藏着色打印时,管道下的所有注释都被隐藏。有没有一个大家都知道的lisp例程可以将一组选定的项目移动到某个z高度来提升(或降低)它们,以便可以在我们的隐藏视口中查看它们?

Lee Mac 发表于 2022-7-6 07:15:50

首先想到的事情就是去做
 

;; Elevation Changer by Lee McDonnell (Lee Mac)
;; 05.06.2009   ~ zMov to invoke

(defun c:zMov (/ ss z)
(vl-load-com)
(if (and (setq ss (ssget))
          (setq z (getreal "\nSpecify Z Elevation: ")))
   (progn
   (setq Obj (mapcar 'vlax-ename->vla-object
               (vl-remove-if 'listp
                   (mapcar 'cadr (ssnamex ss)))))
   (foreach x Obj
       (foreach i '(1e99 -1e99)
         (vla-move x
         (vlax-3D-point '(0 0 0))
             (vlax-3D-point (list 0 0 i)))))
   (mapcar
       (function
         (lambda (x)
         (vla-move x
             (vlax-3D-point '(0 0 0))
               (vlax-3D-point (list 0 0 z))))) Obj))
   (princ "\n<< Incorrect Selection >>"))
(princ))

ksperopoulos 发表于 2022-7-6 07:18:54

谢谢李,这正是我想要的。如何使这个lisp例程允许输入英尺或英寸?

Lee Mac 发表于 2022-7-6 07:21:56

它应该取决于您的单位设置

ksperopoulos 发表于 2022-7-6 07:26:56

我的单位设置为建筑单位,精度设置为1/16”。当我输入30’或30’-0”时,它表示该命令“需要一个数值。指定Z高程。”

Lee Mac 发表于 2022-7-6 07:30:41

如果你只是键入30,那么它应该是正确的?

ksperopoulos 发表于 2022-7-6 07:32:57

这只会移动30“,而不是30”。

Lee Mac 发表于 2022-7-6 07:34:52

好的,我想你可以输入360,但我会看看我能想出什么

Lee Mac 发表于 2022-7-6 07:37:59

好的,试一试:
 
以以下格式指定高程:
 
30’或30“或30’-30”
 

;; Elevation Changer by Lee McDonnell (Lee Mac)
;; 05.06.2009   ~ zMov to invoke

(defun c:zMov (/ ss z)
(vl-load-com)
(if (and (setq ss (ssget))
          (setq z (Str->In (getstring "\nSpecify Z Elevation: "))))
   (progn
   (setq Obj (mapcar 'vlax-ename->vla-object
               (vl-remove-if 'listp
                   (mapcar 'cadr (ssnamex ss)))))
   (foreach x Obj
       (foreach i '(1e99 -1e99)
         (vla-move x
         (vlax-3D-point '(0 0 0))
             (vlax-3D-point (list 0 0 i)))))
   (mapcar
       (function
         (lambda (x)
         (vla-move x
             (vlax-3D-point '(0 0 0))
               (vlax-3D-point (list 0 0 z))))) Obj))
   (princ "\n<< Incorrect Selection >>"))
(princ))

(defun Str->In (str / pos lst)
(while
   (progn
   (cond ((setq pos (vl-string-position 39 str))
            (setq lst (cons (* 12.(distof (substr str 1 pos))) lst)
                  str (substr str (+ pos 2))))
         ((setq pos (vl-string-position 45 str))
            (setq str (substr str (+ pos 2))))
         ((setq pos (vl-string-position 34 str))
            (setq lst (cons (distof (substr str 1 pos)) lst))
            (setq str (substr str (+ pos 2))))
         (t nil))))
(apply '+ lst))

David Bethel 发表于 2022-7-6 07:42:39

李,
 
查找(getdist)而不是(getstring)的(getreal)-大卫
页: [1] 2
查看完整版本: 将注释移动到集合标高