Change the active profile

Change the active profile

ThomasRambach
Advisor Advisor
1,506 Views
2 Replies
Message 1 of 3

Change the active profile

ThomasRambach
Advisor
Advisor

I have a .NET add-in written in C# that works well for importing a profile:

            // Access the Preferences object
            AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences;

            // Load the OFC AutoCAD Profile
            acPrefComObj.Profiles.ImportProfile("ACAD_Profile", @"C:\CADContent\2019\acad\profiles\ACAD_Profile.arg",true);

 

What I can't figure out is how to set the profile as active. I just don't see where the API allows it. Any ideas?

 

 

 

0 Likes
Accepted solutions (1)
1,507 Views
2 Replies
Replies (2)
Message 2 of 3

ThomasRambach
Advisor
Advisor
Accepted solution

 acPrefComObj.Profiles.ActiveProfile = "ACAD_Profile";

 

That was easy.

 

0 Likes
Message 3 of 3

norman.yuan
Mentor
Mentor
acPrefComObj.Profiles.ActiveProfile="[the profile name]"

Before importing a profile with given name, I'd check if the Profiles collection has a profile with the same name, or a profile with the same is current (ActiveProfile), and decide what to do. 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes