Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp to append a standards file?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
221 Views, 3 Replies

Lisp to append a standards file?

Im wondering if there is a way through lisp and ACADDOC.lsp to append a
standards file to a drawing when opened?

Thanks for any help!!

Mark
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

(defun Get2StartUpSuite (Profile FilesList / Item Count AppList Reg SNum)
(cond
((and
(= (type Profile) 'STR)
(= (type FilesList) 'LIST)
(vl-registry-read (setq Reg
(strcat "HKEY_CURRENT_USER\\" (vlax-product-key)
"\\Profiles\\" Profile
"\\Dialogs\\Appload\\Startup"))
)
);end and
(setq SNum
(1+ (atoi (vl-registry-read Reg "NumStartup")))
)
(repeat (setq Count (1- SNum))
(setq AppList
(cons (strcase (findfile (vl-registry-read Reg (strcat (itoa Count)
"Startup")))) AppList)
)
(setq Count(1- Count))
);end repeat

(foreach Item FilesList
(cond
((and (= (type Item) 'STR)
(findfile Item)
(/= "" (vl-filename-directory Item))
(not (member (strcase (findfile Item)) AppList))
(member (strcase (vl-filename-extension Item))
'(".LSP" ".ARX" ".FAS" ".VLX" ".DVB" ".DVX"))
);end and
(vl-registry-write Reg "NumStartup" (itoa SNum))
(vl-registry-write Reg (strcat (itoa SNum) "Startup") Item)
(setq SNum (1+ SNum))
)
(T (prompt "\nUncorrect file or file was added earlier to StartUpSuite. "))
);end cond
);end foreach
)
(T (prompt "\nUncorrect data. "))
);end cond
(princ)
);end Get2StartUpSuite

you have to restart Acad after called this function
Message 3 of 4
Anonymous
in reply to: Anonymous

From this Ng

[code]
;;;Function to attach a DWS Standard File to the current Drawing
;;;Usage: (AddDWS "Z:\\_Estilos Taller_CAD\\Standards\\DwgStd.dws")

;;;By R. Robert Bell
(defun AddDWS (FileN / DictN eDict XRInt)
(if (findfile fileN)
(progn
(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)
)
)
)
(mapcar 'princ
(list "\n Standard File "
FileN
" was succesfully added to the drawing. "
)
)
)
(alert
(strcat "\n Standard File "
FileN
" not found. "
)
)
)
)






;;;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)
)
[/code]
Message 4 of 4
Anonymous
in reply to: Anonymous

HI,

Regarding the last LISP file from Robert Bell and Michael Puckett.

The Lisp works fine the standard is set - but the standard checker is not turned on until the drawing is saved and reloaded or you type 'standards' and just press OK.

This means that after the standard is set any users can create their own layers without the warnings etc until the drawing is reloaded.

Anyone know how to stop this happening and have the standard checked on from the point the standard is set.

thanks.
Archie.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost