Author Topic: document manager  (Read 12303 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
document manager
« on: October 11, 2010, 08:02:51 AM »
Hello there!

I ask just to prevent inventing the wheel again.
I always work with two screens and lovepaperless working, since I travel a lot with my work. SO i always have acad running on one screen and the information i need to design on the other screen, mostly pdf. So everytime i start working i need to open all the documents related to that deg I'm working on. I thought about storing the paths of the document in the deg and open them with a lisp.

I assume others have the same demand for a thing like that and therefore the code might be written already.

Thanks in advance

Bernd

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #1 on: October 11, 2010, 08:08:16 AM »
A nice idea - if one did not exist, I'd be willing to spend some time putting one together perhaps  :-)

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: document manager
« Reply #2 on: October 11, 2010, 08:24:09 AM »
A nice idea, I am facing the same problem.

huiz

  • Swamp Rat
  • Posts: 913
  • Certified Prof C3D
Re: document manager
« Reply #3 on: October 11, 2010, 09:04:33 AM »
You can add hyperlinks to objects. Just put some objects (ie texts describing the needed documents) somewhere outside the drawing, add a hyperlink to those objects and CTRL+click - voila!
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: document manager
« Reply #4 on: October 11, 2010, 09:13:54 AM »
You can add hyperlinks to objects. Just put some objects (ie texts describing the needed documents) somewhere outside the drawing, add a hyperlink to those objects and CTRL+click - voila!

second that.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Amsterdammed

  • Guest
Re: document manager
« Reply #5 on: October 11, 2010, 10:00:48 AM »
I though more about to open the files the first time with getfiled and store the location in non graphic data and then have a command to reopen them the next time, so no big thing at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: document manager
« Reply #6 on: October 11, 2010, 10:16:02 AM »
Okay, quick questions:
Would this progy automatically open the files (all, some, or last)? ...what happens if the file doesnt exist? What happens if the files are not needed any longer (5 yrs down the road)--a persistent reactor (if you decide to go that route) would be a real pain.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Amsterdammed

  • Guest
Re: document manager
« Reply #7 on: October 11, 2010, 10:25:25 AM »
no reactor. Dictionary and you open it on command., so no reactor needed You can show them in a list first and you select what you want to open, and of course you look if the are still there

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Re: document manager
« Reply #8 on: October 11, 2010, 10:59:27 AM »
like a simple list box? ...cool.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

deegeecees

  • Guest
Re: document manager
« Reply #9 on: October 11, 2010, 11:09:28 AM »
Like a command to store open files, then write those paths to xdata. Then a command to pull that info into a listbox for retrieval. Sounds like a good idea.

Amsterdammed

  • Guest
Re: document manager
« Reply #10 on: October 11, 2010, 11:14:13 AM »
a command to open the files in the first place wit getfiled, so you already have the path. then sore it  and get it back with a listbox to select

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #11 on: October 11, 2010, 01:18:25 PM »
Quickly scribbled together:

Code: [Select]
(defun c:docset ( / file lst )
  (vl-load-com)
  ;; © Lee Mac 2010

  (if
    (while (setq file (getfiled "Select File to Add to Drawing" (cond ( file (vl-filename-directory file) ) ( "" )) "" 16))
      (setq lst (cons file lst))
    )
    (vlax-ldata-put "DocManagerDocs" "docs" (acad_strlsort lst))
  )

  (princ)
)

(defun c:docget ( / _OpenFiles data )
  (vl-load-com)
  ;; © Lee Mac 2010

  (defun _OpenFiles ( files / Shell )
    (setq Shell (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))

    (mapcar
      (function
        (lambda ( file )
          (if
            (vl-catch-all-error-p
              (vl-catch-all-apply
                (function vlax-invoke) (list Shell 'Open file)
              )
            )
            (princ (strcat "** Error Opening: " file " **"))
          )
        )
      )
      files
    )

    (vlax-release-object Shell)
  )

  (if (setq data (vlax-ldata-get "DocManagerDocs" "docs"))
    (_OpenFiles
      (vlax-ldata-put "DocManagerDocs" "docs"
        (vl-remove-if-not 'findfile data)
      )
    )   
  )

  (princ)
)

DocSet, stores filename data in drawing dictionary, continuous file selection prompts until user hits cancel.

DocGet, opens stored files.

I'm sure it could be improved upon,

Lee

stevesfr

  • Newt
  • Posts: 54
Re: document manager
« Reply #12 on: October 11, 2010, 01:52:39 PM »
Lee, it boms here thus:

Command: appload
docset.lsp successfully loaded.


Command: ; error: bad argument type: numberp: nil

Steve
Can't remember what I'm supposed to forget.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #13 on: October 11, 2010, 02:10:18 PM »
I can't seem to reproduce that Steve, furthermore, the code doesn't use any functions which are supplied predominantly with numbers, so I'm a little perplexed at that  :-(

Amsterdammed

  • Guest
Re: document manager
« Reply #14 on: October 11, 2010, 02:25:42 PM »
It works with no problem here....
thanks!!

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #15 on: October 11, 2010, 02:33:15 PM »
You're welcome Bernd, it was just a sketch code of the ideas expressed in the thread, I'm sure it could be greatly improved upon  :-)

stevesfr

  • Newt
  • Posts: 54
Re: document manager
« Reply #16 on: October 11, 2010, 03:26:50 PM »
Lee, my fault somewhere...
copied it again and loaded it into vanilla drawing and presto !!!!!!!!!
sorry, should have investigated further before pulling the panic chain...
Steve
Can't remember what I'm supposed to forget.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #17 on: October 11, 2010, 03:34:57 PM »
No worries Steve  8-)

Amsterdammed

  • Guest
Re: document manager
« Reply #18 on: October 12, 2010, 05:08:28 AM »
Now the next thing would be (but here you need a reactor for and i don't like them) to close the docs once you close the dwg......

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: document manager
« Reply #19 on: October 12, 2010, 11:22:55 AM »
Quote
Now the next thing would be (but here you need a reactor for and i don't like them) to close the docs once you close the dwg......

OpenDCL - Modeless Dialog - OnDocActivated (fires when closing or switching documents)
                                        EnteringNoDocState (just what it says)

Dialog could be used as a GUI or made invisible to just utilize the Events.

just a thought.

jb
James Buzbee
Windows 8

Amsterdammed

  • Guest
Re: document manager
« Reply #20 on: October 12, 2010, 12:27:36 PM »
not just a thought, burt a good one :-)

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: document manager
« Reply #21 on: October 13, 2010, 01:35:28 PM »
OK, so I got sucked into a challenge and now I can't back out!

I haven't done dictionary stuff in a while: I'm attempting to store a list of drawing names but can't seem to figure it out.  (cons 3 dwgList) returns (3 "dwg1" "dwg2") and errors while entmaking. 

Lee, I saw you used ldata: I stay as far away from that as possible.  I don't know if they fixed that but I had a slew of drawings corrupted back in 2004 thanks to Ldata (so did a lot of other people).

So whats the best way to store associated drawings?

Oh, a little teaser:



James Buzbee
Windows 8

T.Willey

  • Needs a day job
  • Posts: 5251
Re: document manager
« Reply #22 on: October 13, 2010, 01:41:26 PM »
You could store them as Xrecords within a custom dictionary within the drawings.
Tim

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

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #23 on: October 13, 2010, 01:43:28 PM »
Lee, I saw you used ldata: I stay as far away from that as possible.  I don't know if they fixed that but I had a slew of drawings corrupted back in 2004 thanks to Ldata (so did a lot of other people).

Oh right - that's news to me, thanks James. I see quite a few other guys here use LData, so I thought it might be the way to go  :-)

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: document manager
« Reply #24 on: October 13, 2010, 01:51:24 PM »
Tim, that's what I'm trying to do.  I get caught up with:

(cons 3 dwgList) returns (3 "dwg1" "dwg2") and errors while entmaking. 

Lee, maybe they fixed it - but once burned . . ..

Thanks for any help!
James Buzbee
Windows 8

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: document manager
« Reply #25 on: October 13, 2010, 01:54:44 PM »
I find data dictionaries and XRecords easier to manage through (vla-...), if that helps.  The "collection" nature of the dictionary makes it a little easier to follow than with individual DXF dotted pairs.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

T.Willey

  • Needs a day job
  • Posts: 5251
Re: document manager
« Reply #26 on: October 13, 2010, 01:57:39 PM »
Tim, that's what I'm trying to do.  I get caught up with:

(cons 3 dwgList) returns (3 "dwg1" "dwg2") and errors while entmaking. 

Lee, maybe they fixed it - but once burned . . ..

Thanks for any help!

Maybe this by MP will help.

[ http://www.theswamp.org/index.php?topic=5003.0 ]
Tim

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

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #27 on: October 13, 2010, 02:18:17 PM »
Great thread - thanks Tim for the link (and many thanks to MP for the explanations).

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: document manager
« Reply #28 on: October 13, 2010, 03:12:54 PM »
Ok, I guess I'll punt:

(cons 3 dwglist)

returns

(3 . "Drawing1.dwg;Drawing2.dwg;Drawing3.dwg")<-- note this is one string, the files seperated by a smi-colon.  I'll parse the string that way.

See what I'm getting at?

if dwglist were a list of strings: (setq  dwgList(list "Drawing1.dwg" "Drawing2.dwg" "Drawing3.dwg"))

I am unable to create the proper assosiation with (cons 3 dwgList):

That returns (3 "Drawing1.dwg" "Drawing2.dwg" "Drawing3.dwg")

??
James Buzbee
Windows 8

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: document manager
« Reply #29 on: October 13, 2010, 03:25:43 PM »
What about a list?
eg.
Code: [Select]
(cons 3 (list dwglist))
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #30 on: October 13, 2010, 03:26:11 PM »
I'm pretty inexperienced at using XRecords, but here are the options I would consider, assuming the filenames are in a list:

Code: [Select]
(cons <integer> (vl-prin1-to-string filenamelist))

Then, to read it back:

Code: [Select]
(read (cdr (assoc <integer> <XRecordData>)))
Or, using data delimiters (as you mention, semi-colons perhaps)

Code: [Select]
(cons <integer> "filename;filename;filename")
But, in my inexperience with XRecords, I myself have a few questions - what <integer> should be used? 0-9 or any other integer accepting a string argument? (referring to DXF Types here).

Also, could using multiple entries be an option? (is this allowed?)

Lee


jbuzbee

  • Swamp Rat
  • Posts: 851
Re: document manager
« Reply #31 on: October 13, 2010, 03:37:40 PM »
Thanks Alan / Lee,

I solved it with a pass through a string parser: lots more to do, can't get hung up on one thing!  :lol:
James Buzbee
Windows 8

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: document manager
« Reply #32 on: October 13, 2010, 03:38:51 PM »
Thanks Alan,

I solved with a pass through a string parser: lots more to do, can't get hung up on one thing!  :lol:
Right on; just an attempt to avoid having to parse to and from a string.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #33 on: October 13, 2010, 03:51:20 PM »
What about a list?
eg.
Code: [Select]
(cons 3 (list dwglist))

Can DXF 3 accept a list though? Can any DXF integer accept a list other than that of a 2/3D point?

I thought 0-9 could only take strings.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: document manager
« Reply #34 on: October 13, 2010, 03:53:50 PM »
What about a list?
eg.
Code: [Select]
(cons 3 (list dwglist))

Can DXF 3 accept a list though? Can any DXF integer accept a list other than that of a 2/3D point?

I thought 0-9 could only take strings.
Crap, good point.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: document manager
« Reply #35 on: October 13, 2010, 03:54:35 PM »
Theres a couple of ways I would try it.  The first would be to use multiple XRecords with keys of "Doc1", "Doc2", through "Doc(n)" to allow later iteration, each with a single ( 3 . "DocPathHere") element.  The other would be to have a single "MyLinkedDocs" XRecord with multiple ( 3 . "DocPathHere1" ) ( 3 . "DocPathHere2" ) ( 3 . "DocPathHereN" ) elements, each pointing to a single file.  You could then pull all "3" prefixed items from the assoc list for later processing.  If needed they could be surrounded by a DXF 102 group to localize them.

The choice of DXF code depends on whats being stored; 3 is good for a path name, but if multiple text items were being stored I would consider using unique codes from the 300-309 sequence.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: document manager
« Reply #36 on: October 13, 2010, 03:59:09 PM »
Also, could using multiple entries be an option? (is this allowed?)

The other would be to have a single "MyLinkedDocs" XRecord with multiple ( 3 . "DocPathHere1" ) ( 3 . "DocPathHere2" ) ( 3 . "DocPathHereN" ) elements, each pointing to a single file.  You could then pull all "3" prefixed items from the assoc list for later processing.  If needed they could be surrounded by a DXF 102 group to localize them.

Question answered, thanks mate :-)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: document manager
« Reply #37 on: October 13, 2010, 04:07:45 PM »
No problem.  Because the data inside the XRecords doesn't have a keyed index I tend to get lots of XRecords each with a little bit of data.  Unique DXF codes can make it easier but since there are only so many to choose from its easy to "run out".  That means the software must interpret the order of data and anything that modifies the list must take the order into account.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

T.Willey

  • Needs a day job
  • Posts: 5251
Re: document manager
« Reply #38 on: October 13, 2010, 05:43:25 PM »
James,

  See if you can use these in conjuncture with what MP did in the other post.  It seems to work for me.

Code: [Select]
(defun UpdateDrawingList ( dwgList / Dict )
   
    (setq Dict (GetOrAddDict (namedobjdict) "AssociatedDrawings"))
    (foreach dwg dwgList
        (AddOrReplaceXrec Dict (vl-filename-base dwg) (list (cons 1 dwg)))
    )
)
;---------------------------------------------------------
(defun GetDrawingList ( / Data DwgList )
   
    (setq Data (entget (GetOrAddDict (namedobjdict) "AssociatedDrawings")))
    (while (setq Data (member (assoc 3 Data) Data))
        (setq DwgList (cons (cdr (assoc 1 (entget (cdadr Data)))) DwgList))
        (setq Data (cdr Data))
    )
    DwgList
)
;---------------------------------------------------------
(defun RemoveDrawing ( path / Dict Data Name )
   
    (setq Dict (GetOrAddDict (namedobjdict) "AssociatedDrawings"))
    (if
        (and
            (setq Data (dictsearch Dict (setq Name (vl-filename-base path))))
            (= (strcase (cdr (assoc 1 Data))) (strcase path))
        )
        (dictremove Dict Name)
    )
)
Tim

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

Please think about donating if this post helped you.

Jeff H

  • Needs a day job
  • Posts: 6144
Re: document manager
« Reply #39 on: October 14, 2010, 03:25:03 PM »
I have a App that is .NET that is similar, I could strip it down because you would select the project then it grouped it by drawing type(1-lines, details, ets) and listed the file name and drawing name in title block. And would let you choose how many recent projects to show. They have a extra computer on the network that does not get used much so I added a app that runs that with a filesystemwatcher to keep up if drawings are deleted or moved.

Come to think of it it would be easy to create a winform where you select the project  and it would all drawings and pdf's for you.

If you need it let me know.

Sorry it gets lonley over at the NET forum and watching all of you constantly posting cool applications.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: document manager
« Reply #40 on: October 14, 2010, 04:40:28 PM »
Quote
Sorry it gets lonley over at the NET forum and watching all of you constantly posting cool applications.

Darkside isn't all that they promised, eh?  Since you asked nice you come back . . .  :wink:
James Buzbee
Windows 8