IAcadSummaryInfo インタフェースには、Document オブジェクトのプロパティとしてアクセスすることができるので、このインタフェースを使用してタイトル、分類、作成者、キーワードのような図面のプロパティにアクセスできます。
次の例では、現在の図面に標準のプロパティとカスタム プロパティを追加するために、IAcadSummaryInfo インタフェースを使用しています。
(vl-load-com) (defun c:ADD_PROPS (/ doc db si author nc nc2 nc3 value3 value4) (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") (vla-put-keywords si "New keywords") (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)
図面のプロパティは、次の例と同じように、IAcadSummaryInfo インタフェースを使用して読み取ることができます。
(vl-load-com) (defun c:GET_PROPS (/ doc db si author ) (if (/= "MyDrawing.dwg" (getvar "DWGNAME")) (princ "Open MyDrawing.dwg") (progn (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))) (setq db (vla-get-Database doc)) (setq si (vla-get-SummaryInfo db)) (princ "\nAuthor: \n") (if (/= "John" (setq author (vla-get-author si))) (princ "*** vla-get-author error") (princ author) ) (princ "\n") (princ "\nComments:\n ") (princ (vla-get-comments si)) (princ "\n") (princ "\nHyperlink-base: \n") (princ (vla-get-HyperlinkBase si)) (princ "\n") (princ "\nNumber of custom properties: ") (princ (setq nc (vla-numcustominfo si))) (princ "\n") (while (> nc 0) (princ "Custom property ") (princ nc) (vla-GetCustomByIndex si (- nc 1) 'key 'value) (princ ": key(") (princ key) (princ ")") (princ " value(") (princ value) (princ ")\n") (vla-GetCustomByKey si key 'value2) (if (/= value value2) (princ "\n*** Error GetCustomByKey returned unexpected result.\n") ) (setq nc (1- nc)) ) (vlax-release-object si) (vlax-release-object db) (vlax-release-object doc) ) ) (princ) )