一、关于块的坐标转换
//以块基点为起点,X轴方向镜像块
using (var plane = new Plane(reference.Position, Vector3d.XAxis.TransformBy(ed.CurrentUserCoordinateSystem))) { reference.TransformBy(Matrix3d.Mirroring(plane)); }
//获取块内除标注外的图元的包围框,注意结果需要按照brf.BlockTransform 属性进行变换
//注意:extend必须初始化,否则变换结果不准确
var btr = brf.BlockTableRecord.GetObject<BlockTableRecord>(); //获取边界包围盒 foreach (var itemId in btr) { var ent = itemId.GetObject(); if (!(ent is RotatedDimension)) extend.AddExtents((ent as Entity).GeometricExtents); if (ent is Circle) HasCircle = true; ent.Dispose(); } extend.TransformBy(brf.BlockTransform);