Author Topic: check for dwg props to be filled in  (Read 1862 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
check for dwg props to be filled in
« on: May 20, 2008, 09:02:09 AM »
im looking to modify this code, instead of looking for a txt file to exist
i would like to have it look at the dwg props for the keyword or comment field to be filled in.
if it is, then it moves on if not it prompts me for the info
how would i go about checking for that

Code: [Select]
    (SETQ IFILE (STRCAT (GETVAR "DWGPREFIX") "INFO.TXT"))
     (if (findfile IFILE)
     (progn
     (SETQ RE (OPEN IFILE "r"))
     (SETQ INF (READ-LINE RE))
     (CLOSE RE)
     ); progn
     (progn
     (SETQ CUST (GETSTRING T "\n\nCUSTOMER-"))
     ); progn
     ); if

GDF

  • Water Moccasin
  • Posts: 2081
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

lispman21

  • Guest
Re: check for dwg props to be filled in
« Reply #2 on: May 20, 2008, 10:20:04 AM »
Give this a try.  There is commented out code in this which controls other parts of the dwgprops that you may want to use also.

Code: [Select]
(vl-load-com)

(defun c:ADD_PROPS (/ doc db si author nc nc2 nc3 value3 value4 keywords)
(setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq db (vla-get-Database doc))
(setq si (vla-get-SummaryInfo db))
;(vla-put-author si "John")
;(vla-put-comments si "New comments")
;(vla-put-hyperlinkbase si "http://AddURL")
(setq keywords(vla-get-keywords si))
(setq Comments(vla-get-comments si))
(if (or (= Keywords "")(= Comments ""))
  (progn
    (initget "K k C c")
    (setq answer (getkword "Neither the Keyword or the Comment fields have associated text. \n Which would you like to fill in? K<keyword> or C<Comment>: "))
    (if (= answer "K")
    (progn
    (setq newkeyword (getstring T "Enter Keywords: "))
    (vla-put-keywords si newkeyword)
    );; end of progn
    (if (= answer "C")
    (progn
    (setq newcomment (getstring T "Enter Comment: "))
    (vla-put-comments si newcomment)
    );; end of progn
    );; end of if
    );; end of if
  );; end of progn
);; end of if
;(vla-AddCustomInfo si "siPutKey" "siPutValue")
;(setq nc (vla-numcustominfo si))
;(vla-SetCustomByKey si "siPutKey" "siPutValueByKey")
;(vla-GetCustomByKey si "siPutKey" 'value3)
;(if (/= "siPutValueByKey" value3)
;(princ "*** Error SetCustomByKey\n")
;)
;;;(vla-SetCustomByIndex si (1- nc) "siPutCustomByIndexKey"
;;;"siPutCustomByIndexValue")
;;;(vla-GetCustomByKey si "siPutCustomByIndexKey" 'value4)
;;;(if (/= "siPutCustomByIndexValue" value4)
;;;(princ "*** Error SetCustomByIndex\n")
;;;)
;;;(vla-RemoveCustomByIndex si (1- nc))
;;;(setq nc2 (vla-numcustominfo si))
;;;(if (/= nc2 (1- nc))
;;;(princ "*** Error RemoveCustomByIndex")
;;;)
;;;(vla-AddCustomInfo si "siPutKey" "siPutValue")
;;;; Remove property
;;;(vla-RemoveCustomByKey si "siPutKey")
;;;(setq nc3 (vla-numcustominfo si))
;;;(if (/= nc2 (1- nc))
;;;(princ "*** Error RemoveCustomByKey")
;;;)
;;;(vla-AddCustomInfo si "siPutKey" "siPutValue")
;;;(vlax-release-object si)
;;;(vlax-release-object db)
;;;(vlax-release-object doc)
(princ)
)
(princ)

andrew_nao

  • Guest
Re: check for dwg props to be filled in
« Reply #3 on: May 21, 2008, 10:35:49 AM »
Thanks for the help

I did finally get it to work
« Last Edit: May 21, 2008, 11:32:40 AM by andrew_nao »