See the top rated post in this thread. Click here

Page 5 of 6 FirstFirst 123456 LastLast
Results 41 to 50 of 55

Thread: DWG tracking LISP

  1. #41
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Quote Originally Posted by kennet.sjoberg
    Try function, not "command function" remove "c:" (defun track ()
    No that is not enough, you have to read the manual to and take care of arguments.
    PHP Code:
    Construct the reactorlook in the help file please
    (vlr-dwg-reactor  data    callbacks                             )
                            ( 
    event-name        callback_function ) ; the callback_function takes two arguments
    (vlr-dwg-reactor  nil     :vlr-saveComplete track00           )
    (
    vlr-dwg-reactor  nil '(( :vlr-saveComplete . track00 )) ) ; <- Ok here it is now

    ; Construct the callback_function
    (defun track00 ( ObjArg ListArg / LocalVar1 LocalVar2 AndSoOnVar )
      (princ "\n************************************\n" )
      (princ "\n" )(princ ObjArg )(princ "\n" )
      (alert "Now is ObjArg shown" )
      (alert "Now comes the ListArg" )
      (princ "\n************************************" )
      (foreach in ListArg (princ "\n" )(princ in ) )
      (princ "\n************************************\n" )
      (alert "Hey time to write your info now and here !" )
      (princ)

    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2006-07-07 at 12:41 PM.

  2. #42
    100 Club mfowler's Avatar
    Join Date
    2002-05
    Location
    Paradise
    Posts
    120
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Quote Originally Posted by kennet.sjoberg
    Try function, not "command function" remove "c:" (defun track ()
    that doesn't work either. I can see what I think is "invalid argument... function cancelled" or something like that. It scrolls by too fast to read as the drawing closes. Maybe I should just stick to the command line save option.

  3. #43
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Quote Originally Posted by mfowler
    that doesn't work either. I can see what I think is "invalid argument... function cancelled". . .
    The answer is here : LINK please test it.

    : ) Happy Computing !

    kennet
    Last edited by kennet.sjoberg; 2010-03-17 at 09:13 PM. Reason: adding page to URL

  4. #44
    Active Member
    Join Date
    2005-11
    Posts
    61
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Wow I have been looking for something like this.
    But with a twist.
    I need it to track editing time. Can that be added?
    I'm not a programmer

  5. #45
    Active Member
    Join Date
    2005-11
    Posts
    61
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Quote Originally Posted by jwanstaett
    I use a VBA program to log all drawing close. It save the data in a access database file
    it use the userr5 system Variable to save the TdinDwg system Variable so the time in the drawing is saved
    this zip file has the database fie in it save it and change jwacmdopen to it location
    the code go in thisdrawing of a VBA project that is always loaded
    system Variable users5 is save as remarks in the database
    and DwgSave is check in the database of the drawing was save be for closing

    Code:
     
    Private Sub AcadDocument_BeginClose()
    Dim jwaLogin As String
    jwaLogin = ThisDrawing.GetVariable("loginname")
    Dim jwaCMDOpen As String
    jwaCMDOpen = "e:Databasefilesworklog.mdb" 'change to Loaction of database
    Dim jwaTdinDwg As Double
    jwaTdinDwg = ThisDrawing.GetVariable("tdindwg")
    Dim jwaUser5 As Double
    jwaUser5 = ThisDrawing.GetVariable("userr5")
    Dim jwaHours As Double
    jwaHours = (jwaTdinDwg - jwaUser5) * 24'use userr5 to save time
    Dim jwaSave As Boolean
    Dim jwaRs As DAO.Recordset
    Dim jwaDB As DAO.Database
    Dim jwaWs As DAO.Workspace
    
    jwaSave = ThisDrawing.Application.ActiveDocument.Saved
    'If jwaLogin = "Cad04" Then
     'MsgBox "Closeing Document"
    'End If
     On Error GoTo jwaError
    If Left(ThisDrawing.GetVariable("DWGNAME"), 7) <> "Drawing" Then
     Set jwaWs = DAO.DBEngine.Workspaces(0)
     Set jwaDB = jwaWs.OpenDatabase(jwaCMDOpen)
     Set jwaRS1 = jwaDB.OpenRecordset("Worklog")
     With jwaRS1
     .AddNew
     !Drawing = ThisDrawing.GetVariable("dwgname")
     !TdinDwg = jwaTdinDwg
     !hours = jwaHours
     !TdUsrTimer = ThisDrawing.GetVariable("TDUSRTIMER")
     !DwgSaved = jwaSave
     !User = jwaLogin
     !remarks = ThisDrawing.GetVariable("users5")
     .Update
     .Bookmark = .LastModified
      End With
      End If
    if jwaSave Then
    ThisDrawing.SetVariable "userr5", jwaTdinDwg
    End If
    Exit Sub
    jwaError:
     MsgBox "Log Error " & Err.Description
    End Sub
    huh? How can I make this work?

  6. #46
    I could stop if I wanted to
    Join Date
    2002-02
    Location
    Kansas
    Posts
    487
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Did you down load the zip file with the database, save the database and set jwaCMDOpen to the location of the database. you will need to references Microsoft DA0 Object Library for the code to work. Did you put the code in ThisDrawing of a loaded project. The best place is in Acad.dvd and on the AutoCAD sports path this way it will always load.

    Note AutoCAD check the sports path for Acad.dvd and load it. If there more then one AutoCAD only load the first one it find.


    Quote Originally Posted by rcroke
    huh? How can I make this work?

  7. #47
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    481
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    i keep getting an error,

    Command:
    TRACK Wednesday, November 21, 2007 14:35:43
    kgrant
    C:\Documents and Settings\kgrant\My Documents\
    Drawing2.dwg
    ; error: bad argument type: streamp nil



    Dont know what i am doing wrong here. Anyone

  8. #48
    Member
    Join Date
    2006-09
    Posts
    30
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Cool thread. Even though this is LISP thread I thought I might share my experiences with VBA in creating a time tracker.

    I created VB(A) routines for AutoCAD, Word, Excel, Outlook, Access, and photoshop scripts that report back to a MS Access database. I haven't worked much in revit but I will tackle that when I work with it more.

    At the end of the week I just create a report (from a premade template) that shows exactly what I did within the given time frame. It has graphs, pie charts, and totals showing time spent on different projects within the given time frame. The program figures out the project number from where the files reside on the network. For emails for example, I always put our project number first thing in the subject line so it gets parsed correctly, and the database stores the body of the text in a text field. It do all the calculations, sorting, graphing, etc within the MS Access client, and all the VBA or scripting routines do is report the data to the database. I've been using it for over 1 year now flawlessly, the database file has over 70,000 records and is only 20MB.

    Here is the AutoCAD part of the VBA code:


    Code:
    '~~~~This Drawing module~~~~
    Private Sub AcadDocument_Activate()
    Call makeRecord("Activated")
    End Sub
    Private Sub AcadDocument_BeginClose()
    Call makeRecord("Close")
    End Sub
    Private Sub AcadDocument_BeginDocClose(Cancel As Boolean)
    Call makeRecord("DocClose")
    End Sub
    Private Sub AcadDocument_Deactivate()
    Call makeRecord("Deactivated")
    End Sub
    Private Sub AcadDocument_EndPlot(ByVal DrawingName As String)
    Call makeRecord("Plot")
    End Sub
    Private Sub AcadDocument_EndSave(ByVal FileName As String)
    Call makeRecord("Save")
    End Sub
    Private Sub AcadDocument_LayoutSwitched(ByVal LayoutName As String)
    Call makeRecord("Changed Layout to " & LayoutName)
    End Sub
    Code:
    '~~~~module code~~~~
    'requires DAO reference
    Private Const LocOfDB As String = "\My Documents\Time Tracker\TimeTracking.mdb"
    
    Public Sub makeRecord(evType As String)
    On Error Resume Next
    Dim uName As String, dbPath As String
    Dim dbThisDB As DAO.Database
    Dim rcdCID As DAO.Recordset
    uName = Environ("USERNAME")
    dbPath = Environ("USERPROFILE") + LocOfDB
    Set dbThisDB = OpenDatabase(dbPath)
    Set rcdCID = dbThisDB.OpenRecordset("tblAcadLog")
    rcdCID.AddNew
    rcdCID![DateOfEntry] = Now()
    rcdCID![TypeOfApp] = "AutoCAD"
    rcdCID![EventType] = evType
    rcdCID![FileName] = Application.ActiveDocument.Name
    rcdCID![FileDirectory] = Application.ActiveDocument.Path
    rcdCID![ProjectNumber] = findPN(Application.ActiveDocument.Path)
    rcdCID![UserName] = uName
    'rcdCID![FileLastSave] = Application.ActiveDocument.GetVariable("TDUPDATE")
    rcdCID![FileLastSave] = Format(Application.ActiveDocument.GetVariable("TDUPDATE"), Date) & " " & _
    Format(Application.ActiveDocument.GetVariable("TDUPDATE"), "hh:mm:ss AMPM")
    rcdCID![FileElapsedTime] = Application.ActiveDocument.GetVariable("TDINDWG")
    rcdCID![SessionElapsedTime] = Application.ActiveDocument.GetVariable("TDUSRTIMER")
    rcdCID.Update
    rcdCID.Close
    Set rcdCID = Nothing
    Set dbThisDB = Nothing
    End Sub
    
    Function findPN(inputStr)
    If InStr(1, inputStr, "Projects\") > 0 Then
        fixstr = Replace(Trim(Mid(inputStr, InStr(1, inputStr, "rojects\") + 13)), "  ", " ")
        fixstr = Trim(Left(fixstr, InStr(1, fixstr, "\")))
        If InStr(1, fixstr, " ") > 0 Then
            fixstr = Trim(Left(fixstr, InStr(1, fixstr, " ")))
        End If
        findPN = Trim(Replace(fixstr, "\", ""))
    Else
        findPN = "Unknown"
    End If
    End Function
    Last edited by Opie; 2007-11-22 at 03:31 AM. Reason: [code] tags added.

  9. #49
    Certified AUGI Addict cadtag's Avatar
    Join Date
    2000-12
    Location
    Cairo - no, not Illinois
    Posts
    5,069
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    Just a suggestion, but you might want to add a column for the handle of the last entity created in the drawing.

    (CDR(ASSOC 5(ENTGET(ENTLAST)))) will return the handle of the last entity created in the drawing as a string, which can be added to the information you write out to your logfile. since handles are sequential and never reused, they can act as a pointer to help track down problems with a drawing and map them back to the user who was working in the drwing when the problem was created.

    Not foolproof, but can be very helpful...If the problem objects have a handle between Joe's save, and Marvin's save, then it's a good bet that Marvin did it. (whatever _it_ is)

  10. #50
    All AUGI, all the time bbapties's Avatar
    Join Date
    2003-12
    Location
    Palm Harbor, FL
    Posts
    537
    Login to Give a bone
    0

    Default Re: DWG tracking LISP

    I am very interested in this thread...I am too looking for the same type of routine.

    I see alot of stuff that is close... but not exactly what im looking for. Can someone point me to the correct thread to satisfy what im looking for?

    Creation of one log file on a certain network directory
    prompts at closing for "reason of save" if closing a drawing that has been saved in one way or the other (and loop prompt untill user actually types something)...so that if someone opens the drawing and closes without saving it does not log.

    log the following..
    user, file name with directory, open time, close time, "reason for save"

    I would be a hero to the "big cheese"

    Please help me get my end of the year raise...

    Thanks!!

Page 5 of 6 FirstFirst 123456 LastLast

Similar Threads

  1. Tracking Changes in your model
    By dduarte in forum Revit Architecture - Tips & Tricks
    Replies: 10
    Last Post: 2010-11-11, 10:00 AM
  2. Tracking Changes...
    By AJGKennedy in forum Revit Architecture - General
    Replies: 5
    Last Post: 2008-08-01, 02:38 PM
  3. polar tracking
    By hausmeister25 in forum ACA General
    Replies: 2
    Last Post: 2007-03-12, 10:28 AM
  4. autolisp tracking
    By deevans in forum AutoLISP
    Replies: 2
    Last Post: 2005-10-31, 04:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •