Author Topic: Using a field with filename - path only  (Read 14031 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Using a field with filename - path only
« Reply #30 on: May 27, 2010, 05:58:10 PM »
OK, try the updated code  :-)

KOWBOI

  • Guest
Re: Using a field with filename - path only
« Reply #31 on: May 27, 2010, 06:17:11 PM »
That worked, thank you Lee! Can I make this run automatically each time I start a new drawing?

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Using a field with filename - path only
« Reply #32 on: May 27, 2010, 06:24:07 PM »
Excellent  :lol:

Put the code in the ACADDOC.lsp with (c:FilenameReactor) after it  :-)

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8706
  • AKA Daniel
Re: Using a field with filename - path only
« Reply #33 on: May 27, 2010, 07:28:40 PM »
FYI there is an ARX sample in the SDK that has this functionality.  it also has the hook for the field dialog.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Using a field with filename - path only
« Reply #34 on: May 27, 2010, 07:54:45 PM »
Perhaps more concise:

Code: [Select]
(setq DWG (getvar 'DWGPREFIX))

(substr DWG (1+ (vl-string-position 92 (substr DWG 1 (vl-string-position 92 DWG 0 t)) 0 t)))

Thanks Lee; very nice.
I knew there was a better way to write it, but it was time to leave and I wanted to post 'something'. :) I figured someone would post a better solution.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Using a field with filename - path only
« Reply #35 on: May 27, 2010, 07:56:04 PM »
Oh yeah, know that the reactor will only work if the person opening the file is running it.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Using a field with filename - path only
« Reply #36 on: May 27, 2010, 08:02:55 PM »
Thanks Alan - and good point indeed  8-)

LE3

  • Guest
Re: Using a field with filename - path only
« Reply #37 on: May 27, 2010, 08:45:09 PM »
ok... no idea if this miserable code is of some use and how about the vars names, but well here it goes (it can be use for at least extract the strings for the output path, and what it is available in a2006? for the field command):  :-P
Code: [Select]
;;;S:\STONE_APPS\CUSTOMERS\JIM VAUGHN HOMES\24115
;;;
;;;\JIM VAUGHN HOMES\24115
;;;
(setq filename "S:\\STONE_APPS\\CUSTOMERS\\JIM VAUGHN HOMES\\24115")
(setq list_1 (fnsplitl filename)) ;;("S:\\STONE_APPS\\CUSTOMERS\\JIM VAUGHN HOMES\\" "24115" "")
(setq _filename (car list_1) _l (cadr list_1)) ;; "S:\\STONE_APPS\\CUSTOMERS\\JIM VAUGHN HOMES\\" "24115"
(setq __sub (substr _filename 1 (- (strlen _filename) 1) )) ;;"S:\\STONE_APPS\\CUSTOMERS\\JIM VAUGHN HOMES"
(setq list_2 (fnsplitl __sub)) ;;("S:\\STONE_APPS\\CUSTOMERS\\" "JIM VAUGHN HOMES" "")
(setq item1 (car list_2) item2 (cadr list_2)) ;;"S:\\STONE_APPS\\CUSTOMERS\\" "JIM VAUGHN HOMES"
(setq backs (substr item1 (strlen item1)))
(setq path (strcat backs item2 backs _l)) ;;"\\JIM VAUGHN HOMES\\24115"

LE3

  • Guest
Re: Using a field with filename - path only
« Reply #38 on: May 27, 2010, 10:05:41 PM »
hmm... the old undocumented function fnsplitl does not play nice with long file names nor if the first front folder have empty spaces...

KOWBOI

  • Guest
Re: Using a field with filename - path only
« Reply #39 on: May 28, 2010, 09:29:49 AM »
Oh yeah, know that the reactor will only work if the person opening the file is running it.

What do you mean the person running the file? It has to be loaded on every machine right?

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Using a field with filename - path only
« Reply #40 on: May 28, 2010, 09:33:46 AM »
Oh yeah, know that the reactor will only work if the person opening the file is running it.

What do you mean the person running the file? It has to be loaded on every machine right?
Correct.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

KOWBOI

  • Guest
Re: Using a field with filename - path only
« Reply #41 on: May 28, 2010, 09:46:29 AM »
Cool, thank you all so much for the help it's greatly appreciated.

I setup the acaddoc.lsp with the code, works great! Thanks again, you guys are a huge help and a great resource of info.
« Last Edit: May 28, 2010, 10:37:34 AM by KOWBOI »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Using a field with filename - path only
« Reply #42 on: May 28, 2010, 12:03:16 PM »
You're welcome :-)

So bear in mind that if you send the file to clients - the lack of reactor means that the FIELD will not display correctly.

LE3

  • Guest
Re: Using a field with filename - path only
« Reply #43 on: May 28, 2010, 09:19:03 PM »
You're welcome :-)

So bear in mind that if you send the file to clients - the lack of reactor means that the FIELD will not display correctly.
<out of scope>
every time I read that it is always translated to beer in mind.... in all my 38 years I have speaking English....  :ugly:
<out of scope>

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Using a field with filename - path only
« Reply #44 on: May 29, 2010, 01:33:48 AM »
You're welcome :-)

So bear in mind that if you send the file to clients - the lack of reactor means that the FIELD will not display correctly.
<out of scope>
every time I read that it is always translated to beer in mind.... in all my 38 years I have speaking English....  :ugly:
<out of scope>
Makes sense to me, Luis! :-D I do the same thing and I've never spoke another language...well, except for German during 3 years in high school....