diff --git a/src/CADShared/ExtensionMethod/SymbolTableRecordEx.cs b/src/CADShared/ExtensionMethod/SymbolTableRecordEx.cs
index 1c2c1abc5e3000f2abbfc79c6cc440a241033547..c1d07fb8fc06c110015acc952f19c34a2e060a2f 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)
diff --git a/src/CADShared/Initialize/IAutoGo.cs b/src/CADShared/Initialize/IAutoGo.cs
index c9f1d749285af6c9d74f6ea13c0556bf00eeb2ae..b02cfe279480ba99a6397b9c0c04da1885f6f4dc 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") // 通讯库