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

Setting CAD standards by LISP

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
1308 Views, 4 Replies

Setting CAD standards by LISP

HI,

I would like to add a start up lisp to all machines which automatically sets the CAD standards to a certain DWS file and automatically changes the settings so that it only checks layers (not styles etc).

Any one got some advice or can point me in the correct direction.

I found this lisp in the groups, but it does allow you to set the checker to check layers only and also when run it does not turn on the checker immediatly (you havew to open and close the drawing);

;;;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)
)



thanks,
Kevin.
4 REPLIES 4
Message 2 of 5
jlspartz
in reply to: Anonymous

You can set the folder where the DWS file is contained here:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.2\ACAD-4004:409\Profiles\PRA\Dialogs\standardsAddFile

You will notice a difference in the folder after Profiles in the path, because that would be the profile you are using in AutoCAD. So, 'PRA' would be whatever profile you are using.

And then you set the DWS file that is used all the time in the registry here:

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.2\ACAD-4004:409\Profiles\PRA\Dialogs\AcStandard:CheckStandardsSettings
Message 3 of 5
dreno99
in reply to: jlspartz

I'm trying to use this with AutoCAD 2013. It seems to work, I think, except that in the statement that executes Bell's routine, 

 

(adddws "S:\DIES\~Standard Dies\dies.dws") 

 

AutoCAD is not seeing the backslashes in the networked path. so it errors, says it can't find DIES~Standard Diesdies which it thinks is the DWS file. what do I have to do to get it to recognize a network path? and the DWS file has to be networked or I won't get anyone else in this place to use it. If I browse to it, everything works fine. But I want to run a script on several hundred files to set this and save me a step when I check the standards.

 

THANKS

Message 4 of 5
Kent1Cooper
in reply to: dreno99


@dreno99 wrote:

I'm trying to use this with AutoCAD 2013. It seems to work, I think, except that in the statement that executes Bell's routine, 

 

(adddws "S:\DIES\~Standard Dies\dies.dws") 

 

AutoCAD is not seeing the backslashes in the networked path. so it errors, says it can't find DIES~Standard Diesdies which it thinks is the DWS file. what do I have to do to get it to recognize a network path? ....


See the ;;;Usage: line above the code.  You will need to use double backslashes as done there, or if you prefer, single forward slashes.  It's all because in AutoLISP-function text strings, a backslash is a marker for a special code [such as \n for a New line in a prompt], referred to as an "escape character," and to get a backslash per se, you need to double it.  See Help for the (wcmatch) function.  It's probably specifically because of that situation that it will recognize a forward slash as a filepath separator, even though it wouldn't be in certain other programming languages/formats.

Kent Cooper, AIA
Message 5 of 5
hmsilva
in reply to: dreno99

From R. Robert Bell post

 

;;;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)

 

Need to use double backslashes or a single slash, and for a networked path you can use something like this

" \\\\servername\\mypath\\my.dws" or "//servername/mypath/my.dws"

 

EDITED: too slow....

 

HTH

Henrique

 

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost