Author Topic: WHOHAS.lsp  (Read 5337 times)

0 Members and 1 Guest are viewing this topic.

MikePerry

  • Guest
WHOHAS.lsp
« Reply #15 on: May 25, 2005, 11:38:17 AM »
Quote from: jonesy
Ah, but reading the articles from Autodesk (thanks Mike) it seems like the whohas.arx file creates them for their own use, or have I read that wrong?
Hi

Nope! you have it correct...

Have a good one, Mike

CottageCGirl

  • Guest
WHOHAS.lsp
« Reply #16 on: May 26, 2005, 01:06:49 PM »
I was told, that because we don't have individual licences (we have that corporate networking licence deal-thing) that it wont work, so we wander aimlessly saying "who has xxx open???"  :(

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
WHOHAS.lsp
« Reply #17 on: May 26, 2005, 03:47:09 PM »
Perhaps this will help --

Code: [Select]
(defun MakeDWL ( / _stripext _stripfolder _filebase _datetime filename filehandle )

    (defun _stripext ( filename / i j )
        (repeat (setq i (strlen filename))
            (if (null j)
                (if (eq 46 (ascii (substr filename i)))
                    (setq j i)
                )
            )
            (setq i (1- i))
        )
        (if j
            (substr filename 1 (1- j))
            filename
        )
    )

    (defun _stripfolder ( filename / i j )
        (repeat (setq i (strlen filename))
            (if (null j)
                (if (member (ascii (substr filename i)) '(92 47))
                    (setq j i)
                )
            )
            (setq i (1- i))
        )
        (if j
            (substr filename (1+ j))
            filename
        )
    )

    (defun _filebase ( filename / i j )
        (if (eq 'subr (type vl-filename-base))
            (vl-filename-base filename)
            (_stripfolder (_stripext filename))
        )
    )

    (defun _datetime ( a b c d e f delimeter / raw )
        (strcat
            (substr (setq raw (rtos (getvar "cdate") 2 15)) a b)
            delimeter
            (substr raw c d)
            delimeter
            (substr raw e f)
        )
    )

    (cond
        (
            (and
                (eq 1 (getvar "writestat"))
                (setq filehandle
                    (open
                        (setq filename
                            (strcat
                                (getvar "dwgprefix")
                                (_filebase (getvar "dwgname"))
                                ".dwl"
                            )
                        )
                        "w"
                    )
                )
            )
            (princ (strcat (getvar "loginname") "\n") filehandle)
            (princ (strcat (getenv "computername") "\n") filehandle)
            (princ
                (strcat
                    (_datetime 1 4 5 2 7 2 "/") ;; date
                    " "
                    (_datetime 10 2 12 2 14 2 ":") ;; time
                )
                fileHandle
            )
            (close fileHandle)
        )
    )
    (princ)
)

Add a ref to your s::startup function, i.e.

Code: [Select]
(defun s::startup ( )

    ;; ...

    (MakeDwl)

    ;; ...

)

It will write out data to the dwl file like so (same as whohas.arx) --
Quote
CottageCGirl
PC90210
2005/05/26 13:27:38

While you could add reactor code to delete the dwl file on close / exit there's nothing wrong with leaving the dwl files on the server, to witt, they identify who edited the drawing last.

/HTHAL
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

CottageCGirl

  • Guest
WHOHAS.lsp
« Reply #18 on: May 26, 2005, 03:54:06 PM »
Quote from: MP
Perhaps this will help
Thanks- very busy, will check it out later....... :crazy:

AfricaAD

  • Guest
WHOHAS.lsp
« Reply #19 on: June 01, 2005, 12:27:23 AM »
We use corporate licenses, & dwl's are created. It can be found at the same location as the file opened.