From 68229c6517d6dfb54072b3ad369f2280307e58c3 Mon Sep 17 00:00:00 2001 From: company-desktop-computer Date: Fri, 30 Oct 2026 21:16:34 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=9F=A5=E8=AF=A2=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=BC=82=E5=BD=A2=E6=9E=84=E7=AD=91=E7=89=A9=EF=BC=88?= =?UTF-8?q?multipart=EF=BC=89+=20=E9=80=A0=E5=9E=8B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=94=BE=E6=A0=B7=E4=BD=93=EF=BC=88loft=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一、AecDbMultiPartEntity 纳入查询白名单 之前 supportedTypeOf() 里没有它,get_aec_entity_detail 报 -32004「不在本插件支持的范围内」, query_aec_entities 也筛不出来(PL_YXGZ 建的实体查不到)。 - 新增类型 multipart;paramsOf 返回 org / x_dir,y_dir,z_dir / shape_count / shapes[{name,type,guid,mode}](造型的尺寸仍用 list_aec_shapes 查) - query_aec_entities 的 type 枚举加上 multipart,描述同步 二、add_aec_shape 支持放样体(shape=loft) 命令的 CreateLoft 是"一级一级选闭合轮廓 + 给层高",工具换成一次给 sections: [ {points:[[x,y],...] 或 diameter, elevation}, ... ] (至少 2 级,自下而上) 每级做成 AcDbRegion(CoreTools::createRegion)→ AcDbX3dSolid::CreateLoft(regs), 与命令一致(要求各级共法向、层高不为 0)。多边形轮廓自动闭合,OCS 标高 = 沿法向投影。 放样体只支持新增,update_aec_shape 明确拒绝(截面没存在实体里,命令的修改分支也是空实现)。 顺带:放样体的 solid 没存 vtZ,list_aec_shapes 的 direction 之前显示 [0,0,0],现在回落到 [0,0,1]。 实测(空图,R230 Debug): - add_aec_multipart → shape=loft(1500x1500 方底 → D600 @2000 → D1500 @3200) → 3D 包围盒 -750~750 / 0~3200; - 再叠 cylinder + subtract(D500,z=3200 往下挖 800)在顶部开口,list_aec_shapes 读到两个部件; - get_aec_entity_detail 能返回 org/三轴/shape_count/shapes;query_aec_entities(type=multipart) total=1。 --- .../Code2026/cad_mcp_aec/aec_mcp_query.cpp | 56 ++++++++- .../cad_mcp_aec/aec_mcp_shape_tools.cpp | 116 ++++++++++++++++-- .../Code2026/cad_mcp_aec/mcp_config.json | 39 +++++- 3 files changed, 194 insertions(+), 17 deletions(-) diff --git a/SourceCode/Code2026/cad_mcp_aec/aec_mcp_query.cpp b/SourceCode/Code2026/cad_mcp_aec/aec_mcp_query.cpp index cc428da..0730093 100644 --- a/SourceCode/Code2026/cad_mcp_aec/aec_mcp_query.cpp +++ b/SourceCode/Code2026/cad_mcp_aec/aec_mcp_query.cpp @@ -20,6 +20,7 @@ #include "AecDbClimbStair.h" #include "AecDbEwFitting.h" #include "AecDbX3dPartEntity.h" +#include "AecDbMultiPartEntity.h" #include "AecDbObjXDataMap.h" using namespace aec_mcp; @@ -35,6 +36,7 @@ const char* kTypeBeam = "beam"; const char* kTypeClimb = "climb_stair"; const char* kTypeFitting = "fitting"; const char* kTypeOpening = "opening"; +const char* kTypeMultiPart = "multipart"; // 异形构筑物(PL_YXGZ) // 实体 -> 五个受支持类型之一;不是这几类返回空串 std::string supportedTypeOf(AcDbEntity* pEnt) @@ -51,6 +53,8 @@ std::string supportedTypeOf(AcDbEntity* pEnt) if (AecDbEwFitting::cast(pEnt)) return kTypeFitting; // 洞口/井/倒角都是这个类,靠专业数据区分;这里统一叫 opening if (AecDbX3dPartEntity::cast(pEnt)) return kTypeOpening; + // 异形构筑物:自己一格,往里加的造型部件由 list_aec_shapes 看 + if (AecDbMultiPartEntity::cast(pEnt)) return kTypeMultiPart; return std::string(); } @@ -60,6 +64,15 @@ bool typeWanted(const std::string& sType, const std::string& sFilter) return sType == sFilter; } +nlohmann::json vecJson(const AcGeVector3d& v) +{ + nlohmann::json o; + o["x"] = v.x; + o["y"] = v.y; + o["z"] = v.z; + return o; +} + nlohmann::json pointJson(const AcGePoint3d& pt) { nlohmann::json o; @@ -82,7 +95,39 @@ nlohmann::json paramsOf(AcDbEntity* pEnt, const std::string& sType) { nlohmann::json p = nlohmann::json::object(); - if (sType == kTypePipe) + if (sType == kTypeMultiPart) + { + AecDbMultiPartEntity* pMp = AecDbMultiPartEntity::cast(pEnt); + if (pMp == NULL) return p; + + const AcGePoint3d ptOrg = pMp->GetOrg(); + p["org"] = pointJson(ptOrg); + p["x_dir"] = vecJson(pMp->GetXDir()); + p["y_dir"] = vecJson(pMp->GetYDir()); + p["z_dir"] = vecJson(pMp->GetZDir()); + + // 部件列表:类型名 + 并/差(造型的尺寸用 list_aec_shapes 查) + nlohmann::json arShapes = nlohmann::json::array(); + const int nCount = pMp->GetX3dPartCount(); + for (int i = 0; i < nCount; ++i) + { + const AecDbX3dPart* pPart = pMp->GetX3dPart(i); + if (pPart == NULL) continue; + nlohmann::json o; + CString sName; + pPart->GetName(sName); + o["name"] = acharToUtf8(sName); + CString sTypeName; + pPart->GetSpecialtyData()->GetAt(_T("DTYG_TYPE"), sTypeName); + o["type"] = acharToUtf8(sTypeName); + o["guid"] = acharToUtf8(pPart->GetGUID()); + o["mode"] = (pPart->GetBoolOperFor() == AcDb::kBoolSubtract) ? "subtract" : "unite"; + arShapes.push_back(o); + } + p["shape_count"] = nCount; + p["shapes"] = arShapes; + } + else if (sType == kTypePipe) { AecDbEwPipe* pPipe = AecDbEwPipe::cast(pEnt); if (pPipe == NULL) return p; @@ -289,9 +334,9 @@ public: std::string private_description() const override { - return "列出当前图纸里本插件支持的 Envi3D 自定义实体(管道/墙/板/柱/梁)," + return "列出当前图纸里本插件支持的 Envi3D 自定义实体(管道/墙/板/柱/梁/爬梯/管件/洞口井/异形构筑物)," "返回 handle、类型、图层、起终点、包围盒。改图之前先用它找 handle。" - "type 可为 pipe/wall/slab/column/beam/all,支持 limit/offset 分页。"; + "type 可为 pipe/wall/slab/column/beam/climb_stair/fitting/opening/multipart/all,支持 limit/offset 分页。"; } nlohmann::json private_input_schema() const override @@ -299,7 +344,7 @@ public: return nlohmann::json::parse(R"({ "type": "object", "properties": { - "type": { "type": "string", "enum": [ "all", "pipe", "wall", "slab", "column", "beam", "climb_stair", "fitting", "opening" ], + "type": { "type": "string", "enum": [ "all", "pipe", "wall", "slab", "column", "beam", "climb_stair", "fitting", "opening", "multipart" ], "description": "要列出的类型,缺省 all" }, "space": { "type": "string", "description": "空间名:Model 或布局名,缺省 Model" }, "limit": { "type": "integer", "description": "最多返回多少条,缺省 200,上限 1000" }, @@ -388,7 +433,8 @@ public: std::string private_description() const override { return "按 handle 取单个 Envi3D 实体的详细参数(类型、图层、起终点、包围盒," - "以及该类型的关键尺寸:管道的 DN/外径/壁厚、墙的厚高标高、板厚、柱截面、梁截面)。"; + "以及该类型的关键尺寸:管道的 DN/外径/壁厚、墙的厚高标高、板厚、柱截面、梁截面、" + "异形构筑物的 Org/三轴/造型部件)。"; } nlohmann::json private_input_schema() const override diff --git a/SourceCode/Code2026/cad_mcp_aec/aec_mcp_shape_tools.cpp b/SourceCode/Code2026/cad_mcp_aec/aec_mcp_shape_tools.cpp index e2bb64a..48d301a 100644 --- a/SourceCode/Code2026/cad_mcp_aec/aec_mcp_shape_tools.cpp +++ b/SourceCode/Code2026/cad_mcp_aec/aec_mcp_shape_tools.cpp @@ -66,6 +66,8 @@ namespace { L"sphere", L"球体", AcDbX3dSolid::kSpere, 1, { "radius" } }, { L"drum", L"球台", AcDbX3dSolid::kDrum, 5, { "radius", "len1", "len2", "start_angle", "end_angle" } }, { L"wedge", L"楔形体", AcDbX3dSolid::kWedge, 3, { "a", "b", "thickness" } }, + // 放样体没有固定尺寸参数,截面由 sections 描述(见 BuildLoftSolid) + { L"loft", L"放样体", AcDbX3dSolid::kLoft, 0, { } }, }; const ShapeSpec* FindShape(const std::wstring& sKey) @@ -134,6 +136,80 @@ namespace return pSolid; } + // 放样体(loft):命令 CreateLoft 是"一级一级选闭合轮廓 + 给层高", + // 工具里换成一次给 sections:[ {diameter, elevation} 或 {points:[[x,y],...], elevation} ] + // 每级沿 direction 抬 elevation,轮廓用 OCS(x/y 就是给定坐标)。 + // shortcut: 放样体不支持 update(AcDbX3dSolid 只存尺寸不存截面),要改就删了重建。 + AcDbX3dSolid* BuildLoftSolid(const nlohmann::json& a, const AcGePoint3d& ptIns, + const AcGeVector3d& vtZ, std::wstring& err) + { + if (!hasKey(a, "sections") || !a["sections"].is_array() || a["sections"].size() < 2) + { + err = L"放样体需要 sections:至少两级截面,每级 {diameter} 或 {points:[[x,y],...]},可选 elevation"; + return NULL; + } + + AcArray regs; + for (size_t i = 0; i < a["sections"].size(); ++i) + { + const nlohmann::json& sec = a["sections"][i]; + const double dEl = sec.contains("elevation") ? sec["elevation"].get() : 0.0; + AcGePoint3d ptSec = ptIns + vtZ * dEl; + + AcDbRegion* pReg = NULL; + if (sec.contains("diameter")) + { + const double dD = sec["diameter"].get(); + if (dD <= 0.0) { err = L"sections[i].diameter 必须 > 0"; break; } + AcDbCircle cir(ptSec, vtZ, 0.5 * dD); + pReg = CoreTools::createRegion(&cir); + } + else if (sec.contains("points") && sec["points"].is_array() && sec["points"].size() >= 3) + { + AcDbPolyline pl((int)sec["points"].size()); + for (size_t j = 0; j < sec["points"].size(); ++j) + { + const nlohmann::json& pt = sec["points"][j]; + if (!pt.is_array() || pt.size() < 2) continue; + pl.addVertexAt((int)j, AcGePoint2d(pt[0].get(), pt[1].get()), 0.0, 0.0, 0.0); + } + pl.setClosed(true); + pl.setNormal(vtZ); + pl.setElevation((ptSec - AcGePoint3d::kOrigin).dotProduct(vtZ)); // OCS 标高 = 沿单位法向的投影 + pReg = CoreTools::createRegion(&pl); + } + + if (pReg == NULL) + { + err = L"第 " + std::to_wstring(i + 1) + L" 级截面生成失败(要不闭合,要不 points 太少)"; + break; + } + regs.append(pReg); + } + + AcDbX3dSolid* pSolid = NULL; + if (err.empty() && regs.length() >= 2) + { + pSolid = new AcDbX3dSolid(); + if (!pSolid->CreateLoft(regs)) + { + delete pSolid; + pSolid = NULL; + err = L"CreateLoft 失败(各级截面得共面于同一法向、并且层高不为 0)"; + } + } + else if (err.empty()) + { + err = L"放样体至少需要 2 级有效截面"; + } + + for (int i = 0; i < regs.length(); ++i) + { + delete regs[i]; + } + return pSolid; + } + // 部件:DTYG_TYPE + BIM 数据(名称/颜色/统计类型)+ 单个 solid,与命令一致 AecDbX3dPart* MakePart(const ShapeSpec& sp, AcDbX3dSolid* pSolid, const std::wstring& sName, int nColor, const AcGePoint3d& ptIns, @@ -266,7 +342,8 @@ namespace if (pSolid != NULL) { const AcGePoint3d ptCenter = pSolid->GetOrgPoint(); - const AcGeVector3d vtZ = pSolid->GetvtZ(); + AcGeVector3d vtZ = pSolid->GetvtZ(); + if (vtZ.length() < 1e-9) vtZ = AcGeVector3d::kZAxis; // 放样体没存 vtZ o["direction"] = { vtZ.x, vtZ.y, vtZ.z }; if (sp != NULL) { @@ -395,7 +472,8 @@ public: "position 是造型的插入点(立方体/圆柱/圆台/球台是底面中心,球体是球底,四方台/楔形体以该点为原点)。" "命令里同一个实体上可以叠很多造型,这里一次加一个,返回 part_guid;改/删/查分别用 " "update_aec_shape / delete_aec_shape / list_aec_shapes。" - "暂时只支持能用 AcDbX3dSolid::Create 造出来的基本体,拉伸/旋转/放样/扫掠/环/切割/异形堰没做。"; + "支持 7 种基本体 + 放样体”(shape=loft,用 sections 给多级截面,命令里是一级一级选轮廓 + 层高)。" + "拉伸/旋转/扫掠/环/切割/异形堰没做。放样体只能新增,不能 update(截面没存在实体里)。"; } nlohmann::json private_input_schema() const override @@ -405,8 +483,8 @@ public: "properties": { "host": { "type": "string", "description": "母体 handle(墙/板/梁/柱/堰/异形构筑物)" }, "shape": { "type": "string", - "enum": [ "box", "cylinder", "cone", "pyramid", "sphere", "drum", "wedge" ], - "description": "box 立方体 length,width,height;cylinder 圆柱 radius,height;cone 圆台 radius_bottom,radius_top,height;pyramid 四方台 top_length,top_width,bottom_length,bottom_width,height,x_offset;sphere 球体 radius;drum 球台 radius,len1,len2,start_angle,end_angle(度);wedge 楔形体 a,b,thickness" }, + "enum": [ "box", "cylinder", "cone", "pyramid", "sphere", "drum", "wedge", "loft" ], + "description": "loft 放样体(用 sections);box 立方体 length,width,height;cylinder 圆柱 radius,height;cone 圆台 radius_bottom,radius_top,height;pyramid 四方台 top_length,top_width,bottom_length,bottom_width,height,x_offset;sphere 球体 radius;drum 球台 radius,len1,len2,start_angle,end_angle(度);wedge 楔形体 a,b,thickness" }, "position": { "type": "array", "items": { "type": "number" }, "description": "插入点 [x,y,z],缺省母体中心" }, "direction": { "type": "array", "items": { "type": "number" }, "description": "造型竖向 [x,y,z],缺省 [0,0,1]" }, "mode": { "type": "string", "enum": [ "unite", "subtract" ], "description": "并/差,缺省 unite" }, @@ -419,7 +497,16 @@ public: "x_offset": { "type": "number" }, "len1": { "type": "number" }, "len2": { "type": "number" }, "start_angle": { "type": "number" }, "end_angle": { "type": "number" }, - "a": { "type": "number" }, "b": { "type": "number" }, "thickness": { "type": "number" } + "a": { "type": "number" }, "b": { "type": "number" }, "thickness": { "type": "number" }, + "sections": { "type": "array", "description": "loft 的各级截面(至少 2 级,自下而上)", "items": { + "type": "object", + "properties": { + "diameter": { "type": "number", "description": "圆形截面直径" }, + "points": { "type": "array", "items": { "type": "array", "items": { "type": "number" } }, + "description": "多边形截面点串 [[x,y],...](自动闭合,坐标相对 position)" }, + "elevation": { "type": "number", "description": "该级沿 direction 的标高,缺省 0" } + } + } } }, "required": [ "host", "shape" ] })"); @@ -443,10 +530,13 @@ public: return errJson(kErrBadParam, L"shape 只支持 box / cylinder / cone / pyramid / sphere / drum / wedge"); } + const bool bLoft = (sp->ePrim == AcDbX3dSolid::kLoft); + double p[6]; InitParams(p); bool bMissing = false; - for (int i = 0; i < sp->nParams; ++i) + for (int i = 0; !bLoft && i < sp->nParams; ++i) + for (int i = 0; !bLoft && i < sp->nParams; ++i) { p[i] = numOr(args, sp->aszParam[i], 0.0); if (sp->aszParam[i] == std::string("x_offset") || @@ -481,7 +571,8 @@ public: AcGeVector3d vtX, vtY; AxesOf(vtZ, vtX, vtY); - AcDbX3dSolid* pSolid = BuildSolid(*sp, p, ptIns, vtZ, err); + AcDbX3dSolid* pSolid = bLoft ? BuildLoftSolid(args, ptIns, vtZ, err) + : BuildSolid(*sp, p, ptIns, vtZ, err); if (pSolid == NULL) { pHost->close(); @@ -657,6 +748,12 @@ public: AcGeVector3d vtZ = pOldSolid->GetvtZ(); AcGePoint3d ptIns = ptCenter; + if (spOld != NULL && spOld->ePrim == AcDbX3dSolid::kLoft) + { + pHost->close(); + return errJson(kErrBadParam, L"放样体不支持改造(截面数据没存在实体里),请 delete_aec_shape 后重建"); + } + // 旧尺寸:按旧种类的参数顺序读出来 double p[6]; InitParams(p); @@ -675,6 +772,11 @@ public: // 新种类:没给就沿用旧的 const ShapeSpec* spNew = spOld; + if (hasKey(args, "shape") && wstrOr(args, "shape", L"") == L"loft") + { + pHost->close(); + return errJson(kErrBadParam, L"造型种类不能改成放样体(改造型按尺寸重建,放样体没有尺寸),请新增一个"); + } if (hasKey(args, "shape")) { spNew = FindShape(wstrOr(args, "shape", L"")); diff --git a/SourceCode/Code2026/cad_mcp_aec/mcp_config.json b/SourceCode/Code2026/cad_mcp_aec/mcp_config.json index a767974..2e01545 100644 --- a/SourceCode/Code2026/cad_mcp_aec/mcp_config.json +++ b/SourceCode/Code2026/cad_mcp_aec/mcp_config.json @@ -1138,7 +1138,8 @@ "beam", "climb_stair", "fitting", - "opening" + "opening", + "multipart" ], "description": "要列出的类型,缺省 all" }, @@ -1164,7 +1165,7 @@ }, { "name": "get_aec_entity_detail", - "description": "按 handle 取单个 Envi3D 实体的详细参数:类型、图层、起终点、包围盒,以及该类型的关键尺寸(管道 DN/外径/壁厚;墙 厚/高/底标高/对齐;板 厚/底标高;柱 高/截面/转角;梁 截面)。", + "description": "按 handle 取单个 Envi3D 实体的详细参数(类型、图层、起终点、包围盒,以及该类型的关键尺寸:管道的 DN/外径/壁厚、墙的厚高标高、板厚、柱截面、梁截面、异形构筑物的 Org/三轴/造型部件列表)。", "inputSchema": { "type": "object", "properties": { @@ -2587,7 +2588,7 @@ }, { "name": "add_aec_shape", - "description": "向墙/板/梁/柱/堰/异形构筑物(AecDbBDPipeBase 派生)加一个几何体(菜单 PL_DTYG 造型设计):创建 AcDbX3dSolid + AecDbX3dPart,按 mode 与母体做并/差运算。尺寸用图纸单位,position 是插入点(立方体/圆柱/圆台/球台为底面中心,球体为球底,四方台/楔形体以该点为原点)。返回 part_guid,配套 list_aec_shapes / update_aec_shape / delete_aec_shape。只支持基本体:拉伸/旋转/放样/扫掠/环/切割/异形堰未做。", + "description": "向墙/板/梁/柱/堰/异形构筑物(AecDbBDPipeBase 派生)加一个几何体(菜单 PL_DTYG 造型设计):创建 AcDbX3dSolid + AecDbX3dPart,按 mode 与母体做并/差运算。尺寸用图纸单位,position 是插入点(立方体/圆柱/圆台/球台为底面中心,球体为球底,四方台/楔形体以该点为原点)。支持 7 种基本体 + 放样体(shape=loft,sections 给多级截面)。返回 part_guid,配套 list_aec_shapes / update_aec_shape / delete_aec_shape(放样体只能新增不能改)。", "inputSchema": { "type": "object", "properties": { @@ -2604,9 +2605,10 @@ "pyramid", "sphere", "drum", - "wedge" + "wedge", + "loft" ], - "description": "box 立方体 length,width,height;cylinder 圆柱 radius,height;cone 圆台 radius_bottom,radius_top,height;pyramid 四方台 top_length,top_width,bottom_length,bottom_width,height,x_offset;sphere 球体 radius;drum 球台 radius,len1,len2,start_angle,end_angle(度);wedge 楔形体 a,b,thickness" + "description": "loft 放样体(用 sections 给多级截面);box 立方体 length,width,height;cylinder 圆柱 radius,height;cone 圆台 radius_bottom,radius_top,height;pyramid 四方台 top_length,top_width,bottom_length,bottom_width,height,x_offset;sphere 球体 radius;drum 球台 radius,len1,len2,start_angle,end_angle(度);wedge 楔形体 a,b,thickness" }, "position": { "type": "array", @@ -2709,6 +2711,33 @@ "thickness": { "type": "number", "description": "楔形体厚度" + }, + "sections": { + "type": "array", + "description": "loft 的各级截面(至少 2 级,自下而上;每级 {diameter} 或 {points:[[x,y],...]},可选 elevation 沿 direction 的标高)", + "items": { + "type": "object", + "properties": { + "diameter": { + "type": "number", + "description": "圆形截面直径" + }, + "points": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "number" + } + }, + "description": "多边形截面点串(自动闭合,坐标相对 position)" + }, + "elevation": { + "type": "number", + "description": "该级沿 direction 的标高,缺省 0" + } + } + } } }, "required": [ -- 2.54.0 From 19207859cc4398e763ee6b06026e59ad5ea7a5fd Mon Sep 17 00:00:00 2001 From: company-desktop-computer Date: Fri, 30 Oct 2026 21:16:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20=E8=A1=A5=E6=94=BE=E6=A0=B7?= =?UTF-8?q?=E4=BD=93=EF=BC=88loft=EF=BC=89=E4=B8=8E=20multipart=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=94=AF=E6=8C=81=E7=9A=84=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=EF=BC=88=C2=A78.7=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sections 的写法与内部实现(Region → CreateLoft),以及"只能新增不能改"的原因; - 查询侧:multipart 现在能 get_aec_entity_detail / query_aec_entities; - 实测里补放样体 + 顶部挖洞的演示数据(包围盒 -750~750 / 0~3200)。 --- cad-mcp-aec.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/cad-mcp-aec.md b/cad-mcp-aec.md index a13a834..7719913 100644 --- a/cad-mcp-aec.md +++ b/cad-mcp-aec.md @@ -514,8 +514,24 @@ pEnt->AddX3dPart(pPart, kBoolUnite 或 kBoolSubtract); // 并 / 挖 | `drum` | 球台 | radius, len1, len2, start_angle, end_angle(度,存弧度) | | `wedge` | 楔形体 | a, b, thickness | -没有做的:拉伸体、旋转体、放样体、扫掠体、环体(圆/方/异形截面)、切割、异形堰 —— -它们要么要先选曲线/面域,要么要在实体上拾面,属于另一类交互,需要时再单独加。 +**放样体**(`shape=loft`)也支持了:命令是"一级一级选闭合轮廓 + 给层高", +工具换成一次给 `sections`: + +```json +"sections": [ + { "points": [[-750,-750],[750,-750],[750,750],[-750,750]], "elevation": 0 }, + { "diameter": 600, "elevation": 2000 }, + { "diameter": 1500, "elevation": 3200 } +] +``` + +每级要么 `diameter`(圆)要么 `points`(多边形,自动闭合),`elevation` 是沿 `direction` 的标高。 +内部把每级做成 `AcDbRegion`(`CoreTools::createRegion`)再 `AcDbX3dSolid::CreateLoft(regs)`, +与命令的 `CreateLoft()` 一致(要求各级共法向、层高不为 0)。 +放样体**只能新增不能改** —— 截面数据没有存在实体里(命令的"修改"分支对放样体也是空实现)。 + +没有做的:拉伸体、旋转体、扫掠体、环体(圆/方/异形截面)、切割、异形堰 —— +它们要么要先选曲线,要么要在实体上拾面,属于另一类交互,需要时再单独加。 **工具与命令的三处差别**: @@ -531,6 +547,9 @@ pEnt->AddX3dPart(pPart, kBoolUnite 或 kBoolSubtract); // 并 / 挖 **实测**(R230 Debug,pcf_1.dwg): +- 空图里 `add_aec_multipart` → `shape=loft`(1500×1500 方底 → D600 圆 @2000 → D1500 圆 @3200) + → 3D 包围盒 −750~750 / 0~3200,然后再叠一个 `cylinder + subtract`(D500、从 z=3200 往下 800) + 在顶上开口,`list_aec_shapes` 读到两个部件(放样体 unite、圆柱 subtract); - 墙(6000×3000,厚 300)上在 z=3000 加一个 800×300×1000 的立方体 → 母体 3D 包围盒 z 从 0~3000 变成 **0~4000**,说明造型真的并进去了; - 同一面墙上 `cylinder` + `mode=subtract`(D600、高 1200)作为预留洞,`list_aec_shapes` @@ -541,6 +560,11 @@ pEnt->AddX3dPart(pPart, kBoolUnite 或 kBoolSubtract); // 并 / 挖 - 改造型:`height` 1200→2400、`radius` 300→450 且 `mode` subtract→unite、改名,均生效; `delete_aec_shape` 单删 1 个、不传 `part_guid` 全删(返回 removed=N)都正常。 +**查询侧也补上了**:`AecDbMultiPartEntity` 之前不在 `aec_mcp_query.cpp` 的 +`supportedTypeOf()` 白名单里,`get_aec_entity_detail` 会报 -32004、`query_aec_entities` +也筛不出来。现在它是独立一类 `multipart`,详情返回 `org` / `x_dir,y_dir,z_dir` / +`shape_count` / `shapes[{name,type,guid,mode}]`,图纸里所有异形构筑物可以一次列出来。 + **API 索引**(都在 `CoreLibrary` / `inc`): `AcDbX3dSolid::Create / GetSolidData / GetOrgPoint / GetvtZ / GetCentoridPoint`、 `AecDbX3dPart::AddX3dSolid / SetOrgPoint / SetAxis / SetName / setBimDatas`、 -- 2.54.0