GETPAT。lsp需要dwgprefix han
在荷兰,一些聪明的人可以想出一个主意,用定制的填充图案来标准化国家标准。我从未理解过这一点,因为它只会导致。。嗯。。,大量定制(非标准)。pat文件正在使用中。。想想看吧GETPAT。lsp是获取这些缺失信息的好工具。pat文件(发送者10次中有9次忘记)。然而,如果它能够编写。pat文件位于当前目录中。我想找一个能说会道的人,他可以用一种体面的方式解决这个问题。很适合为自己分析lisp希望可以将此url链接到Autodesk论坛。那是谷歌发给我的。。
https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-change-the-pat-save-location-in-getpat-lsp/m-p/7456378#M360240
解决了! 我对我的进行了修改,将图案定义保存到网络上的自定义文件夹中,该文件夹已添加到支持路径中,以便在任何图形中使用hatch命令都可以轻松访问它们。
我还对其进行了修改,以处理预先选择的图案填充,以便将其添加到图案填充右键单击菜单中。
lisp代码最好的地方在于,它可以轻松定制以满足我们的需求。我使用的代码中不到三分之一是由我创建的。虽然我修改了下载的大部分代码,但我保留了作者的标题和链接,以感谢他们所做的工作。
我还推荐T恤方形图案RRL。lsp,但GETPAT。lsp是他们最好的。 好主意。不适用于缺少像样映射的Revit DWG。问题是,FP_对于每个出口都可能不同。另一个问题是“保存到支持路径?”两者兼而有之。
不熟悉Revit。对于AutoCAD,只要它位于支持文件搜索路径中,它就可以用于Hatch命令。如果您也希望在当前目录中添加vl文件副本,则可以轻松地添加该副本。
修改版本,将其保存在与“GETPAT.lsp”和当前绘图文件夹相同的位置。
lsp必须位于“支持文件搜索路径”和“受信任文件夹”中,它才能找到文件并具有运行该文件的权限。
;|
http://www.turvill.com/t2/free_stuff/getpat.lsp
GETPAT.LSP (c) 2001 Tee Square Graphics
Version 1.01b - 1/22/2002
This routine may be used to extract hatch pattern data
from existing drawings when the .pat file containing
the original information is not available.
After loading the file in the usual manner, type the
command GETPAT at the AutoCAD Command: prompt, select
any (non-SOLID) hatch object, and the pattern information
will be written to a .pat file having the same name as
the pattern (e.g., pattern information for the hatch
pattern WOODS will be written to WOODS.PAT.
Ver. 1.01b includes two small fixex to eliminate "Bad
Argument" LISP errors when run with certain installations
of AutoCAD 2000+.
Modified to use a prselected hatch and place in both the current
location of "GETPAT.lsp" and the current drawing folder by Tom Beauford.
Add command with macro: ^P(or C:GETPAT (load "GETPAT.lsp"));GETPAT
to CUI => Shortcut Menus => Hatch Object Menu
|;
(defun C:GETPAT (/ cmde hat elst rotn hnam temp xofs yofs what
temp outf CustPath DwgPath flin angl tmp1 tmp2 xvec yvec)
(setq cmde (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq elst (entget(ssname(ssget "+.:E:S" '((0 . "hatch")))0)) path elst)
(if (= (cdr (assoc 0 elst)) "HATCH")
(progn
(setq rotn (* 180 (/ (cdr (assoc 52 elst)) pi))
hnam (cdr (assoc 2 elst))
hscl (cdr (assoc 41 elst))
)
;; The following nine lines may optionally be omitted.
;; Their purpose is to create a temporary "clone" of the
;; selected hatch with a 0 deg. rotation angle, in case
;; the hatch object specified a rotation angle. If these
;; lines are omitted, the current rotation of the selected
;; hatch will become the "0" deg. rotation for the extracted
;; pattern definition.
(if (not (zerop rotn))
(progn
(setq temp elst)
(entmake temp)
(command "_.rotate" (entlast) "" (cdr (assoc 10 temp))(- rotn))
(setq elst (entget (entlast)))
(entdel (entlast))
)
)
;; End of optional code.
(setq xofs (cdr (assoc 43 elst))
yofs (cdr (assoc 44 elst))
elst (member (assoc 53 elst) elst)
)
(setq outf (vl-string-subst (strcat hnam ".pat") "getpat.lsp" (findfile "getpat.lsp"))
CustPath outf
DwgPath (strcat (getvar "dwgprefix") hnam ".pat")
)
(if (findfile outf)
(progn
(initget "Overwrite Append")
(setq what (getkword (strcat "\n" outf " already exists; ? ")))
)
)
(setq outf (open outf (if (= what "Append") "a" "w"))
flin (strcat "*" hnam)
)
(foreach x elst
(cond
((= (car x) 53)
(write-line flin outf)
(setq angl (cdr x)
flin (trim (angtos angl 0 7))
)
)
((= (car x) 43)
(setq flin (strcat flin ", " (trim (rtos (/ (- (cdr x) xofs) hscl) 2 7))))
)
((= (car x) 44)
(setq flin (strcat flin "," (trim (rtos (/ (- (cdr x) yofs) hscl) 2 7))))
)
((= (car x) 45)
(setq tmp1 (cdr x))
)
((= (car x) 46)
(setq tmp2 (cdr x)
xvec (/ (+ (* tmp1 (cos angl))(* tmp2 (sin angl))) hscl)
yvec (/ (- (* tmp2 (cos angl))(* tmp1 (sin angl))) hscl)
flin (strcat flin ", " (trim (rtos xvec 2 7)) "," (trim (rtos yvec 2 7)))
)
)
((= (car x) 49)
(setq flin (strcat flin ", " (trim (rtos (/ (cdr x) hscl) 2 7))))
)
((= (car x) 98)
(write-line flin outf)
)
(T nil)
)
)
(write-line "" outf)
(close outf)
(alert (strcat "Pattern definition written to " CustPath))
)
(alert "Selected object not a HATCH.")
)
(setvar "cmdecho" cmde)
(vl-file-copy CustPath DwgPath)
(princ)
)
(defun trim (x / n)
(setq n (strlen x))
(while (and (/= x "0")(= (substr x n 1) "0"))
(setq n (1- n)
x (substr x 1 n)
)
)
(if (= (substr x n 1) ".")
(setq x (substr x 1 (1- n)))
)
x
)
(princ)
干得好,汤姆!!
页:
[1]