{"id":19786,"date":"2025-04-05T17:48:41","date_gmt":"2025-04-05T09:48:41","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=19786"},"modified":"2025-04-06T09:15:22","modified_gmt":"2025-04-06T01:15:22","slug":"objectarx-2025%ef%bc%88c%ef%bc%89%e6%b7%bb%e5%8a%a0%e8%87%aa%e5%ae%9a%e4%b9%89%e5%9d%97","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=19786","title":{"rendered":"ObjectARX 2025\uff08C++\uff09\u521b\u5efa\u5757\u5b9a\u4e49"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 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=19786\/#%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-2\" href=\"https:\/\/blog.iyatt.com\/?p=19786\/#%E5%AE%9E%E7%8E%B0\" >\u5b9e\u73b0<\/a><\/li><\/ul><\/nav><\/div>\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\uff08ISO C++14\uff09<\/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><\/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>CreateBlock.hpp<\/p>\n<pre><code class=\"language-cpp\">#pragma once\nclass CreateBlock\n{\npublic:\n    static void work();\n};<\/code><\/pre>\n<p>CreateBlock.cp<\/p>\n<pre><code class=\"language-cpp\">#include &quot;stdafx.h&quot;\n#include &quot;CreateBlock.hpp&quot;\n\nvoid CreateBlock::work()\n{\n    \/\/ \u83b7\u53d6\u6570\u636e\u5e93\u5757\u8868\n    AcDbBlockTable* pBlockTable = nullptr;\n    acdbHostApplicationServices()-&gt;workingDatabase()-&gt;getBlockTable(pBlockTable, AcDb::kForWrite);\n\n    \/\/ \u521b\u5efa\u65b0\u7684\u5757\u8868\u8bb0\u5f55\n    AcDbBlockTableRecord* pBlockTableRecord = new AcDbBlockTableRecord();\n\n    \/\/ \u7528\u6237\u8f93\u5165\u5757\u540d\u79f0\n    AcString blockName;\n    if (acedGetString(Adesk::kFalse, L&quot;\\n\u8bf7\u8f93\u5165\u56fe\u5757\u540d\u79f0&quot;, blockName) != RTNORM)\n    {\n        pBlockTable-&gt;close();\n        delete pBlockTableRecord;\n        return;\n    }\n    pBlockTableRecord-&gt;setName(blockName.kACharPtr());\n\n    \/\/ \u5c06\u5757\u8868\u8bb0\u5f55\u6dfb\u52a0\u5230\u5757\u8868\u4e2d\n    pBlockTable-&gt;add(pBlockTableRecord);\n    pBlockTable-&gt;close();\n\n    \/\/ \u5411\u5757\u8bb0\u5f55\u4e2d\u6dfb\u52a0\u5b9e\u4f53\n    AcGePoint3d startPt1(-20, 0, 0), endPt1(20, 0, 0); \/\/ \u7b2c\u4e00\u6761\u7ebf\n    AcDbLine* pLine1 = new AcDbLine(startPt1, endPt1);\n    AcGePoint3d startPt2(0, -20, 0), endPt2(0, 20, 0); \/\/ \u7b2c\u4e8c\u6761\u7ebf\n    AcDbLine* pLine2 = new AcDbLine(startPt2, endPt2);\n    AcDbCircle* pCircle = new AcDbCircle(AcGePoint3d::kOrigin, AcGeVector3d(0, 0, 1), 10); \/\/ \u5706\n\n    pBlockTableRecord-&gt;appendAcDbEntity(pLine1);\n    pBlockTableRecord-&gt;appendAcDbEntity(pLine2);\n    pBlockTableRecord-&gt;appendAcDbEntity(pCircle);\n\n    pLine1-&gt;close();\n    pLine2-&gt;close();\n    pCircle-&gt;close();\n    pBlockTableRecord-&gt;close();\n}<\/code><\/pre>\n<p>\u5728 acrxEntryPoint.cpp \u4e2d\u5f15\u7528\u5934\u6587\u4ef6\uff0c\u5e76\u5728 On_kInitAppMsg \u65b9\u6cd5\u91cc\u8c03\u7528<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/04\/image-1743846374745.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 862px; --smush-placeholder-aspect-ratio: 862\/540;\" \/><\/p>\n<p>\u542f\u52a8\u8c03\u8bd5\u8fd0\u884c\uff0c\u8bbe\u7f6e\u5757\u540d\u79f0<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/04\/image-1743842149088.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 248px; --smush-placeholder-aspect-ratio: 248\/85;\" \/><\/p>\n<p>\u6309<code class=\"kb-btn\">Ctrl<\/code>+<code class=\"kb-btn\">F1<\/code>\u6253\u5f00<strong>\u8bbe\u8ba1\u4e2d\u5fc3<\/strong>\uff0c\u5de6\u4fa7\u70b9\u5f00<strong>\u5757<\/strong>\uff0c\u5728\u91cc\u9762\u5c31\u53ef\u4ee5\u770b\u5230\u521a\u624d\u521b\u5efa\u7684\u5757\u201d\u6211\u7684\u5757\u201c\uff0c\u53ef\u4ee5\u70b9\u51fb\u62d6\u52a8\u5b83\u5230\u4fa7\u9762\u7684\u7ed8\u56fe\u533a\u57df<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/04\/image-1743842459238.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 936px; --smush-placeholder-aspect-ratio: 936\/428;\" \/><\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2025\/04\/image-1743842558777.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 479px; --smush-placeholder-aspect-ratio: 479\/602;\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883 AutoCAD \u673a\u68b0\u7248 2025 ObjectARX 2025 VS 2022\uff08ISO C++14\uff09 \u73af [&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],"tags":[],"class_list":["post-19786","post","type-post","status-publish","format-standard","hentry","category-all","category-autocad","category-c-c","category-cad-cam","category-objectarx"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/19786","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=19786"}],"version-history":[{"count":5,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/19786\/revisions"}],"predecessor-version":[{"id":19821,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/19786\/revisions\/19821"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}