By Adam Nagy
I know I can use the command line version of 3DCONFIG to change graphics settings using e.g. SendStringToExecute(). However, I'm wondering if it's also possible through some direct API.
Solution
Yes, you can access these settings through the AcGsConfig class.
This ARX sample command toggles the Hardware Acceleration setting:
static void ToggleHWAcceleration(void)
{
AcGsConfig * gsConf =
acgsGetGsManager()->getGSClassFactory()->getConfig();
bool b = gsConf->isFeatureEnabled(AcGsConfig::kHwAcceleration);
gsConf->setFeatureEnabled(AcGsConfig::kHwAcceleration, !b);
gsConf->saveSettings();
}
The same in .NET:
[CommandMethod("ToggleHWAcceleration")]
public void ToggleHWAcceleration()
{
using (Autodesk.AutoCAD.GraphicsSystem.Configuration config =
new Autodesk.AutoCAD.GraphicsSystem.Configuration())
{
bool b = config.IsFeatureEnabled(
Autodesk.AutoCAD.GraphicsSystem.
HardwareFeature.HardwareAcceleration);
config.SetFeatureEnabled(
Autodesk.AutoCAD.GraphicsSystem.
HardwareFeature.HardwareAcceleration, !b);
config.SaveSettings();
}
}