From 13616d682da5272335d2b59026e587c13e86312f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=A3Sir?= <121106945@qq.com> Date: Tue, 31 Mar 2026 13:57:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=97=B6=EF=BC=8C=E7=89=B9=E6=80=A7IFoxIniti?= =?UTF-8?q?alize=E5=8F=8A=E6=8E=A5=E5=8F=A3IFoxAutoGo=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E5=B7=A5=E4=BD=9C=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CADShared/Initialize/IAutoGo.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CADShared/Initialize/IAutoGo.cs b/src/CADShared/Initialize/IAutoGo.cs index c9f1d749..b02cfe27 100644 --- a/src/CADShared/Initialize/IAutoGo.cs +++ b/src/CADShared/Initialize/IAutoGo.cs @@ -1,4 +1,4 @@ -namespace IFoxCAD.Cad; +namespace IFoxCAD.Cad; using System.Diagnostics; @@ -184,7 +184,10 @@ public static void AppDomainGetTypes(Action action, string? dllNameWithout { // 获取类型集合,反射时候还依赖其他的dll就会这个错误 // 此通讯库要跳过,否则会报错. - var location = Path.GetFileNameWithoutExtension(assembly.Location); + var assemblyLocation = assembly.Location; + var location = !string.IsNullOrEmpty(assemblyLocation) + ? Path.GetFileNameWithoutExtension(assemblyLocation) + : assembly.GetName().Name; if (dllNameWithoutExtension != null && location != dllNameWithoutExtension) continue; if (location == "AcInfoCenterConn") // 通讯库 -- Gitee From ffe2790d950e6d8b5130b186af1c1338ac32a30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=A3Sir?= <121106945@qq.com> Date: Wed, 20 May 2026 10:52:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=89=A9=E5=B1=95InsertBlock=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E6=96=B0=E5=A2=9Eprops=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E8=AE=BE=E7=BD=AE=E5=8A=A8=E6=80=81=E5=9D=97?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=96=B0=E5=A2=9Eaction=E5=A7=94?= =?UTF-8?q?=E6=89=98=E7=94=A8=E4=BA=8E=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9D=97?= =?UTF-8?q?=E5=8F=82=E7=85=A7=E5=88=9D=E5=A7=8B=E5=8C=96=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=EF=BC=8C=E5=AE=8C=E5=96=84=E5=9D=97=E6=8F=92=E5=85=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E7=81=B5=E6=B4=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExtensionMethod/SymbolTableRecordEx.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/CADShared/ExtensionMethod/SymbolTableRecordEx.cs b/src/CADShared/ExtensionMethod/SymbolTableRecordEx.cs index 1c2c1abc..c1d07fb8 100644 --- a/src/CADShared/ExtensionMethod/SymbolTableRecordEx.cs +++ b/src/CADShared/ExtensionMethod/SymbolTableRecordEx.cs @@ -223,12 +223,16 @@ public static DrawOrderTable GetDrawOrderTable(this BlockTableRecord btr, /// 块插入比例,默认为1 /// 块插入旋转角(弧度),默认为0 /// 属性字典{Tag,Value},默认为null + /// 动态属性字典{Tag,Value},默认为null + /// 块参照设置委托,默认为null /// 块参照对象id public static ObjectId InsertBlock(this BlockTableRecord blockTableRecord, Point3d position, string blockName, Scale3d scale = default, double rotation = default, - Dictionary? atts = null) + Dictionary? atts = null, + Dictionary? props = null, + Action? action = null) { var tr = DBTrans.GetTop(blockTableRecord.Database); if (!tr.BlockTable.Has(blockName)) @@ -237,7 +241,7 @@ public static ObjectId InsertBlock(this BlockTableRecord blockTableRecord, Point return ObjectId.Null; } - return blockTableRecord.InsertBlock(position, tr.BlockTable[blockName], scale, rotation, atts); + return blockTableRecord.InsertBlock(position, tr.BlockTable[blockName], scale, rotation, atts, props, action); } /// @@ -249,13 +253,17 @@ public static ObjectId InsertBlock(this BlockTableRecord blockTableRecord, Point /// 块插入比例,默认为1 /// 块插入旋转角(弧度),默认为0 /// 属性字典{Tag,Value},默认为null + /// 动态属性字典{Tag,Value},默认为null + /// 块参照设置委托,默认为null /// 块参照对象id public static ObjectId InsertBlock(this BlockTableRecord blockTableRecord, Point3d position, ObjectId blockId, Scale3d scale = default, double rotation = default, - Dictionary? atts = null) + Dictionary? atts = null, + Dictionary? props = null, + Action? action = null) { //trans ??= DBTrans.Top.Transaction; var tr = DBTrans.GetTop(blockTableRecord.Database); @@ -277,6 +285,14 @@ public static ObjectId InsertBlock(this BlockTableRecord blockTableRecord, if (blockRef.Annotative == AnnotativeStates.True) blockRef.AddContext(occ.CurrentContext); + // ★ 新增:动态块属性设置 + if (props is not null) + { + blockRef.ChangeBlockProperty(props); + } + // ★ 新增:执行块参照设置委托 + action?.Invoke(blockRef); + var btr = tr.GetObject(blockRef.BlockTableRecord)!; if (!btr.HasAttributeDefinitions) -- Gitee