Drwhobe 发表于 2022-7-6 10:17:50

尺寸te的自动图文集编辑

有人知道lisp例程吗?它允许我选择一个维度,然后进行编辑,并将标准注释添加到从标准注释下拉框中选择的维度,类似于MS Word中的自动图文集,或者能够循环浏览注释。
 
例如,尺寸将读取“O/A宽度”等。
 
该列表可能需要在Autocad之外的excel电子表格中进行自定义。
 
有人有什么想法吗?

Drwhobe 发表于 2022-7-6 10:23:23

再进一步考虑一下,也许可以通过将下拉列表添加到多行文字菜单来实现,该菜单在调用ddedit命令时启动。您已经可以插入字段和符号了,也许这是一种更简单的方法?

alanjt 发表于 2022-7-6 10:28:11

您可以使用下拉菜单(前缀和/或后缀)轻松构建DCL菜单。从那里,您可以选择维度并附加附加数据。
 
标注样式有一个前缀/后缀选项,但每个样式只有一个选项可供选择。

Lee Mac 发表于 2022-7-6 10:31:27

作为对旧代码的修改,我写道:
 

(defun c:DimUpdate ( / *error* _read
                      dcfilename strfilename strlst ss dctag ptr dcflag str )
;; © Lee Mac 2010


(setq dcfilename"DimUpdate.dcl"   ;; DCL Filename

       Strfilename "DimUpdate.txt"   ;; Data Filename
)


(defun *error* ( msg )
   (and dcTag (unload_dialog dcTag))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))


(defun _read ( file / ofile lst nl )

   (cond ((setq ofile (open file "r"))
      
            (while (setq nl (read-line ofile))
            (setq lst (cons nl lst)))

            (close ofile)))

   (reverse lst)
)


(cond ((not (setq Strfilename (findfile Strfilename)))

          (princ "\n** Data File not Found **"))

       ((not (setq StrLst (_read Strfilename)))

          (princ "\n** Data File Empty **"))

       ((not (setq ss (ssget "_:L" '((0 . "*DIMENSION"))))))

       ((<= (setq dcTag (load_dialog dcfilename)) 0)

          (princ "\n** Dialog Definition Not Found **"))

       ((not (new_dialog "dimupdate" dcTag))

          (princ "\n** Dialog Could not be Loaded **"))

       (t
          (start_list "lst")
          (mapcar (function add_list) StrLst)
          (end_list)

          (set_tile "dcltitle" "Dimension Notes")

          (setq ptr (set_tile "lst" "0"))
      
          (action_tile"lst" "(setq ptr $value)")

          (setq dcFlag (start_dialog) dcTag (unload_dialog dcTag) Str (nth (atoi ptr) StrLst))

          (if (= 1 dcFlag)
            (
            (lambda ( i / ent )
                (while (setq ent (ssname ss (setq i (1+ i))))
                  (entupd                     
                  (cdr
                      (assoc -1
                        (entmod
                        (subst (cons 1 (strcat "<>" str)) (assoc 1 (entget ent)) (entget ent))
                        )
                      )
                  )
                  )
                )
            )
            -1
            )

            (princ "\n*Cancel*")
          )
      )
)

(princ)
)

 

 

dimupdate : dialog { key = "dctitle";
spacer;
: list_box { label = "Notes:"; key = "lst";
            alignment = centered; fixed_height = true;
            fixed_width = true; width = 50; height = 20; }
spacer;
ok_cancel;
}

 
如果你愿意的话,我会把添加提示留给你——只要记住在修改的地方做标记/首字母。

Drwhobe 发表于 2022-7-6 10:33:57

对于那些感兴趣的人来说,听起来有点像这样:
http://www.jtbworld.com/dimnotes.htm

Lee Mac 发表于 2022-7-6 10:41:39

这是一个非常方便的LISP例程!非常感谢分享。
 
我确实有一个问题:
我已将行“\U+2104”添加到关联的文本文件中,以将中心线符号添加到尺寸标注中。在我的计算机上,使用ACAD2011/Win7 64位,对话框在列表中显示中心线符号。在另一台带有ACAD2008/XP Pro 64位的机器上,它在对话框列表中显示为一个小的垂直矩形。我选中了选项/显示/字体,AutoCAD的两个副本使用相同的字体设置。显示正确符号的问题是操作系统问题吗?XP中是否有允许对话框显示正确符号的设置?
 
谢谢-
迈克

woodman78 发表于 2022-7-6 10:45:16

谢谢CADapult,很高兴你喜欢
 
至于显示,这将是DCL如何与XP或不同版本的AutoCAD交互的固有特性,我不确定人们会如何改变这一点

Lee Mac 发表于 2022-7-6 10:47:19

woodman78 发表于 2022-7-6 10:52:17

Yes, I can do that.Thanks LeeMac.

Drwhobe 发表于 2022-7-6 10:57:08

Lee, Could this code be modified to work with standard Mtext, for example if i wanted to add text to a note either as a prefix or a suffix. Maybe as a separate lisp and dialogue, and maybe dtext aswell.
页: [1] 2
查看完整版本: 尺寸te的自动图文集编辑