Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change the active profile

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ThomasRambach
1090 Views, 2 Replies

Change the active profile

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?

 

 

 

2 REPLIES 2
Message 2 of 3

 acPrefComObj.Profiles.ActiveProfile = "ACAD_Profile";

 

That was easy.

 

Message 3 of 3
norman.yuan
in reply to: ThomasRambach

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report