Author Topic: vla-get-selectedDocument  (Read 8987 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
vla-get-selectedDocument
« on: January 10, 2006, 02:11:31 PM »
Hi,

This year my objective is to learn more about VL VLAX VLA and all VL options...

for now, i'm trying to make a lisp with dialog box containing a list of dwg file.
I need to....when a file is selected the dialog show me the dwgprops of the selected dwg.

for now i have this..

(vl-load-com)
(setq actdoc (vla-get-SummaryInfo (vla-get-activeDocument (vlax-get-acad-object))))
(vla-get-Title actdoc)
(vla-get-Author actdoc)
(vla-get-Subject actdoc)
(vla-get-KeyWords actdoc)
(vla-get-Comments actdoc)

seem to work..
but I need to tell something like this...
(setq actdoc (vla-get-SummaryInfo (vla-get-selectedDocument (vlax-get-acad-object))))

but don't know how...

Also, is ther any website or help file i can take a look to have a list of ALL vla- options ??
I'can't find anything in this AutoCAD and/or VLISP Help file... :|

thanks.
Keep smile...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: vla-get-selectedDocument
« Reply #1 on: January 10, 2006, 02:31:12 PM »
SummaryInfo is a property of the ActiveDocument

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: vla-get-selectedDocument
« Reply #2 on: January 10, 2006, 02:39:33 PM »
Code: [Select]
(setq DocCol (vla-get-Documents (vlax-get-Acad-Object)))
(setq Doc (vla-Item DocCol DocName))

Where DocName is the name of the open document you want to get.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: vla-get-selectedDocument
« Reply #3 on: January 10, 2006, 02:40:14 PM »
... and regarding help ..

Start here ... Developers Help

Particularly this one ; Determining the Visual LISP Function You Need ; but read the lot !



« Last Edit: January 10, 2006, 02:43:30 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vla-get-selectedDocument
« Reply #4 on: January 10, 2006, 03:17:49 PM »
Code: [Select]
(setq DocCol (vla-get-Documents (vlax-get-Acad-Object)))
(setq Doc (vla-Item DocCol DocName))

Where DocName is the name of the open document you want to get.

so if i use this..

Code: [Select]
(setq DocCol (vla-get-Documents (vlax-get-Acad-Object)))
(setq Doc (vla-Item DocCol "C:\\test\\aa1.dwg"))

must work ?

but doesn't.
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vla-get-selectedDocument
« Reply #5 on: January 10, 2006, 03:23:28 PM »
SummaryInfo is a property of the ActiveDocument



Thanks Kerry,

If this is right...
I need to know why the summary of AutoCAD is a separate tab of summary of windows..
If a DWG was edited with notepad I can see the summary note in first line....but not the summary of windows.
did some one start to see where i'm trying to go ?

In fact, i'm trying to associate the both summary.
Keep smile...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: vla-get-selectedDocument
« Reply #6 on: January 10, 2006, 03:35:52 PM »
All you want is the drawing name and suffix, not the whole path.
So for your example all you would test for is "aa1.dwg".

Code: [Select]
(setq DocCol (vla-get-Documents (vlax-get-Acad-Object)))
(setq Doc (vla-Item DocCol "C:\\test\\aa1.dwg"))

must work ?

but doesn't.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: vla-get-selectedDocument
« Reply #7 on: January 10, 2006, 03:38:13 PM »
Sorry, I dont understand the question.

Exactly what are you trying to do ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: vla-get-selectedDocument
« Reply #8 on: January 10, 2006, 04:43:43 PM »
I wrote this many moons ago, it's not complete but may help you get started.

[ http://www.theswamp.org/forum/index.php?topic=17.0 ]
TheSwamp.org  (serving the CAD community since 2003)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vla-get-selectedDocument
« Reply #9 on: January 10, 2006, 05:20:03 PM »
ok, i will try to explain.....

glup !

When you open a drawing and make DWGPROPS and field all section...
than, save this drawing.

Now if you close AutoCAD and browse in your drawing with windows explorer...rightclick on this DWG file and go to propreties...

you must see an additional TAB called "summary"
this tab was created by AutoCAD and only PC containing AutoCAD show up this new TAB.

otherwise, windows show the standard properties...
But in the stadard windows properties you allready have a TAB called "summary"
so now you get 2 TAB nammed summary.

the questions is.
1-  Why AutoCAD do not use the existing summary TAB
2-  How to get the information AutoCAD summary TAB without open AutoCAD
3-  How to get the information windows summary TAB without open AutoCAD

I want to capture the information of AutoCAD summary TAB and put it in Windows summary TAB.

I hope this was clear...
there is some screenshot.

Keep smile...

GDF

  • Water Moccasin
  • Posts: 2081
Re: vla-get-selectedDocument
« Reply #10 on: January 10, 2006, 06:18:06 PM »
Here is what I use.

Code: [Select]
(defun ARCH:SETXDATAINFO  ()
  (cond ((= (getvar "loginname") "cad_11") (setq ARCH#XDPC "Drawn by: FWP"))
        ((or (= (getvar "loginname") "CAD_5")
             (= (getvar "loginname") "Gary Davidson Fowler"))
         (setq ARCH#XDPC "Drawn by: GDF"))
        ((= ARCH#XDPC nil)
         (setq ARCH#XDPC (strcat "Drawn by: " (getvar "loginname")))))
  (setq ARCH#XDCN "Company : ARCHITETTURA, Inc.")
  (setq ARCH#XDAD "Address : Plano, Tx. 75075")
  (setq ARCH#XDTP "Phone : 972.509.0088")
  (setq ARCH#XDWW "Website : www.architettura-inc.com")
  (setq ARCH#XDPR "Created using : Arch Program© for AutoCAD®")
  (ARCH:XDATAINFORECORD)
  (princ))
;;;;;;;;;;;;;;;;;;;;;;; Drawing Properties Recording Functions ;;;;;;;;;;;;;;;;;;;;;;
(defun ARCH:PutProps  (/ xlist lognam datst crdate)
  (cond ((= (getvar "loginname") "cad_11") (setq lognam "FWP"))
        ((or (= (getvar "loginname") "CAD_5")
             (= (getvar "loginname") "Gary Davidson Fowler"))
         (setq lognam "GDF"))
        ((= lognam nil) (setq lognam (getvar "loginname"))))
  (setq DATST  (rtos (getvar "CDATE") 2 16)
        CRDATE (substr DATST 1 4))
  ;;  remove any existing Properties
  (dictremove (namedobjdict) "DWGPROPS")
  ;; make data list 
  (setq
    xlist (list '(0 . "XRECORD")
                '(100 . "AcDbXrecord")
                '(1 . "DWGPROPS COOKIE")
                (cons 2 (getvar "dwgprefix")) ;title
                (cons 3 (strcat "File Name : " (getvar "dwgname") "    [©" CRDATE "]"))
    ;subject         
                (cons 4 "ARCHITETTURA, Inc.    [www.architettura-inc.com]") ;author
                (cons 6 Comments)
                (cons 7 (ARCH:Basename (getvar "dwgname"))) ;keyword
                (cons 8 lognam) ;LastSavedBy
                (cons 9 RevisionNo)
                (cons 300 Cust0)
                (cons 301 Cust1)
                (cons 302 Cust2)
                (cons 303 Cust3)
                (cons 304 Cust4)
                (cons 305 Cust5)
                (cons 306 Cust6)
                (cons 307 Cust7)
                (cons 308 Cust8)
                (cons 309 Cust9)
                (cons 40 (getvar "TDINDWG"))
                (cons 41 (getvar "TDCREATE"))
                (cons 42 (getvar "TDUPDATE"))))
  ;;  make Xrecord and add to NOD
  (dictadd (namedobjdict) "DWGPROPS" (entmakex xlist))
  (princ))
;;; From: Frank Whaley <few@autodesk.com>
;;; http://www.autodesk.com/support/filelib/acad14/acadficn.htm
;;; 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.
(defun ARCH:GetProps  (/ xlist val)
  (ARCH:GetCustomInfo)
  ;;  shorthand for extraction
  (defun val (gc999) (cdr (assoc gc999 xlist)))
  ;;  pick Xrecord from NOD
  (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))
  xlist)
;;;;;;;;;;;;;;;;;;;;;;;;;; Record Xref to Drawing Properties ;;;;;;;;;;;;;;;;;;;;;;;;
;;; --- get properties, grab refs, update properties
(defun XREFPROP-ORIGINAL  ()
  (setq chk (ARCH:GetProps))
  (if (= chk nil)
    (setq Title ""
          Subject ""
          Author ""
          Comments ""
          Keywords ""
          LastSavedBy ""
          RevisionNo ""
          Cust0 ""
          Cust1 ""
          Cust2 ""
          Cust3 ""
          Cust4 ""
          Cust5 ""
          Cust6 ""
          Cust7 ""
          Cust8 ""
          Cust9 ""))
  (setq lst (ARCH:XREF_LIST))
  (cond ((= lst nil)
         (progn (setq str "Created using : Arch Program© for AutoCAD®")
                (setq Comments str)
                (ARCH:PutProps)
                (princ "\n*** ----- Drawing Properties Updated ----- ***")))
        ((/= lst nil)
         (progn (setq str "")
                (foreach
                       itm  lst
                  (setq str (strcat str itm))
                  (if (/= itm (last lst))
                    (setq str (strcat str (chr 13) (chr 10)))))
                (if (<= (strlen str) 4096)
                  (progn (setq Comments str)
                         (ARCH:PutProps)
                         (princ "\n*** ----- Drawing Properties Updated ----- ***"))))
         ;;(princ "\n* No Xref's Attached! *")
         ))
  (princ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;; Drawing Properties Recording Functions ;;;;;;;;;;;;;;;;;;;;;;
(defun ARCH:PutProps2004  (/ xlist lognam datst crdate dwginfo)
  ;;(ARCH:PutCustomInfo "Test 1" "#1" 1)
  ;;(ARCH:PutCustomInfo "Test 2" "#2" 2)
  (cond ((= (getvar "loginname") "cad_11") (setq lognam "FWP"))
        ((or (= (getvar "loginname") "CAD_5")
             (= (getvar "loginname") "Gary Davidson Fowler"))
         (setq lognam "GDF"))
        ((= lognam nil) (setq lognam (getvar "loginname"))))
  (setq DATST  (rtos (getvar "CDATE") 2 16)
        CRDATE (substr DATST 1 4))
  (setq dwginfo (vla-get-summaryinfo (vla-get-activedocument (vlax-get-acad-object))))
  (vlax-put-property
    dwginfo
    'Author
    "ARCHITETTURA, Inc.    [www.architettura-inc.com]")
  (vlax-put-property dwginfo 'Comments commentx)
  (vlax-put-property dwginfo 'Keywords (ARCH:Basename (getvar "dwgname")))
  (vlax-put-property
    dwginfo
    'Subject
    (strcat "File Name : " (getvar "dwgname") "    [©" CRDATE "]"))
  (vlax-put-property dwginfo 'Title (getvar "dwgprefix"))
  (princ))
;;;;;;;;;;;;;;;;;;;;;;;;;; Record Xref to Drawing Properties ;;;;;;;;;;;;;;;;;;;;;;;;
;;; --- get properties, grab refs, update properties
(defun XREFPROP-NEW  (/ 1st commentx)
  (setq lst (ARCH:XREF_LIST))
  (cond ((= lst nil)
         (progn (setq str "Created using : Arch Program© for AutoCAD®")
                (setq commentx str)
                (ARCH:PutProps2004)
                (princ "\n*** ----- Drawing Properties Updated ----- ***")))
        ((/= lst nil)
         (progn (setq str "")
                (foreach
                       itm  lst
                  (setq str (strcat str itm))
                  (if (/= itm (last lst))
                    (setq str (strcat str (chr 13) (chr 10)))))
                (if (<= (strlen str) 4096)
                  (progn (setq commentx str)
                         (ARCH:PutProps2004)
                         (princ "\n*** ----- Drawing Properties Updated ----- ***"))))))
  (princ))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vla-get-selectedDocument
« Reply #11 on: January 11, 2006, 08:30:22 AM »
Hey Gary...

this seem cool..!!
but it field only the AutoCAD summary TAB ..not the Windows summary TAB.

 :-o
Keep smile...

GDF

  • Water Moccasin
  • Posts: 2081
Re: vla-get-selectedDocument
« Reply #12 on: January 11, 2006, 09:28:57 AM »
My bad. This year I plan on reading the post with my eyes open.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: vla-get-selectedDocument
« Reply #13 on: January 11, 2006, 10:47:33 AM »
As far as I know you can't mod the document summary object (DSO) properties from AutoCAD without enlisting the help of a dll from microsoft (dsofile.dll) or a roll your own utility that speaks structure storage.

Some details can be found here.
« Last Edit: January 11, 2006, 01:12:19 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Andrea

  • Water Moccasin
  • Posts: 2372
Re: vla-get-selectedDocument
« Reply #14 on: January 11, 2006, 12:09:47 PM »
thanks...

DSOfile seem a good way....but need to explore with my VB programmer
Keep smile...