TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on October 13, 2005, 01:27:55 PM

Title: dwgprops !?
Post by: Andrea on October 13, 2005, 01:27:55 PM
Hi all,

How can I get DWGPROPS in lisp ?
Title: Re: dwgprops !?
Post by: MP on October 13, 2005, 01:32:56 PM
Use the SummaryInfo object.
Title: Re: dwgprops !?
Post by: Andrea on October 13, 2005, 01:35:33 PM
Use the SummaryInfo object.

heu ?
Title: Re: dwgprops !?
Post by: MP on October 13, 2005, 01:40:43 PM
huh?

Code: [Select]
(vlax-dump-object
    (vla-get-summaryinfo
        (vla-get-activedocument
            (vlax-get-acad-object)
        )
    )
    t
)

Spewage:

Quote
; IAcadSummaryInfo: IAcadSummaryInfo Interface
; Property values:
;   Author = ""
;   Comments = ""
;   HyperlinkBase = ""
;   Keywords = ""
;   LastSavedBy = ""
;   RevisionNumber = ""
;   Subject = ""
;   Title = ""
; Methods supported:
;   AddCustomInfo (2)
;   GetCustomByIndex (3)
;   GetCustomByKey (2)
;   NumCustomInfo ()
;   RemoveCustomByIndex (1)
;   RemoveCustomByKey (1)
;   SetCustomByIndex (3)
;   SetCustomByKey (2)

Title: Re: dwgprops !?
Post by: Andrea on October 13, 2005, 02:02:44 PM
Thanks MP...
but i'm not very familer to VLAX..
I need to keep the item 2...
Title: Re: dwgprops !?
Post by: MP on October 13, 2005, 03:33:54 PM
This will retrieve all the custom info per the original order --

Code: [Select]
(defun foo ( )
    (   (lambda ( summaryinfo / i result name value )
            (repeat (setq i (vla-numcustominfo summaryinfo))
                (setq result
                    (cons
                        (progn
                            (vla-getcustombyindex
                                summaryinfo
                                (setq i (1- i))
                               'name
                               'value
                            )
                            (cons name value)
                        )
                        result
                    )
                )
            )
        )
        (vla-get-summaryinfo
            (vla-get-activedocument
                (vlax-get-acad-object)
            )
        )
    )   
)

Example:

Quote
(foo)

(   
    ("myname1" . "myvalue1")
    ("myname2" . "myvalue2")
    ("myname3" . "myvalue3")
)

Note that due to Autodesk's poor implementation of this if you place information in said object, you will not be able to read it back until the drawing is saved, closed and re-opened. Thank Autodesk.
Title: Re: dwgprops !?
Post by: Andrea on October 13, 2005, 03:53:15 PM
MP ...

you a genious !

I have to learn more about VLAX..

thanks.
Title: Re: dwgprops !?
Post by: MP on October 13, 2005, 04:05:23 PM
I wish. Thank you Andrea.
Title: Re: dwgprops !?
Post by: Andrea on October 14, 2005, 10:42:03 AM
a little more question..

I do I change a value ? or add one ?
Title: Re: dwgprops !?
Post by: Mark on October 14, 2005, 12:07:32 PM

I do I change a value ? or add one ?

Found this in my "junk" file.
Code: [Select]
;Document.SummaryInfo
(defun get-suminfo-obj ()
  (vla-get-SummaryInfo
(vla-get-ActiveDocument
  (vlax-get-acad-object)
  )
)
  )

(defun login-as-author ()
  (vlax-put-property
    (get-suminfo-obj)
    'Author
    (getvar 'loginname)
    )
  )