高亮显示块内长方体上的固定边
您好,我正在努力突出固定框的边缘。
通过一些帖子,GetSubentityPathsAtGraphicsMarker似乎可以完成这项工作
当长方体直接位于模型空间下时,该方法可以很好地工作,因为在这种情况下,该命令将为最后一个参数接受空输入
我现在遇到的问题是,当框位于块下时,返回的SubEntityPath不能包括top Blockreference的id,即使我已经在GetSubentityPathsAtGraphicsMarker的最后一个参数中输入了容器id
返回的SubEntityPathId仍然只有实体本身。因此,当进入高亮显示时,它将抛出一个异常
我现在拥有的代码如下所示
为什么GSMarker像边缘的0x12、0x16?我通过PromptSelectionOption的另一个编码获得了这个数字,它允许我看到单条边的GSMarker
是否有其他替代方法获取GSMarkers
public static void SelectBox()
{
Database db = HostApplicationServices.WorkingDatabase;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
try
{
PromptNestedEntityOptions NEntOpt = new PromptNestedEntityOptions("\nPick a nested entity:");
PromptNestedEntityResult NEntRes = ed.GetNestedEntity(NEntOpt);
if (NEntRes.Status == PromptStatus.OK)
{
Point3d pt = NEntRes.PickedPoint;
Matrix3d mt = NEntRes.Transform;
ObjectId box_id = NEntRes.ObjectId;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
Entity top_ent = null;
if (NEntRes.GetContainers().Length > 0)
top_ent = (Entity)tr.GetObject(NEntRes.GetContainers(), OpenMode.ForRead);
Entity box_ent = (Entity)tr.GetObject(box_id, OpenMode.ForRead);
FullSubentityPath[] ips = box_ent.GetSubentityPathsAtGraphicsMarker(SubentityType.Edge, (IntPtr)0x12, pt, mt, NEntRes.GetContainers());//highlighting a fixed edge with 0x12
if (top_ent!=null)
top_ent.Highlight(ips, false);
else
box_ent.Highlight(ips, false);
tr.Commit();
}
}
}
catch (System.Exception ex)
{
ed.WriteMessage(ex.ToString());
}
}
**** Hidden Message *****
页:
[1]