Author Topic: document manager  (Read 12497 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • 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: 12914
  • 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: 12914
  • 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: 6150
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