Controlling SAVEFORMAT

Hi all,

under Settings/Settings/SAVEFORMAT you can control the default Saving format for DWGs.

Does anybody know a way to externally controll this value? I want to make sure the default is DWG2007.

COM commands GetVariable/SetVariable don't seem to do the trick,

neither (setvar "saveformat" 30)  << is this correct? my Lisp is still awfull ;-)

I would like to put something in On_Start.lsp or else in the registry?

TIA

Arno van Eeuwen

 

 

 

 

Comments

  • You cannot change this setting using setvar. It is possible to change this setting in the registry but that new setting will not be used in the current session. You could try something like this (I would put it in on_start.lsp):

    (if
    (/= (vl-registry-read "HKEY_CURRENT_USER\\Software\\Bricsys\\Bricscad\\V11\\en_US\\Profiles\\Default\\Config" "SaveFormat") 4)
    (progn
    (vl-registry-write "HKEY_CURRENT_USER\\Software\\Bricsys\\Bricscad\\V11\\en_US\\Profiles\\Default\\Config" "SaveFormat" 4)
    (alert "Please restart Bricscad to change SaveFormat to DWG2007...")
    )
    (princ "\nSaveFormat is DWG2007 ")
    )
    (princ)
    Note 1: For DWG2007 SaveFormat is 4.
    Note 2: SaveFormat values are not fixed across Bricscad versions. SaveFormat 1 is always the most recent supported DWG version.
    Note 3: Works for BC 11.4.5 on Win XP.
  • Thanks for your reply Roy.

    Since it's Registry keys you're playing with I might as well put it straight in my C# code.

    I checked out my Registry and found the key allright.

    So it seems to an the index in the list of currently supported versions? That's a bit of a pitt fall...

    Cheers,

    Arno

     

     

  • For those interested, this is doing the trick in C#.

    Roy, thanks again!

     

    public void ForceDwg2007Format(){  RegistryKey mainKey = Registry.CurrentUser;   RegistryKey config_Key = mainKey.OpenSubKey(@SOFTWARE\Bricsys\Bricscad\V11\en_US\Profiles\Default\Configtrue);   if (config_Key == nullreturn;   config_Key.SetValue("SAVEFORMAT", 4);}

     

     

     


     

  • It's not a good idea to directly change settings in a bricscad profile in the registry during a session, because on close Bricscad will only overwrite the values again. The way to change the default save format during a session would be to VBA directly or through lisp. Retrieving the default format can be done like this:

    (vla-get-saveastype (vla-get-opensave (vla-get-preferences (vlax-get-acad-object))))

    If in the settings dialog you set SAVEFORMAT to dwg2007,  then you'll see that in the current Bricscad version DWG2007 is equivalent with value 36.

    So if in lisp you do the following, then the default format is set at runtime:

    (vla-put-SaveAsType (vla-get-OpenSave(vla-get-Preferences (vlax-get-acad-object))) 36)

  • @ Alexander: Thank you. Good to learn that there is an elegant way to do this.

  • Note also that the value 36 for default save format will in all likelyhood remain the same across Bricscad versions while the registry value SAVEFORMAT will change with the next increase of the file format version.

  • I actually start Bricscad V11 from my own application. From there a user opens and saves drawings and we make sure to use DWG2007 format.

    It recently happened that someone used Control+S in Bricscad with a drawing open. Bricscad default was DWG2010 so that changed the file format.

    Before I now start Bricscad (AcadApplication myApp = new AcadAppication) I make sure DWG2007 format is set in the registry, hoping these problems won't arise again.

    I was actially surprised that the value of AcSaveAsType.acNative = 36 while the registry keeps 4...

This discussion has been closed.