system variables via Objectdbx

Discussion in 'AutoCAD' started by Mark Propst, May 16, 2004.

  1. Mark Propst

    Mark Propst Guest

    Hi
    I just wanted to confirm if it is not possible to set or get sysvars - even
    ones stored in dwg file - via object dbx.(for example "ProjectName")
    I was surprised not to find anything on this through google, probably just
    didnt' find the right search terms, but "dbx" "system" "variable" didnt'
    yield much.
    But through experimentation, i get an error if i try to access a dbx
    document method .GetSystemVariable or SetSystemVariable
    My hypothesis is that it seems only the active doc can use those methods and
    since the dbx cant be active, it cant access it's own variables - even
    though they are stored in the document itself.
    I was able to set and get with no problems if i open the doc in the editor,
    but cant seem to with dbx.
    Am I missing something simple? or is this really the case?
    Somehow it seems strange if the variable is stored in the dwg that there
    would be no property or method available to access it even through dbx but
    if there is I haven't found it yet.
    Thanks for any info.
    I couldn't find anything on this in the help either, but again maybe I'm not
    searching on the right terms to get a hit - the obvious ones don't seem to
    be turning up any entries
    Mark
     
    Mark Propst, May 16, 2004
    #1
  2. Mark, that function does not work in dbx.
    It's not because it only works on the active document
    it's because the function can also read vars outside the dwg.
     
    Jorge Jimenez, May 16, 2004
    #2
  3. Since GetVariable and SetVariable are methods of AcadDocument,
    they only work on AcadDocuments (they're just wrappers for
    the ObjectARX counterpart of the (getvar) and (setvar) LISP
    functions). So there's no method for getting/setting system
    variables stored in drawings that are accessed directly via
    ObjectDBX.

    The AcadXDatabase class in AcadX provides a means to get
    system variables from drawings accessed via ObjectDBX.
    It only retrieves system variables that are stored in the
    dwg file (since that's all that makes sense). I never got
    around to a SetVariable method, because I never needed it,
    and it is a lot of work.
     
    Tony Tanzillo, May 16, 2004
    #3
  4. Mark Propst

    Mark Propst Guest

    Thanks for the confirmation,
    In this case I just wanted to auto set the ProjectName on several folders
    and their subfolders.
    Its easy enough to just open the dwgs in a loop as go the dbx route, just
    wanted to confirm that I wasn't just 'not' seeing it. I know that's a
    double negative but it still seems the right way to say it!?!
    :)
    The obvious downside of having to open in the editor to do whatever..is
    tying up the 'hosting' application - the session of acad from which the call
    to the routine was made. (assuming vba)
    But it seems that's the case with dbx as well, If i start a dbx loop, it
    still seems to capture acad's attention and I can print messages to command
    line or such but I haven't figured a way to make a loop "run in the
    background" - such that the user could go back to editing the current
    drawing while the loop is doing it's thing....
    I guess that should be a whole different thread.
    Thanks again for the info, Tony
    Mark
     
    Mark Propst, May 16, 2004
    #4
  5. Mark Propst

    Mark Propst Guest

    Thats how it seemed, thanks for the confirmation.:)
    That makes sense, since I have no idea what getvar or setvar are really
    doing I originally thought dbx could generally read whatever info was in
    there. I see it's not the case.
    Thanks
    Mark
     
    Mark Propst, May 16, 2004
    #5
  6. Mark, don't know if it helps in your case (vba), but you could try and
    create a new acad session and do the loop there.
    Once finished, just close the session.
    But of course, it could get messy doing that from VBA.
     
    Jorge Jimenez, May 16, 2004
    #6
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.