Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting Custom fields (or other fields) in the DwgProps

205 views
Skip to first unread message

Allen Johnson

unread,
Dec 13, 2002, 4:15:49 PM12/13/02
to
Setting Custom fields (or other fields) in the DwgProps

Custom Tab (Drawing Properties Dialog Box)
Provides ten custom fields for assigning names and values. For example, you
could create a custom field called "Project" and assign the actual project
name as the value. To ensure that all your drawings use the same custom
field names, you could create the custom fields in your drawing templates.
The custom fields can be used in searches to help locate a drawing, such as
when you use the Find dialog box in AutoCAD® DesignCenter™.

AutoCAD also provides access to the properties data using programming
interfaces, such as AutoLISP®.

So how do you set the Custom fields (or other fields) in the DwgProps dialog
though AutoLISP?


Steve Howatt

unread,
Dec 13, 2002, 5:14:38 PM12/13/02
to
Check out http://www.afralisp.com/newsletter/code/code5.htm.

Steve

"Allen Johnson" <ajoh...@dwase.com> wrote in message
news:D9F2916880C7655E...@in.WebX.maYIadrTaRb...


> Setting Custom fields (or other fields) in the DwgProps
>
> Custom Tab (Drawing Properties Dialog Box)
> Provides ten custom fields for assigning names and values. For example,
you
> could create a custom field called "Project" and assign the actual project
> name as the value. To ensure that all your drawings use the same custom
> field names, you could create the custom fields in your drawing templates.
> The custom fields can be used in searches to help locate a drawing, such
as

> when you use the Find dialog box in AutoCAD® DesignCenterT.

Jason Piercey

unread,
Dec 13, 2002, 7:03:15 PM12/13/02
to
There is this....

; From: Frank Whaley <f...@autodesk.com>
; Here is '(getProps)' and '(putProps)', which
; extract Drawing Property data to a set of global
; variables (Title, Subject, etc.) and repack the
; data from the same set of variables.

; Read the DrawingProperties...
(defun getProps ( / xlist val )

(defun val ( dxfCode )
(cdr (assoc dxfCode xlist))
)
; Retrieve Xrecord
(setq xlist (dictsearch (namedobjdict) "DWGPROPS"))

; Extract values to variables
(setq Title (val 2)
Subject (val 3)
Author (val 4)
Comments (val 6)
Keywords (val 7)
LastSavedBy (val 8)
RevisionNo (val 9)
Cust0 (val 300)
Cust1 (val 301)
Cust2 (val 302)
Cust3 (val 303)
Cust4 (val 304)
Cust5 (val 305)
Cust6 (val 306)
Cust7 (val 307)
Cust8 (val 308)
Cust9 (val 309)
)
)

;------------------------------------------------------------

; Write the DrawingProperties...
(defun putProps ( / xlist )

; Remove any existing Properties
(dictremove (namedobjdict) "DWGPROPS")

; Create data list
(setq xlist (list '(0 . "XRECORD")
'(100 . "AcDbXrecord")
'(1 . "DWGPROPS COOKIE")
(cons 2 Title)
(cons 3 Subject)
(cons 4 Author)
(cons 6 Comments)
(cons 7 Keywords)
(cons 8 LastSavedBy)
(cons 9 RevisionNo)
(cons 300 " ")
(cons 301 " ")
(cons 302 " ")
(cons 303 " ")
(cons 304 " ")
(cons 305 " ")
(cons 306 " ")
(cons 307 " ")
(cons 308 " ")
(cons 309 " ")
(cons 40 (getvar "TDINDWG"))
(cons 41 (getvar "TDCREATE"))
(cons 42 (getvar "TDUPDATE"))
)
)

; Make Xrecord and add to NOD
(dictadd (namedobjdict) "DWGPROPS" (entmakex xlist))
)


--

-Jason
Member of the Autodesk Discussion Forum Moderator Program

Dave Pitzer

unread,
Dec 15, 2002, 8:15:09 PM12/15/02
to
Under the Custom tab of the Proerties dialog, I create a field ("Project")
and assign the value "Heartbreak Hotel" to the current drawing. Save and
close then open Acad. When I go to Design Center's Find dialog --- Look for
drawings, then the Drawing tab. Search for the word Heartbreak. But what
category do I select for In the fields category?

Dave P.


"Allen Johnson" <ajoh...@dwase.com> wrote in message
news:D9F2916880C7655E...@in.WebX.maYIadrTaRb...

> Setting Custom fields (or other fields) in the DwgProps
>
> Custom Tab (Drawing Properties Dialog Box)
> Provides ten custom fields for assigning names and values. For example,
you
> could create a custom field called "Project" and assign the actual project
> name as the value. To ensure that all your drawings use the same custom
> field names, you could create the custom fields in your drawing templates.
> The custom fields can be used in searches to help locate a drawing, such
as

> when you use the Find dialog box in AutoCAD® DesignCenterT.

Allen Johnson

unread,
Dec 16, 2002, 9:35:40 AM12/16/02
to
Thanks all!


Allen Johnson

unread,
Dec 16, 2002, 9:39:08 AM12/16/02
to
Why did Frank not resave the custom fields?


"Jason Piercey" <discussio...@autodesk.com> wrote in message
news:547805DA27F834F9...@in.WebX.maYIadrTaRb...

Jason Piercey

unread,
Dec 16, 2002, 10:57:49 AM12/16/02
to
I don't know, you will have to ask Frank.

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program

> Why did Frank not resave the custom fields?
>
>

> > ; From: Frank Whaley <f...@autodesk.com>

Allen Johnson

unread,
Dec 16, 2002, 11:43:22 AM12/16/02
to
It also crashes (putProps) if you don't have all the global variables
filled.
(does he still work for AutoCAD???)


Jason Piercey

unread,
Dec 16, 2002, 11:57:28 AM12/16/02
to
To my (very limited) knowledge yes, he is still employed by Autodesk.

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program

"Allen Johnson" <ajoh...@dwase.com> wrote in message

news:D337713F2ECCA280...@in.WebX.maYIadrTaRb...

Kevin Terry

unread,
Dec 16, 2002, 12:20:37 PM12/16/02
to
http://home.pacbell.net/fewhaley/

--
Kevin


"Allen Johnson" <ajoh...@dwase.com> wrote in message
news:D337713F2ECCA280...@in.WebX.maYIadrTaRb...

Frank Whaley

unread,
Dec 16, 2002, 1:16:10 PM12/16/02
to
Allen Johnson wrote:

>Why did Frank not resave the custom fields?
>

I did. You're not seeing the correct version of 'dwgprops.lsp':

;;
;; dwgprops.lsp
;;
;; This code demonstrates extraction and insertion of Drawing
;; Properties from LISP. Two functions are provided:
;; '(dp-get)' for extracting Properties to global variables, and
;; '(dp-put)' for inserting Properties from those same global
;; variables. Items that are updated by the save reactor are
;; also shown.
;;


(defun dp-get (/ xlist val)
;; shorthand for extraction
(defun val (code)
(cdr (assoc code xlist))
)

;; pick Xrecord from NOD


(setq xlist (dictsearch (namedobjdict) "DWGPROPS"))

;; extract values to global variables
(setq dp:Title (val 2)
dp:Subject (val 3)
dp:Author (val 4)
dp:Comments (val 6)
dp:Keywords (val 7)
dp:LastSavedBy (val 8)
dp:RevisionNo (val 9)
dp:Cust0 (val 300)
dp:Cust1 (val 301)
dp:Cust2 (val 302)
dp:Cust3 (val 303)
dp:Cust4 (val 304)
dp:Cust5 (val 305)
dp:Cust6 (val 306)
dp:Cust7 (val 307)
dp:Cust8 (val 308)
dp:Cust9 (val 309)
)
xlist
)

(defun dp-put (/ xlist safeStr)
;; safe string
(defun safeStr (v)
(if (= 'STR (type v)) v "")
)

;; remove any existing Properties
(dictremove (namedobjdict) "DWGPROPS")

;; make data list


(setq xlist
(list
'(0 . "XRECORD")
'(100 . "AcDbXrecord")
'(1 . "DWGPROPS COOKIE")

(cons 2 (safeStr dp:Title))
(cons 3 (safeStr dp:Subject))
(cons 4 (safeStr dp:Author))
(cons 6 (safeStr dp:Comments))
(cons 7 (safeStr dp:Keywords))
(cons 8 (getvar "loginname"))
(cons 9 (safeStr dp:RevisionNo))
(cons 300 (safeStr dp:Cust0))
(cons 301 (safeStr dp:Cust1))
(cons 302 (safeStr dp:Cust2))
(cons 303 (safeStr dp:Cust3))
(cons 304 (safeStr dp:Cust4))
(cons 305 (safeStr dp:Cust5))
(cons 306 (safeStr dp:Cust6))
(cons 307 (safeStr dp:Cust7))
(cons 308 (safeStr dp:Cust8))
(cons 309 (safeStr dp:Cust9))


(cons 40 (getvar "TDINDWG"))
(cons 41 (getvar "TDCREATE"))
(cons 42 (getvar "TDUPDATE"))
)
)

;; make Xrecord and add to NOD


(dictadd (namedobjdict) "DWGPROPS" (entmakex xlist))
)

;; END of dwgprops.lsp

--
Frank Whaley
Autodesk, Inc.

Jason Piercey

unread,
Dec 16, 2002, 2:09:59 PM12/16/02
to
Hi Frank,

Thanks for posting the updated version.

--

-Jason
Member of the Autodesk Discussion Forum Moderator Program

Allen Johnson

unread,
Dec 16, 2002, 3:05:37 PM12/16/02
to
It doesn't appear to be able to search the custom fields.
On AcadX website there's a AcadXProps routine that you could program
(through VB) to search the custom fields;
http://code.acadx.com/downloads/002.htm

"Dave Pitzer" <dpi...@sonic.net> wrote in message
news:D8559C664B8C26CC...@in.WebX.maYIadrTaRb...

Dave Pitzer

unread,
Dec 16, 2002, 8:59:07 PM12/16/02
to
In other words, the HELP file for both Design Center and the DWGPROPS
command are both wrong.

Dave Pitzer
========


"Allen Johnson" <ajoh...@dwase.com> wrote in message

news:D9F2916880C7655E...@in.WebX.maYIadrTaRb...


> Setting Custom fields (or other fields) in the DwgProps
>
> Custom Tab (Drawing Properties Dialog Box)
> Provides ten custom fields for assigning names and values. For example,
you
> could create a custom field called "Project" and assign the actual project
> name as the value. To ensure that all your drawings use the same custom
> field names, you could create the custom fields in your drawing templates.
> The custom fields can be used in searches to help locate a drawing, such
as

> when you use the Find dialog box in AutoCAD® DesignCenterT.

0 new messages