如何在视口上绘制 brep 实体的边界框?
How to draw the bounding box of a brep entity on viewport?
我想绘制所选实体的边界框。我可以通过逐行绘制来完成它,但是,我看到它提供了 BoundingBox 但我无法让它工作。我不确定如何将 box
添加到 theModel
以便绘制。
theModel.SelectionChanged += (s, e) =>
{
foreach(var selecteditem in e.AddedItems)
if(selecteditem.Item is Entity entity)
selectedEntities.Add(entity);
foreach (var selecteditem in e.RemovedItems)
if (selecteditem.Item is Entity entity)
selectedEntities.Remove(entity);
foreach(var ent in selectedEntities)
{
if(ent is Brep brep)
{
brep = (Brep)ent;
var box = new BoundingBox(font, 6666, true, false, brep.BoxMin, brep.BoxMax);
}
}
theModel.Invalidate();
};
BoundingBox class 专为 Model's bounding box settings 而设计。
我想绘制所选实体的边界框。我可以通过逐行绘制来完成它,但是,我看到它提供了 BoundingBox 但我无法让它工作。我不确定如何将 box
添加到 theModel
以便绘制。
theModel.SelectionChanged += (s, e) =>
{
foreach(var selecteditem in e.AddedItems)
if(selecteditem.Item is Entity entity)
selectedEntities.Add(entity);
foreach (var selecteditem in e.RemovedItems)
if (selecteditem.Item is Entity entity)
selectedEntities.Remove(entity);
foreach(var ent in selectedEntities)
{
if(ent is Brep brep)
{
brep = (Brep)ent;
var box = new BoundingBox(font, 6666, true, false, brep.BoxMin, brep.BoxMax);
}
}
theModel.Invalidate();
};
BoundingBox class 专为 Model's bounding box settings 而设计。