{"id":16979,"date":"2024-08-11T23:10:39","date_gmt":"2024-08-11T15:10:39","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=16979"},"modified":"2025-03-16T21:32:22","modified_gmt":"2025-03-16T13:32:22","slug":"objectarx-2025%ef%bc%88c%ef%bc%89%e5%ae%9e%e7%8e%b0%e5%9b%ba%e5%8c%96%e6%a0%87%e6%b3%a8%e6%96%87%e5%ad%97%e5%92%8c%e6%a0%87%e6%b3%a8%e6%81%a2%e5%a4%8d%e5%8e%9f%e5%80%bc%e3%80%90%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=16979","title":{"rendered":"ObjectARX 2025\uff08C++\uff09\u5b9e\u73b0\u56fa\u5316\u6807\u6ce8\u6587\u5b57\u548c\u6807\u6ce8\u6062\u590d\u539f\u503c\u3010\u5f85\u66f4\u65b0\u3011"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor:pointer\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.iyatt.com\/?p=16979\/#%E9%9C%80%E6%B1%82\" >\u9700\u6c42<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.iyatt.com\/?p=16979\/#%E7%8E%AF%E5%A2%83\" >\u73af\u5883<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.iyatt.com\/?p=16979\/#%E5%AE%9E%E7%8E%B0\" >\u5b9e\u73b0<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E9%9C%80%E6%B1%82\"><\/span>\u9700\u6c42<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5728\u5236\u4f5c\u673a\u52a0\u5de5\u5de5\u827a\u7684\u65f6\u5019\uff0c\u5b8c\u6210\u7ed8\u56fe\u548c\u6807\u6ce8\u540e\u9700\u8981\u88c5\u8fdb\u4f5c\u4e1a\u6307\u5bfc\u4e66\uff08\u56fe\u6846\u4e2d\uff09\uff0c\u53ef\u80fd\u9700\u8981\u5bf9\u56fe\u5f62\u8fdb\u884c\u7f29\u653e\u64cd\u4f5c\u3002\u7531\u4e8e CAD \u9ed8\u8ba4\u7684\u6807\u6ce8\u662f\u5b9e\u4f53\u5c3a\u5bf8\u9a71\u52a8\u7684\uff0c\u5728\u7f29\u653e\u540e\u5c3a\u5bf8\u4f1a\u53d1\u751f\u53d8\u5316\uff0c\u5bfc\u81f4\u6807\u6ce8\u4e5f\u8ddf\u968f\u5b9e\u9645\u5c3a\u5bf8\u53d8\u5316\u3002\u56e0\u6b64\u9700\u8981\u5c06\u6807\u6ce8\u56fa\u5316\u4e0b\u6765\uff0c\u8ba9\u6807\u6ce8\u5185\u5bb9\u4e0d\u518d\u8ddf\u968f\u5b9e\u4f53\u5c3a\u5bf8\u53d8\u5316\u3002<br \/>\n\u6211\u4e2a\u4eba\u4e60\u60ef\u5728\u505a\u52a0\u5de5\u5de5\u827a\u7684\u65f6\u5019\uff0c\u4e0d\u53bb\u6539\u52a8\u56fe\u5f62\uff0c\u800c\u662f\u7f29\u653e\u56fe\u6846\u53bb\u9002\u914d\u56fe\u5f62\uff0c\u8fd9\u4e2a\u9700\u6c42\u5bf9\u6211\u7684\u5f71\u54cd\u5c31\u4e0d\u662f\u5f88\u5927\uff08\u4e0d\u8fc7\u6709\u4e9b\u540c\u4e8b\u662f\u7f29\u653e\u56fe\u5f62\u9002\u914d\u56fe\u6846\u7684\uff09\u3002\u4e3b\u8981\u8fd8\u662f\u540e\u671f\u6211\u8ba1\u5212\u505a\u4e00\u4e2a\u5c3a\u5bf8\u63d0\u53d6\u7684\uff0c\u5728\u5c3a\u5bf8\u63d0\u53d6\u4e4b\u524d\u53ef\u4ee5\u5148\u56fa\u5316\u6807\u6ce8\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u76f4\u63a5\u8bfb\u53d6\u5c3a\u5bf8\u6807\u6ce8\u4e86\u3002<\/p>\n<p><strong>\u6280\u672f\u5c42\u9762\u5b9e\u73b0\uff1a<\/strong><br \/>\nCAD \u91cc\u7684\u9ed8\u8ba4\u6807\u6ce8\u5bf9\u8c61\u663e\u793a\u7684\u5c3a\u5bf8\u662f\u7531\u4e24\u90e8\u5206\u5c5e\u6027\u51b3\u5b9a\u7684\uff0c\u4e00\u4e2a\u662f\u6d4b\u91cf\u5355\u4f4d\uff0c\u8fd9\u4e2a\u503c\u5c31\u662f\u6807\u6ce8\u5bf9\u8c61\u7684\u5b9e\u4f53\u5c3a\u5bf8\u503c\uff0c\u8ddf\u968f\u6807\u6ce8\u5bf9\u8c61\u56fe\u5f62\u53d8\u5316\u800c\u53d8\u5316\uff0c\u53e6\u4e00\u4e2a\u662f\u6587\u5b57\u66ff\u4ee3\uff0c\u6587\u5b57\u66ff\u4ee3\u7a7a\u7740\u5c31\u663e\u793a\u6d4b\u91cf\u5355\u4f4d\u7684\u503c\uff0c\u5f53\u624b\u52a8\u6dfb\u52a0\u4e86\u76f4\u5f84\u3001\u89d2\u5ea6\u7b26\u53f7\u4ee5\u53ca\u516c\u5dee\u7b49\u540e\uff0c\u5c31\u4f1a\u5448\u73b0\u5728\u6587\u5b57\u66ff\u4ee3\u91cc\uff0c\u6b64\u65f6\u6807\u6ce8\u663e\u793a\u7684\u5c31\u662f\u6587\u5b57\u66ff\u4ee3\u91cc\u7684\u5185\u5bb9\uff0c\u9ed8\u8ba4\u6d4b\u91cf\u5355\u4f4d\u4f1a\u4ee5&lt;&gt;\u7b26\u53f7\u5448\u73b0\u5728\u6587\u5b57\u66ff\u4ee3\u4e2d\uff0c\u6807\u6ce8\u663e\u793a\u7684\u65f6\u5019\u6587\u5b57\u66ff\u4ee3\u4e2d\u7684&lt;&gt;\u7b26\u53f7\u4f1a\u81ea\u52a8\u8d4b\u503c\u4e3a\u6d4b\u91cf\u5355\u4f4d\u7684\u503c\u3002<br \/>\n\u53ef\u4ee5\u53c2\u8003<a href=\"https:\/\/blog.iyatt.com\/?p=16933\">\u83b7\u53d6\u5c3a\u5bf8\u6807\u6ce8\u5185\u5bb9<\/a>\uff0c\u6709\u56fe\u4f8b\u66f4\u597d\u7406\u89e3\u5c3a\u5bf8\u6807\u6ce8\u7684\u5185\u5bb9\u7ec4\u6210\u3002<br \/>\n\u56fa\u5316\u6807\u6ce8\u5176\u5b9e\u5c31\u662f\u628a\u6587\u5b57\u66ff\u4ee3\u91cc\u7684&lt;&gt;\u76f4\u63a5\u6539\u4e3a\u6d4b\u91cf\u5355\u4f4d\u7684\u6570\u503c\uff08\u6d4b\u91cf\u5355\u4f4d\u7684\u6570\u503c\u8981\u5148\u6309\u7167\u6807\u6ce8\u5bf9\u8c61\u7684\u4e3b\u5355\u4f4d\u7cbe\u5ea6\u53d6\u5c0f\u6570\u4f4d\u6570\uff09\uff0c\u8fd9\u6837\u6587\u5b57\u66ff\u4ee3\u4e2d\u4e0d\u5b58\u5728&lt;&gt;\u7b26\u53f7\uff0c\u6807\u6ce8\u5185\u5bb9\u5c31\u4e0d\u4f1a\u8ddf\u968f\u5b9e\u4f53\u5c3a\u5bf8\u53d8\u5316\u4e86\u3002\u800c\u6062\u590d\u539f\u503c\uff0c\u5c31\u662f\u628a\u6587\u5b57\u66ff\u4ee3\u7684\u5185\u5bb9\u5220\u6389\uff0c\u8fd9\u6837\u6807\u6ce8\u5c31\u4f1a\u663e\u793a\u6d4b\u91cf\u5355\u4f4d\u7684\u503c\u3002\u4e0d\u8fc7\u5982\u679c\u6807\u6ce8\u5b58\u5728\u81ea\u884c\u6dfb\u52a0\u7684\u7b26\u53f7\u3001\u516c\u5dee\u7b49\u5185\u5bb9\u4e5f\u4f1a\u4e00\u5e76\u5220\u6389\uff0c\u8fd9\u4e2a\u6682\u65f6\u6ca1\u6709\u53ef\u884c\u601d\u8def\u5b9e\u73b0\u4fdd\u7559\u6587\u5b57\u66ff\u4ee3\u5176\u5b83\u5185\u5bb9\u7684\u540c\u65f6\u6062\u590d\u6807\u6ce8\u7684\u5b9e\u4f53\u5c3a\u5bf8\u9a71\u52a8\u6027\u3002<\/p>\n<p><strong>\u53ef\u80fd\u5b58\u5728\u7684 BUG<\/strong><\/p>\n<p>\u5b9e\u4f53\u5c3a\u5bf8\u7cbe\u5ea6\u548c\u6807\u6ce8\u7cbe\u5ea6\u4e0d\u4e00\u81f4\uff0c\u4e14\u6807\u6ce8\u7cbe\u5ea6\u4f4e\u4e8e\u5b9e\u4f53\u7cbe\u5ea6\u65f6\u7684\u56db\u820d\u4e94\u5165\u5904\u7406\u53ef\u80fd\u5b58\u5728\u95ee\u9898\u3002<br \/>\n\u6bd4\u5982\u7ed8\u5236\u4e86\u4e00\u6761 10.445 \u7684\u76f4\u7ebf\uff0c10.445 \u5728\u8ba1\u7b97\u673a\u4e2d\u4ee5\u4e8c\u8fdb\u5236\u5b58\u50a8\uff0c\u800c 10.445 \u8f6c\u4e3a\u4e8c\u8fdb\u5236\u662f\u65e0\u9650\u5c0f\u6570\uff0c\u4f46\u662f\u8ba1\u7b97\u673a\u4fdd\u5b58\u7684\u4f4d\u6570\u662f\u6709\u9650\u7684\uff0c\u5219\u8d85\u51fa\u5b58\u50a8\u7684\u4f4d\u6570\u5c31\u4e22\u5931\u4e86\uff0c\u8fd9\u6837\u5b9e\u9645\u5b58\u50a8\u7684\u4e8c\u8fdb\u5236\u503c\u53ea\u662f\u5341\u8fdb\u5236\u503c\u7684\u8fd1\u4f3c\u503c\uff0c\u518d\u8f6c\u56de\u5341\u8fdb\u5236\u5e76\u4e0d\u662f 10.445\uff0c\u800c\u53ef\u80fd\u662f 10.4449999999&#8230;<br \/>\n\u5982\u679c\u6211\u5bf9\u8fd9\u4e2a 10.445 \u7684\u5b9e\u4f53\u5c3a\u5bf8\u53d6\u4e24\u4f4d\u5c0f\u6570\uff0c\u7531\u4e8e\u5185\u90e8\u5b58\u50a8\u7684\u662f 10.444999&#8230;\uff0c\u4e24\u4f4d\u5c0f\u6570\u53c2\u8003\u7b2c\u4e09\u4f4d\u662f4\uff0c\u6240\u4ee5\u5f97\u5230\u7684\u7ed3\u679c\u5c31\u4f1a\u662f 10.44\uff0c\u800c\u4e0d\u662f 10.45\u3002<br \/>\n\u6211\u8003\u8651\u5230\u9020\u6210\u7cbe\u5ea6\u635f\u5931\u7684\u60c5\u51b5\u662f\u5341\u8fdb\u5236\u8f6c\u4e8c\u8fdb\u5236\u662f\u65e0\u9650\u5c0f\u6570\uff0c\u800c\u5b9e\u9645\u5b58\u50a8\u6709\u9650\u4f4d\uff0c\u6240\u4ee5\u53d1\u751f\u7cbe\u5ea6\u635f\u5931\u5c31\u662f\u8ba1\u7b97\u673a\u5b58\u50a8\u7684\u503c\u6bd4\u8bbe\u7f6e\u7684\u503c\u5c0f\uff0c\u6240\u4ee5\u56db\u820d\u4e94\u5165\u7684\u65f6\u5019\u6211\u662f\u4eba\u4e3a\u5728\u4fdd\u7559\u5c0f\u6570\u7684\u4e24\u4f4d\u540e\u4f4d\u7f6e\u4eba\u4e3a\u52a0 1 \u8865\u507f\u3002\u8fd9\u4e2a\u65b9\u6cd5\u662f\u6ca1\u6709\u6570\u5b66\u8bc1\u660e\u662f\u5426\u6b63\u786e\u7684\uff0c\u53ea\u662f\u6211\u6d4b\u8bd5\u4e86\u6709\u9650\u4e2a\u6570\u636e\u53ef\u884c\u7684\u60c5\u51b5\u4e0b\u91c7\u7528\u7684\u3002<br \/>\n\u8fd9\u91cc\u7684\u56db\u820d\u4e94\u5165\u5176\u5b9e\u4e5f\u662f\u4e3a\u4e86\u5e94\u5bf9\u610f\u5916\u60c5\u51b5\uff0c\u5176\u5b9e\u6b63\u5e38\u7ed8\u56fe\uff0c\u7ed8\u5236\u7684\u7cbe\u5ea6\u548c\u6807\u6ce8\u7684\u7cbe\u5ea6\u5e94\u8be5\u662f\u4e00\u81f4\u7684\uff0c\u5e76\u4e0d\u9700\u8981\u518d\u6b21\u7cbe\u786e\u5c0f\u6570\u3002<\/p>\n<p><strong>\u6f14\u793a<\/strong><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2024\/08\/image-1723904595025.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 944px; --smush-placeholder-aspect-ratio: 944\/256;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2024\/08\/image-1723904611360.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 943px; --smush-placeholder-aspect-ratio: 943\/237;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2024\/08\/image-1723904642919.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 445px; --smush-placeholder-aspect-ratio: 445\/232;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2024\/08\/image-1723904680609.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 572px; --smush-placeholder-aspect-ratio: 572\/321;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2024\/08\/image-1723904709246.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 714px; --smush-placeholder-aspect-ratio: 714\/764;\" \/><\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E7%8E%AF%E5%A2%83\"><\/span>\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>AutoCAD \u673a\u68b0\u7248 2025<br \/>\nObjectARX 2025<br \/>\nVS 2022<\/p>\n<p>\u73af\u5883\u914d\u7f6e\u53c2\u8003\uff1a<a href=\"https:\/\/blog.iyatt.com\/?p=16480\">https:\/\/blog.iyatt.com\/?p=16480<\/a><br \/>\n\u81ea\u5b9a\u4e49\u7c7b\u4f7f\u7528\u65b9\u6cd5\u53c2\u8003\uff1a<a href=\"https:\/\/blog.iyatt.com\/?p=16635\">https:\/\/blog.iyatt.com\/?p=16635<\/a><br \/>\n\u672c\u6587\u63cf\u8ff0\u7684\u529f\u80fd\u5c06\u96c6\u6210\u5728 IYATTyxCADTools \u5de5\u5177\u4e2d\uff1a<a href=\"https:\/\/github.com\/IYATT-yx\/IYATTyxCADTools\">https:\/\/github.com\/IYATT-yx\/IYATTyxCADTools<\/a> \uff0c\u5e76\u66f4\u65b0\u6539\u8fdb<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E5%AE%9E%E7%8E%B0\"><\/span>\u5b9e\u73b0<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>DimControl.hpp<\/p>\n<pre><code class=\"language-cpp\">#pragma once\n\nclass DimControl\n{\npublic:\n    static void init();\n    static void unload();\n\nprivate:\n    typedef void (*CallbackFun)(AcDbDimension*); \/\/ \u5b9a\u4e49\u56de\u8c03\u51fd\u6570\u7c7b\u578b\n\n    \/**\n     * @brief \u3010\u56de\u8c03\u51fd\u6570\u3011\u5c06\u6570\u503c\u6807\u6ce8\u8f6c\u6362\u4e3a\u6587\u5b57\u6807\u6ce8\n     * @param pDimension \u6807\u6ce8\u5bf9\u8c61\n     *\/\n    static void cbDimNumToText(AcDbDimension* pDimension);\n\n    \/**\n     * @brief \u3010\u56de\u8c03\u51fd\u6570\u3011\u5c06\u6587\u5b57\u6807\u6ce8\u8f6c\u6362\u4e3a\u6570\u503c\u6807\u6ce8\n     * @param pDimension \u6807\u6ce8\u5bf9\u8c61\n     *\/\n    static void cbResetDim(AcDbDimension* pDimension);\n\n    \/**\n     * @brief \u904d\u5386\u9009\u62e9\u96c6\u4fee\u6539\u6807\u6ce8\n     * @param fun \u3010\u56de\u8c03\u51fd\u6570\u3011\u5bf9\u6807\u6ce8\u4fee\u6539\u7684\u5b9e\u73b0\n     *\/\n    static void selectSetForeach(CallbackFun pFun);\n\n    \/**\n     * @brief \u8bbe\u7f6e\u7cbe\u5ea6\uff0c\u5e76\u8f6c\u4e3a\u5b57\u7b26\u4e32\n     * @param sMeasureValue \u8f93\u51fa\u8f6c\u6362\u7cbe\u5ea6\u7684\u5b57\u7b26\u4e32\n     * @param value \u8f93\u5165\u6570\u636e\n     * @param precision \u8bbe\u7f6e\u7cbe\u5ea6\n     * @param isAugular \u662f\u5426\u4e3a\u89d2\u5ea6\u503c\n     *\/\n    static void setPrecision(std::wstring&amp; sMeasureValue, double&amp; value, int&amp; precision, bool isAugular = false);\n\n    \/**\n     * @brief \u5c06\u6d4b\u91cf\u503c\u63d2\u5165\u6587\u5b57\u66ff\u4ee3\u4e2d\n     * @param sMeasureValue \u6d4b\u91cf\u503c\n     * @param sText \u6587\u5b57\u66ff\u4ee3\n     * @return \u662f\u5426\u5904\u7406\uff08\u7eaf\u6587\u5b57\u6807\u6ce8\u4e0d\u505a\u5904\u7406\uff09\n     *\/\n    static bool insertValue(std::wstring&amp; sMeasureValue, std::wstring&amp; sText);\n\n    \/**\n     * @brief \u9501\u5b9a\u6807\u6ce8\n     *\/\n    static void lockDim();\n\n    \/**\n     * @brief \u6062\u590d\u6807\u6ce8\n     *\/\n    static void resetDim();\n};<\/code><\/pre>\n<p>DimControl.cpp<\/p>\n<pre><code class=\"language-cpp\">#include &quot;StdAfx.h&quot;\n#include &quot;DimControl.hpp&quot;\n\nconstexpr double PI = 3.14159265358979323846;\n\nvoid DimControl::init()\n{\n    acedRegCmds-&gt;addCommand(L&quot;IYATTyxDimControl&quot;, L&quot;LD&quot;, L&quot;LD&quot;, ACRX_CMD_MODAL, DimControl::lockDim);\n    acedRegCmds-&gt;addCommand(L&quot;IYATTyxDimControl&quot;, L&quot;RD&quot;, L&quot;RD&quot;, ACRX_CMD_MODAL, DimControl::resetDim);\n}\n\nvoid DimControl::unload()\n{\n    acedRegCmds-&gt;removeGroup(L&quot;IYATTyxDimControl&quot;);\n}\n\nvoid DimControl::setPrecision(std::wstring&amp; sMeasureValue, double&amp; value, int&amp; precision, bool isAugular)\n{\n    double factor = pow(10, precision);\n    if (isAugular)\n    {\n        value = value \/ PI * 180; \/\/ \u5f27\u5ea6\u8f6c\u89d2\u5ea6\n    }\n    sMeasureValue = std::to_wstring(static_cast&lt;int&gt;(value * factor + 0.51) \/ factor); \/\/ \u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\u3010\u7b97\u6cd5\u5f85\u9a8c\u8bc1\u3011\n    sMeasureValue.erase(sMeasureValue.find_last_not_of(L&#039;0&#039;) + 1, std::wstring::npos); \/\/ \u53bb\u9664\u672b\u5c3e\u591a\u4f59\u7684 0\n    if (sMeasureValue.back() == L&#039;.&#039;) \/\/ \u5982\u679c\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u662f\u5c0f\u6570\u70b9\uff0c\u5219\u5220\u9664\n    {\n        sMeasureValue.pop_back();\n    }\n}\n\nbool DimControl::insertValue(std::wstring&amp; sMeasureValue, std::wstring&amp; sText)\n{\n    static const ACHAR* psPlaceholder = L&quot;&lt;&gt;&quot;;\n    static const size_t placeholderLen = wcslen(psPlaceholder);\n\n    size_t pos = sText.find(psPlaceholder); \/\/ \u67e5\u627e\u5360\u4f4d\u7b26\n    if (pos != std::wstring::npos)\n    {\n        std::wstring sNewText = sText.substr(0, pos);\n        sNewText += sMeasureValue;\n        sNewText += sText.substr(pos + placeholderLen);\n        sText = sNewText;\n        return true;\n    }\n    else\n    {\n        return false;\n    }\n}\n\nvoid DimControl::cbDimNumToText(AcDbDimension* pDimension)\n{\n    static int precision; \/\/ \u7cbe\u5ea6\n    static double measureValue; \/\/ \u6d4b\u91cf\u503c\n    static std::wstring sMeasureValue; \/\/ \u5904\u7406\u540e\u7684\u5b57\u7b26\u4e32\u6d4b\u91cf\u503c\n    static std::wstring sText;\n\n    sText = pDimension-&gt;dimensionText(); \/\/ \u83b7\u53d6\u6587\u5b57\u66ff\u4ee3\n\n    pDimension-&gt;measurement(measureValue); \/\/ \u83b7\u53d6\u6d4b\u91cf\u503c\n\n    if (pDimension-&gt;isA() == AcDb2LineAngularDimension::desc()) \/\/ \u4e24\u7ebf\u89d2\u5ea6\u6807\u6ce8\n    {\n        precision = pDimension-&gt;dimadec(); \/\/ \u83b7\u53d6\u89d2\u5ea6\u7cbe\u5ea6\n        DimControl::setPrecision(sMeasureValue, measureValue, precision, true); \/\/ \u8bbe\u7f6e\u7cbe\u5ea6\n        sMeasureValue = sMeasureValue + L&quot;%%d&quot;;\n    }\n    else\n    {\n        precision = pDimension-&gt;dimdec(); \/\/ \u83b7\u53d6\u7ebf\u6027\u7cbe\u5ea6\n        DimControl::setPrecision(sMeasureValue, measureValue, precision); \/\/ \u8bbe\u7f6e\u7cbe\u5ea6\n        if (pDimension-&gt;isA() == AcDbDiametricDimension::desc()) \/\/ \u76f4\u5f84\u6807\u6ce8\n        {\n            sMeasureValue = L&quot;%%c&quot; + sMeasureValue;\n        }\n        else if (pDimension-&gt;isA() == AcDbRadialDimension::desc()) \/\/ \u534a\u5f84\u6807\u6ce8\n        {\n            sMeasureValue = L&quot;R&quot; + sMeasureValue;\n        }\n        \/\/ \u5176\u5b83\u6807\u6ce8\u4e0d\u505a\u5904\u7406\n    }\n\n    if (sText.length() == 0)\n    {\n        pDimension-&gt;setDimensionText(sMeasureValue.c_str()); \/\/ \u8bbe\u7f6e\u7ed9\u6807\u6ce8\u5bf9\u8c61\n        acutPrintf(L&quot;\u6d4b\u91cf\u503c\uff1a%lf\uff0c\u8bbe\u7f6e\u503c\uff1a%s\\n&quot;, measureValue, sMeasureValue.c_str());\n    }\n    else\n    {\n        bool status = DimControl::insertValue(sMeasureValue, sText);\n        if (status)\n        {\n            pDimension-&gt;setDimensionText(sText.c_str()); \/\/ \u8bbe\u7f6e\u7ed9\u6807\u6ce8\u5bf9\u8c61\n            acutPrintf(L&quot;\u6d4b\u91cf\u503c\uff1a%lf\uff0c\u8bbe\u7f6e\u503c\uff1a%s\\n&quot;, measureValue, sText.c_str());\n        }\n        else\n        {\n            acutPrintf(L&quot;\u7eaf\u6587\u672c\u6807\u6ce8\uff1a%s\uff0c\u4e0d\u505a\u4efb\u4f55\u5904\u7406\u3002\\n&quot;, sText.c_str());\n            return;\n        }\n    }\n}\n\nvoid DimControl::cbResetDim(AcDbDimension* pDimension)\n{\n    pDimension-&gt;setDimensionText(L&quot;&quot;);\n}\n\nvoid DimControl::selectSetForeach(CallbackFun pFun)\n{\n    ads_name ss = { 0, 0 };\n    if (acedSSGet(nullptr, nullptr, nullptr, nullptr, ss) != RTNORM)\n    {\n        acutPrintf(L&quot;\u83b7\u53d6\u9009\u62e9\u96c6\u5931\u8d25\u3002\\n&quot;);\n        return;\n    }\n\n    Adesk::Int32 len = 0;\n    if (acedSSLength(ss, &amp;len) != RTNORM)\n    {\n        acutPrintf(L&quot;\u83b7\u53d6\u9009\u62e9\u96c6\u957f\u5ea6\u5931\u8d25\u3002\\n&quot;);\n        return;\n    }\n\n    for (Adesk::Int32 i = 0; i &lt; len; ++i)\n    {\n        ads_name name = { 0, 0 };\n        acedSSName(ss, i, name);\n\n        AcDbObjectId objId;\n        acdbGetObjectId(objId, name);\n\n        AcDbEntity* pEntity = nullptr;\n        if (acdbOpenObject(pEntity, objId, AcDb::kForWrite) != Acad::eOk) \/\/ \u53ef\u5199\u65b9\u5f0f\u6253\u5f00\n        {\n            continue;\n        }\n\n        if (pEntity-&gt;isKindOf(AcDbDimension::desc()))\n        {\n            AcDbDimension* pDimension = AcDbDimension::cast(pEntity);\n            pFun(pDimension);\n        }\n\n        pEntity-&gt;close();\n    }\n    acedSSFree(ss);\n}\n\nvoid DimControl::lockDim()\n{\n    DimControl::selectSetForeach(DimControl::cbDimNumToText);\n}\n\nvoid DimControl::resetDim()\n{\n    DimControl::selectSetForeach(DimControl::cbResetDim);\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 \u5728\u5236\u4f5c\u673a\u52a0\u5de5\u5de5\u827a\u7684\u65f6\u5019\uff0c\u5b8c\u6210\u7ed8\u56fe\u548c\u6807\u6ce8\u540e\u9700\u8981\u88c5\u8fdb\u4f5c\u4e1a\u6307\u5bfc\u4e66\uff08\u56fe\u6846\u4e2d\uff09\uff0c\u53ef\u80fd\u9700\u8981\u5bf9\u56fe\u5f62\u8fdb\u884c\u7f29\u653e\u64cd\u4f5c\u3002\u7531\u4e8e  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[1,616,589,618,621,593,575],"tags":[],"class_list":["post-16979","post","type-post","status-publish","format-standard","hentry","category-all","category-autocad","category-c-c","category-cad-cam","category-objectarx","category-windows-api","category-575"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/16979","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16979"}],"version-history":[{"count":1,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/16979\/revisions"}],"predecessor-version":[{"id":19626,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/16979\/revisions\/19626"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16979"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}