1. //AutoCad2012新增类 获取所有变量名和值
    2. AcRxVariablesDictionary *dic=AcRxVariablesDictionary::get();
    3. const AcArray<AcString> aaa= dic->getAllNames();
    4. for (int i=0; i<aaa.length(); i++)
    5. {
    6. acutPrintf(_T("\n变量名=%s;"),aaa.at(i));
    7. struct resbuf rb;
    8. Acad::ErrorStatus es= dic->getVariable(aaa.at(i))->getValue(rb);
    9. if (Acad::eOk == es)
    10. {
    11. if (rb.restype == RTSTR)
    12. {
    13. acutPrintf(_T(" 值=%s"),rb.resval.rstring);
    14. }
    15. else if (rb.restype == RTREAL)
    16. {
    17. acutPrintf(_T(" 值=%0.4lf"),rb.resval.rreal);
    18. }
    19. else if (rb.restype == RTSHORT)
    20. {
    21. acutPrintf(_T(" 值=%d"),rb.resval.rint);
    22. }
    23. else if (rb.restype == RTLONG)
    24. {
    25. acutPrintf(_T(" 值=%d"),rb.resval.rlong);
    26. }
    27. }
    28. }