- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I have a few hundred planviews evry month and I want to make a 3D view with a sectionsbox with the same min and max as the crop in the plan view
I have got the level from the planview XYZ base as the Zmin in the Sectionbox, and then adding 9' to the max.
The creation of the perspectiv 3Dview and the sectionsbox XY min/max works OK, but the Z value isn't right
I am also trying to set the eye and target elevation, using the XYZ eye and XYZ up, but it I got the wrong values in the model
placed in the middle of the sectionbox.
But I get the wrong values, what do I do vrong ??
My code look like this
if ( . . . . . . .)
{
View_Code = ViewCODE.AsString();
BoundingBoxXYZ View_BB = viewElements.get_BoundingBox(viewElements);
XYZ BBMin = View_BB.Min;
XYZ BBMax = View_BB.Max;
XYZ Base = new XYZ(viewElements.Origin.X,viewElements.Origin.Y,viewElements.Origin.Z);
XYZ SecBMin = new XYZ(BBMin.X, BBMin.Y, Base.Z);
XYZ SecBMax = new XYZ(BBMax.X, BBMax.Y, Base.Z + 9.055);
ViewFamilyType viewFamilyType = (from v in new FilteredElementCollector(mainDocument).
OfClass(typeof(ViewFamilyType)).
Cast<ViewFamilyType>()
where v.ViewFamily == ViewFamily.ThreeDimensional
select v).First();
using (Transaction t = new Transaction(mainDocument, "Create view"))
{
t.Start();
View3D view = View3D.CreatePerspective(mainDocument, viewFamilyType.Id);
view.Name = viewElements.Name;
ViewCODE = view.get_Parameter("Drawing type");
ViewCODE.Set("Housing No");
BoundingBoxXYZ newSectionBox = new BoundingBoxXYZ();
newSectionBox.Min = SecBMin;
newSectionBox.Max = SecBMax;
view.SetSectionBox(newSectionBox);
XYZ eye = new XYZ((SecBMin.X + SecBMax.X) / 2, (SecBMin.Y + SecBMax.Y) / 2, 80);
XYZ up = new XYZ((SecBMin.X + SecBMax.X) / 2, (SecBMin.Y + SecBMax.Y) / 2, 0);
XYZ forward = new XYZ(0, 0, -1);
view.SetOrientation(new ViewOrientation3D(eye, up, forward));
view.get_Parameter(BuiltInParameter.MODEL_GRAPHICS_STYLE).Set(4);
view.ViewTemplateId = viewTemp.Id;
t.Commit();
}
Regards Anders
Solved! Go to Solution.
