- 积分
- 85
- 明经币
- 个
- 注册时间
- 2023-1-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
各位老师好,为什么我用以下代码生成的填充,填充却没有面积属性?
public class TEST02
{
[CommandMethod("CGE")]
[Obsolete]
public void ChangeHatch()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
ObjectIdCollection ids = new ObjectIdCollection();
using (DocumentLock @lock = doc.LockDocument())
{
using (Transaction trans = doc.TransactionManager.StartTransaction())
{
BlockTable blk = trans.GetObject(doc.Database.BlockTableId, OpenMode.ForWrite) as BlockTable;
BlockTableRecord space = trans.GetObject(blk[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
Circle circle = new Circle();
circle.Radius = 5000;
circle.Center = new Point3d(0, 0, 0);
space.AppendEntity(circle);
trans.AddNewlyCreatedDBObject(circle, true);
trans.Commit();
ids.Add(circle.Id);
}
}
if (ids.Count > 0)
{
using (DocumentLock @lock = doc.LockDocument())
{
using (Transaction trans = doc.TransactionManager.StartTransaction())
{
BlockTable blk = trans.GetObject(doc.Database.BlockTableId, OpenMode.ForWrite) as BlockTable;
BlockTableRecord space = trans.GetObject(blk[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
// 生成新填充图案--------------
Hatch hatch = new Hatch();
hatch.HatchObjectType = HatchObjectType.HatchObject;
// hatch.HatchStyle = HatchStyle.Outer;
hatch.PatternAngle = 0;
hatch.PatternScale = 200;
hatch.Layer = "0";
hatch.SetHatchPattern(HatchPatternType.PreDefined, "ANGLE");
hatch.ColorIndex = 2;
// hatch.Associative = true;
space.AppendEntity(hatch);
trans.AddNewlyCreatedDBObject(hatch, true);
hatch.AppendLoop(HatchLoopTypes.Outermost, ids);////图案添加边界环
hatch.EvaluateHatch(true);
trans.Commit();
}
}
}
}
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|