guitarguy1685 发表于 2022-7-6 11:34:05

使用AutoLisp重新定义块

我有一些插入块的Lisp。Lisp使用完整文件路径定位图形,然后插入。但是,如果图形中已存在同名块,Lisp将使用图形中的文件,而不是路径定义的文件。
 
如果我使用标准的“插入”对话框浏览文件,然后尝试插入,如果我想重新定义它,我会收到提示。
 
如何在LISP中将此选项设置为redfine?

Lee Mac 发表于 2022-7-6 11:41:44

我有时使用vla insertblock插入块,这总是重新定义现有块。
 
PS>重新定义~对不起,我忍不住了。

The Buzzard 发表于 2022-7-6 11:49:41

 
你不会错过任何一个技巧。

gilsoto13 发表于 2022-7-6 11:58:54

 
你到底想要什么?
 
http://www.cadtutor.net/forum/showthread.php?t=40217
http://forums.augi.com/showthread.php?p=1035107
http://forums.augi.com/showthread.php?t=74579&highlight=blockredef
 
http://paracadd.com/lisp/lisp_lst.htm
;;;重新定义块并更新其属性
;;; *******************************************************************
;;; ATTREDEF。LSP

guitarguy1685 发表于 2022-7-6 12:02:27

 
“重新定义”是给新手的。认真地认为我不介意被纠正。那不是那种类型我只是拼写错了哈哈

Lee Mac 发表于 2022-7-6 12:12:24

 
哇,我的代码真的到处都是。。。

guitarguy1685 发表于 2022-7-6 12:16:12

我试过这个

(defun C:test ()
(vl-load-com)
(vla-insertblock (getpoint) "L:/DrawingUtilities/F-Part" 1 1 1 0)
)

但我发现了这个错误
错误:错误的参数类型:VLA-OBJECT(-85.2136 19.2445 0.0)

Lee Mac 发表于 2022-7-6 12:24:40

您看过Visual LISP帮助文件中的引用了吗?
 

Lee Mac 发表于 2022-7-6 12:27:35

您需要提供要插入块的块VLA对象(即模型/图纸空间、块定义)。
 
这一点需要是一个变体。
 
例如:
 

(defun InsertBlock (bNme Pt)
(vl-load-com)
;; Lee Mac~05.03.10

(vla-InsertBlock
   (if (eq acPaperSpace
         (vla-get-ActiveSpace
             (setq doc (vla-get-ActiveDocument
                         (vlax-get-acad-object)))))
   
   (if (eq :vlax-true (vla-get-MSpace doc))
       (vla-get-ModelSpace doc)
       (vla-get-PaperSpace doc))

   (vla-get-ModelSpace doc))

   (vlax-3D-point Pt) bNme 1. 1. 1. 0.))



(defun c:test (/ iPt file)

(if (and (setq iPt(getpoint "\nPick point for Block: "))
          (setq file (findfile "L:\\DrawingUtilities\\F-Part.dwg")))
   
   (InsertBlock file iPt))

(princ))

guitarguy1685 发表于 2022-7-6 12:40:15

我确实看了帮助文件,我认为我做得对。我将学习afralisp VLisp教程。看到你们使用所有的vl-东西让我嫉妒。
 
我刚做了“开始”教程,我想这让我大吃一惊。
页: [1]
查看完整版本: 使用AutoLisp重新定义块