Lee Mac 发表于 2022-7-6 12:03:39

 
不客气,
 
这不是一个很难理解的LISP,只需使用它来破译我使用的DXF组码:
 
http://autodesk.com/techpubs/autocad/acad2000/dxf/

gilsoto13 发表于 2022-7-6 12:08:42

太棒了反正我自己也解决不了。。将DXF与tablesearch和wcmatch相结合。。。这离我的可能性太远了。。。我会花一整天的时间去抓它。。。在对lisp进行300次测试之后。。。
:s

Lee Mac 发表于 2022-7-6 12:10:00

 
这一切都只是DXF的知识真的,有很多方法可以做到这一点-我只是想简明扼要眨眼:

BearDyugin 发表于 2022-7-6 12:15:26

是的,一切都很好。
但我从未使用过这个变量,当然我在帮助中找到了它的指定,但为了尝试,它没有被证明,我的AutoCAD拒绝了它的任何新值,尽管是在手动中,尽管是通过李的Lisp。使用Mleader不起作用:(

gilsoto13 发表于 2022-7-6 12:17:58

还有两件事。。。我尝试了几种方法在末尾添加一条简单的消息
 
strcat Dimscale已设置为:(dmscl)
 
而且你的lisp也会被x值为负值的块卡住。。。如何获得正x值以更新dimscale?
 
我有一个密码。。。但它不适用于dxf值。

Lee Mac 发表于 2022-7-6 12:22:30


(defun c:MrGilsoto (/ dxf ent)

(defun dxf (code ent) (cdr (assoc code (entget ent))))

(cond ((setq ent (car (entsel)))

          (setvar 'DIMSCALE

            (cond ((wcmatch (dxf 0 ent) "TEXT,MTEXT") (* 8. (dxf 40 ent)))

                  ((eq "INSERT" (dxf 0 ent)) (abs (dxf 41 ent)))

                  ((wcmatch (dxf 0 ent) "DIMENSION,*LEADER")

                     (cdr (assoc 40 (tblsearch "DIMSTYLE" (dxf 3 ent)))))

                  ((getvar "DIMSCALE"))))))

(princ (strcat "\n<<--Mr Gilsoto's Dimscale is: " (rtos (getvar 'DIMSCALE)) " -->>"))
(princ))

 
唯一的问题是,当我选择维度或引线时,会收到错误消息。。。但是我正确地更新了样式和尺寸比例。。。只是由于lisp格式的错误消息,我真的不理解。。。但是如果你(李)能纠正它。。。太好了。。。不管怎样,它现在可以工作了。
 
命令:dre
选择对象:拒绝AutoCAD变量设置:DIMSCALE nil

gilsoto13 发表于 2022-7-6 12:23:13

难以置信。。。。
 
我自己做的。。。只是通过测试。。。我尝试了“(if)”并检查了括号…然后工作了…我想我正在成为一名程序员…小心!!
 

;; Updates Dimscale variable taking the value from a Text or Mtext Object multiplied by 8
;; from a Block X positive value, and from any dimension or leader Dimscale
;; Lee MacDonnell February 2010
;; http://www.cadtutor.net/forum/showthread.php?t=44989
(defun c:dre8 (/ dxf ent)

(defun dxf (code ent) (cdr (assoc code (entget ent))))

(cond ((setq ent (car (entsel)))

          (setvar 'DIMSCALE

            (cond ((wcmatch (dxf 0 ent) "TEXT,MTEXT") (* 8. (dxf 40 ent)))

                  ((eq "INSERT" (dxf 0 ent)) (abs (dxf 41 ent)))
                  ((wcmatch (dxf 0 ent) "DIMENSION,*LEADER")
                   (command "dim""restore""" ent "exit"))
                  ((getvar "DIMSCALE"))))))
(princ (strcat "\n<<-- Dimscale has been set to: " (rtos (getvar 'DIMSCALE)) " -->>"))
(princ))

gilsoto13 发表于 2022-7-6 12:27:17

做得好

Lee Mac 发表于 2022-7-6 12:32:05

页: 1 [2]
查看完整版本: 如何从差异中获取值