Hatch là một tính năng của Profile View trong Civil3D. Hatch thể hiện rõ vùng đào, đắp được giới hạn giữa đường tự nhiên và đường thiết kế trên trắc dọc.
Thuộc tính Hatch được lấy ra trong ProfileView với tên gọi là HatchAreas. Mình xin chia sẻ 1 đoạn code sau cách lấy ra kiểu hatch và loại Hatch trên ProfileView:
[CommandMethod(“ProfileHatching”)]
public static void ProfileHatchings()
{
using (acad.DocumentLock acLock = doc.LockDocument())
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
// Chọn ProfileView
PromptEntityOptions _ent = new PromptEntityOptions(“\n- Chọn ProfileView:”);
_ent.SetRejectMessage(“\n- Chọn ProfileView”);
_ent.AddAllowedClass(typeof(ProfileView), true);
PromptEntityResult _ents = ed.GetEntity(_ent);
if (_ents.Status != PromptStatus.OK) return;
ObjectId _id = _ents.ObjectId;
ProfileView _pro = tr.GetObject(_id, OpenMode.ForRead) as ProfileView;
foreach (ProfileHatchArea _hatch in _pro.HatchAreas)
{
ed.WriteMessage(” Hatch: ” + _hatch.Name + ” Kiểu Hatch ” + _hatch.ShapeStyleName + “\n”);
}
tr.Commit();
}
}
}
Chúc các bạn thành công!