cbjarchitect Posted October 16, 2010 Share Posted October 16, 2010 I have a hatch pattern from another ACAD version that is not in ACAD Architecture 2010. The problem is that I only have the drawing format and not the actual file. Is there a way to incorporate this pattern into my hatch library? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 19, 2010 Share Posted October 19, 2010 Paste a picture here maybe some one has it. There is some 3rd party software that writes hatch pattern code but I think you have to buy it. Quote Link to comment Share on other sites More sharing options...
Pablo Ferral Posted October 19, 2010 Share Posted October 19, 2010 The short answer is no. You will need to use some third party software to recreate it. Here is a good example: http://www.hatchkit.com.au/ There are free add-ins out there, but they aren't as good. Quote Link to comment Share on other sites More sharing options...
hugha Posted October 19, 2010 Share Posted October 19, 2010 HatchKit can recreate a .PAT file from a drawing's .DXF file containing the hatch patterns. But first try searching for GETPAT.LSP online. Either way, save the resulting .PAT file all by itself with the filename matching the pattern name (file X.PAT contains one file - X) in a directory on the AutoCAD Support File Search Path and then look for a custom pattern when hatching rather than appending the pattern to the standard pattern file. hth Hugh Adamson www.hatchkit.com.au Quote Link to comment Share on other sites More sharing options...
jcap91163 Posted October 19, 2010 Share Posted October 19, 2010 here's the code for getpat.lsp, this one is very useful to generate the code in which the hatch pattern was written. (defun C:GETPAT (/ cmde hat elst rotn hnam temp xofs yofs what temp outf flin angl tmp1 tmp2 xvec yvec) (setq cmde (getvar "cmdecho")) (setvar "cmdecho" 0) (while (not (setq hat (entsel "\nSelect hatch: ")))) (setq elst (entget (car hat))) (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 (strcat hnam ".pat")) (if (findfile outf) (progn (initget "Overwrite Append") (setq what (getkword (strcat "\n" outf " already exists; Overwrite/Append? "))) ) ) (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 hnam " pattern definition written to " hnam ".PAT")) ) (alert "Selected object not a HATCH.") ) (setvar "cmdecho" cmde) (princ) ) (defun trim (x / n) (setq n (strlen x)) (while (= (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) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.