Reputation: 1
I try to create a SectionView out of FloorPlan. The viewing direction is from above, actually the same as in the FloorPlan. The SectionView created is mirrored:
Here is my code:
//uiapp is UIApplication, ass is input assembley, danglerad is input angle radian
FamilyInstance fibox = GetPlaceholderBoxFromAssembly(uiapp, ass);
double dw = bbox.Max.Subtract(bbox.Min).X;
double dd = bbox.Max.Subtract(bbox.Min).Y;
double dh = bbox.Max.Subtract(bbox.Min).Z;
snameprefix = "up";
max_pt = new XYZ(dw, dd, dh);
min_pt = new XYZ(-dw, -dd, -dh);
bbox.Max = max_pt;
bbox.Min = min_pt;
trans = Autodesk.Revit.DB.Transform.CreateRotation(XYZ.BasisZ, danglerad);
trans.Origin = mid_pt;
try
{
bbox.Transform = trans;
}
catch { }
using (Transaction tr = new Transaction(uiapp.ActiveUIDocument.Document, "CreateSecPlan"))
{
tr.Start();
viewsec = ViewSection.CreateSection(uiapp.ActiveUIDocument.Document, viewfamtypeid, bbox);
viewsec.Name += $"_{ass.Name}_{snameprefix}";
viewsec.DisplayStyle = DisplayStyle.HLR;
viewsec.DetailLevel = ViewDetailLevel.Fine;
viewsec.ViewTemplateId = templid;
viewsec.Scale = iscale;
viewsec.get_Parameter(BuiltInParameter.SECTION_COARSER_SCALE_PULLDOWN_METRIC).Set(1);
tr.Commit();
}
using (Transaction t3 = new Transaction(uiapp.ActiveUIDocument.Document, "MirrorView"))
{
t3.Start();
Plane pln = Plane.CreateByNormalAndOrigin(viewsec.ViewDirection, viewsec.Origin);
ElementTransformUtils.MirrorElements(uiapp.ActiveUIDocument.Document, new List<ElementId> { viewsec.Id }, pln, false);
t3.Commit();
}
Can anyone tell me, what's wrong here?
I've also tried: viewsec = ViewSection.CreateDetail(uiapp.ActiveUIDocument.Document, viewfamtypeid, bbox); and view's CropBoxElement mirroring. Both to no avail.
Upvotes: 0
Views: 29