Here is a function to permit you to attach a DWS:
;;;Michael Puckett
(defun cdrs (key lst / pair rtn)
(while (setq pair (assoc key lst))
(setq rtn (cons (cdr pair) rtn)
lst (cdr (member pair lst))))
(reverse rtn))
;;;R. Robert Bell
(defun AddDWS (FileN / DictN eDict XRInt)
(setq DictN "AcStStandard"
eDict (cond ((cdr (assoc -1 (dictsearch (namedobjdict) DictN))))
((dictadd (namedobjdict)
DictN
(entmakex '((0 . "DICTIONARY") (100 .
"AcDbDictionary")))))))
(if (setq XRInt (cdrs 3 (entget eDict)))
(setq XRInt (1+ (apply 'max (mapcar 'atoi XRInt))))
(setq XRInt 0))
(dictadd eDict
(itoa XRInt)
(entmakex
(list '(0 . "XRECORD") '(100 . "AcDbXrecord") (cons 1 FileN)))))
Usage: (AddDWS "c:\\program files\\AutoCAD 2004\\Sample\\MKMStd.dws")
--
R. Robert Bell, MCSE
www.AcadX.com
"pkirill"
wrote in message
news:F796FEEB7B7C3BA650921AB6E6A50A95@in.WebX.maYIadrTaRb...
| I get "error: Automation Error. File access error"
|
| I tried running an 'insert' style routine earlier and couldn't get it to
| recognize a dws file.
|
| Here's what I'm trying to do exactly:
|
| When we send drawings to clients, we use a custom batch processor to bind
| them and place them in a "to send" directory. One particular client is
| 'asking' that we convert our layer colors to match their pen tables. I
need
| to attach a DWS file to these bound drawings in order to batch convert
layer
| colors to meet their plotting standards. I was hoping to do it in a two
| step batch conversion (one to attach and one to convert). But attaching
the
| DWS is a problem.
|
| In the 2004 forum, Robert Bell had mentioned that the DWS was a
dictionary.
| But I have no idea how to attached or create that dictionary...
|
|
|
|
|
|
| "James Buzbee" wrote in message
| news:216680CF08CD567214143E2308C07782@in.WebX.maYIadrTaRb...
| > "pkirill" wrote:
| > > Could someone give me an idea on how to attach a dws file to a drawing
| via
| > > LISP - since Adesk didn't include a command line option...
| >
| > It seems you can with the code below, however, the "xref" isn't visible.
| It
| > shows up in the Xref dialog box, but it doesn't show up in the Insert
| Dialog
| > or in the graphics area. Very strange . . ..
| >
| > jb
| >
| > (defun c:jbAttachDWSFile( / file space PathName Name InsertionPoint
XScale
| > YScale ZScale Rotation bOverlay)
| > (if (setq file(getfiled "\nSelect a Standards file to attach: "
(getvar
| > "dwgprefix") "dws;dwg" 0))
| > (progn
| > (setq pathname file
| > name(vl-filename-base file)
| > InsertionPoint(getpoint "\nSelect Insertion Point: ")
| > Rotation(getAngle InsertionPoint "\nRotation: ")
| > XScale(getdist "\nX scale: "))
| > (if(not(setq Yscale(getdist (strcat "\nY scale: or " (rtos
| XScale)))))
| > (setq Yscale Xscale))
| >
| > (if(not(setq Zscale(getdist (strcat "\nZ scale: or " (rtos
| XScale)))))
| > (setq Zscale Xscale))
| >
| > (initget "Yes No")
| > (setq bOverlay(getkword "\nOverlay? - Yes or No ")
| >
| > space(vla-get-modelspace(vla-get-activedocument(vlax-get-acad-object))))
| >
| > (if (= bOverlay "Yes")(setq bOverlay :vlax-true)(setq bOverlay
| > :vlax-false))
| >
| > (if (and space PathName Name InsertionPoint XScale YScale ZScale
| > Rotation bOverlay)
| > (vla-attachexternalreference space PathName Name
| > (vlax-3d-point InsertionPoint) XScale YScale ZScale Rotation
| > bOverlay)))
| >
| > (princ "\nSee ya!"))
| > (princ))
| >
| >
|
|