Regapp - failed on first try...

Discussion in 'AutoCAD' started by petersciganek, Oct 18, 2004.

  1. In my xdata-put function I use regapp to check for/register the application before moving on to attach the data. I just ran across a case in which the regapp only "takes" on the second call - this seems to be related to the name of the application to be registered (perhaps the string's length). I switched to activex(i.e. - if not item in RegisteredApplications collections then add...) and can register the application as expected.

    My questions are 1) has anyone else come across this behavior with regapp? and 2) is there any drawback to using the activex method as described above (considering that this regapp workaround will be called 100's or 1000's of times in any given routine)?

    Thanks for any help/insights,

    Peter
     
    petersciganek, Oct 18, 2004
    #1
  2. Why run regapp 100's or 1000's of times?

    Why not just run regapp upon your application's load?

    --
    R. Robert Bell


    In my xdata-put function I use regapp to check for/register the application
    before moving on to attach the data. I just ran across a case in which the
    regapp only "takes" on the second call - this seems to be related to the
    name of the application to be registered (perhaps the string's length). I
    switched to activex(i.e. - if not item in RegisteredApplications collections
    then add...) and can register the application as expected.

    My questions are 1) has anyone else come across this behavior with regapp?
    and 2) is there any drawback to using the activex method as described above
    (considering that this regapp workaround will be called 100's or 1000's of
    times in any given routine)?

    Thanks for any help/insights,

    Peter
     
    R. Robert Bell, Oct 18, 2004
    #2
  3. Robert,

    I added the regapp in the xdata-put function for convenience (wrapping everything up into a simple function to attach xdata to an entity), I suppose - assuming, perhaps incorrectly, that a regapp call will not slow things down too much. I suppose that I should test the speed difference though.

    Peter
     
    petersciganek, Oct 18, 2004
    #3
  4. I tested three variations - attaching xdata to 11400 lines:

    single call to regapp: 0.000327685
    activex register with each call: 0.000342153
    regapp with each call: 0.0003436

    so calling regapp each time is somewhat inefficient - though not enough so to go back and modify all of my routines. The regapp and activex register method test about the same - and no crashes so far so I'll stick with activex for now.

    Peter
     
    petersciganek, Oct 18, 2004
    #4
  5. Are the timings you show below in seconds?
     
    Tony Tanzillo, Oct 18, 2004
    #5
  6. Good point - that would be fast. I'm using the "DATE" variable for a general comparison - so it would be about 28.312, 29.562, and 29.687 respectively.

    Still - I find it odd that regapp should not register the first time with some app names. Of course - this could be a red herring...

    Peter
     
    petersciganek, Oct 18, 2004
    #6
  7. (if (not (tblsearch "appid" APPNAME)) ; Checks if already registered
    (if (= (regapp APPNAME) nil) ; Register and make sure
    registered
    (alert (strcat "\nERROR - \n Can't register XDATA for " APPNAME
    ". "))
    )
    )

    application before moving on to attach the data. I just ran across a case in
    which the regapp only "takes" on the second call - this seems to be related
    to the name of the application to be registered (perhaps the string's
    length). I switched to activex(i.e. - if not item in RegisteredApplications
    collections then add...) and can register the application as expected.
    and 2) is there any drawback to using the activex method as described above
    (considering that this regapp workaround will be called 100's or 1000's of
    times in any given routine)?
     
    Alan Henderson @ A'cad Solutions, Oct 18, 2004
    #7
  8. petersciganek

    ikaage Guest

    (Peter,
    you still at GCA?

    You know where i could look/ ask for a sample Construction Admin Manual - specifically as it pertains to drawing changes?

    PS. 2nd kid was due last monday. hasn't come out yet. how bout you?

    Irv)
     
    ikaage, Oct 18, 2004
    #8
  9. Alan - thanks for your interest - here's the activex version of the same thing that I am currently using:

    (defun f:regapp (appname)
    (cond
    ((f:vlerr 'vla-Item (list (vla-get-RegisteredApplications (fx:doc)) appname) nil) nil)
    ((f:vlerr 'vla-Add (list (vla-get-RegisteredApplications (fx:doc)) appname) nil)
    appname
    )
    (T (f:prm (list "\n***f:regapp error: failed to register " appname))
    (f:vlerr 'vla-Add (list (vla-get-RegisteredApplications (fx:doc)) appname) T)
    nil
    )
    );cond
    )

    f:vlerr is a catch error routine, f:prm is a prompt function and fx:doc is the active document.

    This method worked (as opposed to the regapp function) in the routine that I was working on - hence my question above.

    Peter
     
    petersciganek, Oct 19, 2004
    #9
  10. Hi Irv - funny to hear from you this way...

    Not at GCA - back in Munich since 2002. My email here is -

    Peter
     
    petersciganek, Oct 19, 2004
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.