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

sql in lisp

2 REPLIES 2
Reply
Message 1 of 3
gemt
259 Views, 2 Replies

sql in lisp

I am trying to insert text into the summaryinfo (dwgprops) using the code below. I would like the text to come from an SQL statement, is that possible? Or do I have to create a variable using the SQL as it's value and then insert the variable into the code below?

(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");;;;;;;;;;;;;;;;;;;;;;I would like "John" to come from an SQL statement or variable
(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)

Gemma
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: gemt

Gee, give us a little time! {grin}. It's not necessary to re-post your
question so soon. I answered your first post. But I forgot to include:

In addition to any replies you might receive or already received, you may
find more information or responses by posting future connectivity related
questions in the following discussion group:

Web browser: http://discussion.autodesk.com/forum.jspa?forumID=16
Newsreader: news://discussion.autodesk.com/autodesk.autocad.connectivity

--
jrf
Autodesk Discussion Group Facilitator
Please do not email questions unless you wish to hire my services
On Wed, 8 Aug 2007 04:18:24 +0000, GemT wrote:

> I am trying to insert text into the summaryinfo (dwgprops) using the code
below. I would like the text to come from an SQL statement, is that
possible? Or do I have to create a variable using the SQL as it's value and
then insert the variable into the code below?
>
> (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");;;;;;;;;;;;;;;;;;;;;;I would like "John" to
come from an SQL statement or variable
> (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)
>
> Gemma
Message 3 of 3
gemt
in reply to: gemt

Sorry, I just thought I'd cover all bases!

Gemma

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

Post to forums  

Autodesk Design & Make Report

”Boost