Odd issue - system variables auprec and aunits change like crazy

Discussion in 'AutoCAD' started by Alan Neal, Aug 1, 2003.

  1. Alan Neal

    Alan Neal Guest

    Has anybody ever put in a variable change reactor? I would have no
    problems if it wasn't for whatever causes auprec to constantly toggle to
    0 and aunits to toggle to 0. I would guess this would have to affect the
    overall performance of autocad. here's the situation...

    1) Put in this code.

    Public WithEvents ACADApp As AcadApplication ' Call to Application
    Event

    Public Sub setappreactor() 'run this sub to define ACADApp
    Set ACADApp = GetObject(, "AutoCAD.Application.16")
    End Sub


    Private Sub ACADApp_SysVarChanged(ByVal SysvarName As String, ByVal
    newVal As Variant)
    MsgBox ("the sysvar is " & SysvarName & " changed to " & newVal)

    End Sub


    '****************************

    Now, set aunits and auprec to 0, run, and type a command... not likely to
    change any varibales if it's something like line or move.

    Set aunits and auprec to a non-0 number, (I use aunits at 2, auprec at
    4). Just click the cursor anywhere or type any command. I want to know
    if you get the same result I do. On my machine, it begins changing the
    auprec and aunits values between 0 and the number I assigned very very
    rapidly, and many times, as if it is somehow using the 0 values for some
    type of cursor function. This renders the variable event reactor
    useless, because it runs so much it slows everything down.
    I just wondered if I found some weird setting or not, can't find a
    culprit. Also thought it may help anyone else who plays with the reactor
    to realize this potential situation.

    The reason for using this is it allows a modeless type of reaction that
    works with the dimstyle and textstyle pulldowns in the menu. I originally
    thought it was the event reactor using too many resources, now I learned
    it is from the auprec/aunits toggling back and forth

    Thanks in advance for anyone's input!
     
    Alan Neal, Aug 1, 2003
    #1
  2. Alan Neal

    joesu Guest

    I had no problems, however I did start the Application events a bit different then you did.

    Joe
    --

    Option Explicit

    Dim WithEvents oAcad As AcadApplication

    Public Sub StartAcadEvents()   Set oAcad = Application End Sub
     
    joesu, Aug 1, 2003
    #2
  3. Your code worked normally for me, but I had to change
    "AutoCAD.Application.16" to ".15" for ACAD 2002. So maybe it's
    2004-specific?

    James
     
    James Belshan, Aug 1, 2003
    #3
  4. Alan Neal

    Alan Neal Guest

    Ok, the fact that nobody was having the problem made me dig a little
    more... I had disabled all lisp and vba, but I found the culprit. Good
    to know too - if you use diesel, the angtos function does not calculate
    the precision and formatting of the angle, rather it changes the units
    and precision variables, reads the value, then changes them back to the
    previous value. To show up in realtime on the screen if in a modemacro
    variable, it does this CONSTANTLY. No joke, hundreds of times per
    command. This resolves the issue, and the dimstyle change reactor seems
    to work perfect now.

    For anybody that wants to try setting up different toolpalettes for
    different company standard dimstyles, just take the code I posted before
    and replace the msgbox command with a call to a sub that has the logic
    statements (such as select case) with the different company dimstyes. I
    also set standard to use "Thisdrawing.getvariable ("LOCALROOTPREFIX" &
    "support\toolpalette") so that the standard palette that comes with
    autocad is available for people to customize when they select standard.
    The other thing I would suggest is to set a variable to toggle on and off
    this reactor. Someone may want to change the dimscale without accessing
    different palettes. Hope this helps others looking at how to make the
    toolpalettes more powerful for them.
     
    Alan Neal, Aug 1, 2003
    #4
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.