Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
See the code that obtains the center, then see the screenshot of a sphere (gray wireframe sphere circle) placed at said center. The sphere is not correctly in the center of the view's bounds on the sheet. Ignore the viewport border (from another placed view) that overlaps the screenshot section. I've tried bounding box, crop box, I get the same incorrectly shifted position instead of the exact center of the plan on the sheet.
Note I'm talking about the else clause of the code here (this particular view plan has no scopebox set, so I'm trying to read the bounds of the view itself)
foreach(ElementId id in viewSheet.GetAllPlacedViews())
{
Element element = doc.GetElement(id);
View placedView = (element as View);
Parameter boxParam = placedView.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP);
if(boxParam == null)
{
continue;
}
String boxName = placedView.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).AsValueString();
Element scopeBox = getScopeboxByName(doc, boxName);
XYZ refCenter;
BoundingBoxXYZ bb = null;
double radius = 1.0;
if(scopeBox != null)
{
bb = scopeBox.get_BoundingBox(null);
}
else
{
bb = placedView.get_BoundingBox(null);
}
refCenter = bb.Min.Add(bb.Max.Subtract(bb.Min).Multiply(0.5)); // min + ((max-min)*0.5)
What am I missing here?
Solved! Go to Solution.