下面的示例演示了 theand 类的用法:AcApProfileManagerAcApProfileManagerReactor // Define a class derived from AcApProfileManagerReactor to manage // the notifications. // class AsdkProfileManagerReactor : public AcApProfileManagerReactor { public: void currentProfileWillChange(const char *newProfile); void currentProfileChanged(const char *newProfile); void currentProfileWillBeReset(const char *curProfile); void currentProfileReset(const char *curProfile); void profileWillReset(const char *profName); void profileReset(const char *proName); }; // Define the notification functions. // void AsdkProfileManagerReactor:: currentProfileWillChange(const char *newProfile) { acutPrintf("\nCurrent profile will change: %s", newProfile); } void AsdkProfileManagerReactor:: currentProfileChanged(const char *newProfile) { acutPrintf("\nCurrent profile changed: %s", newProfile); } void AsdkProfileManagerReactor:: currentProfileWillBeReset(const char *curProfile) { acutPrintf("\nCurrent profile will be reset: %s", curProfile); } void AsdkProfileManagerReactor:: currentProfileReset(const char *curProfile) { acutPrintf("\nCurrent profile has been reset: %s", curProfile); } void AsdkProfileManagerReactor:: profileWillReset(const char *profName) { acutPrintf("\nNon-current profile will be reset: %s", profName); } void AsdkProfileManagerReactor:: profileReset(const char *profName) { acutPrintf("\nNon-current profile has been reset:%s", profName); } void aFunction() { acutPrintf("This is AsdkProfileSample Test Application...\n"); // Attach the reactor for the duration of this command. Normally // this would be added upon application initialization. // AsdkProfileManagerReactor *pProfileRector = new AsdkProfileManagerReactor(); acProfileManagerPtr()->addReactor(pProfileRector); // Obtain the path for the registry keys and print it out. // char *pstrKey; acProfileManagerPtr()->ProfileRegistryKey(pstrKey, NULL); if (pstrKey != NULL) { acutPrintf("\nThe profiles registry key is: %s", pstrKey); acutDelString(pstrKey); } // Get the list of all profiles in the user's configuration // and print them out. // AcApProfileNameArray arrNameList; int nProfiles = acProfileManagerPtr()->ProfileListNames(arrNameList); acutPrintf("\nNumber of profiles currently " "in the user profile list is: %d", nProfiles); for (int i = 0; i < nProfiles; i++) acutPrintf("\nProfile name is: %s", arrNameList[i]); // Copy the unnamed profile to the AsdkTestProfile. // acProfileManagerPtr()->ProfileCopy( "AsdkTestProfile", "<<Unnamed Profile>>", "This is a test"); // Reset the newly copied profile to AutoCAD defaults. // acProfileManagerPtr()->ProfileReset("AsdkTestProfile"); // Make this new profile current. // acProfileManagerPtr()->ProfileSetCurrent("AsdkTestProfile"); // Change a value in the profile. For this example, make the // cursor big. // struct resbuf rbCursorSize; rbCursorSize.restype = RTSHORT; rbCursorSize.resval.rint = 100; acedSetVar("CURSORSIZE", &rbCursorSize); // Rename the profile to a new name. // acProfileManagerPtr()->ProfileRename( "AsdkTestProfile2", "AsdkTestProfile", "This is another test"); // Export the profile. // acProfileManagerPtr()->ProfileExport( "AsdkTestProfile2", "./AsdkTestProfile2.arg"); // Import the profile. // acProfileManagerPtr()->ProfileImport( "AsdkTestProfile3", "./AsdkTestProfile2.arg", "This is a copy of AsdkTestProfile2" "by Exporting/Importing", Adesk::kTrue); // Remove the reactor. // acProfileManagerPtr()->removeReactor(pProfileRector); } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:28
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.