Set View Section Box to Match Scope Box - error pls explain

Set View Section Box to Match Scope Box - error pls explain

Anonymous
Not applicable
1,138 Views
2 Replies
Message 1 of 3

Set View Section Box to Match Scope Box - error pls explain

Anonymous
Not applicable

Hi,

 

Ive use and test Jeremy's code here

http://thebuildingcoder.typepad.com/blog/2012/08/set-view-section-box-to-match-scope-box.html

and got several errors. I managed to fix some of it but I don't understand what I need to do with this .

 

setsectionboxerror.png

0 Likes
1,139 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Hi Akosi,

 

Autodesk.Revit.DB.View3D.SectionBox was removed in the 2015 API changes, see the documents > HERE < for information/full list of changes.

 

You can now use the SetSectionBox method, which also takes a BoundingBoxXYZ.  The documentation for this method is accessible > HERE <.

 

That should get you going, good luck!

 


Cheers,

Adam

 

 

0 Likes
Message 3 of 3

Anonymous
Not applicable

Refer here for corrected code:

 

http://thebuildingcoder.typepad.com/blog/2013/10/set-view-section-box-to-match-scope-box-for-revit-2...

 

 

this is code to create a new view:

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) {
            Autodesk.Revit.DB.Document doc = commandData.Application.ActiveUIDocument.Document;
            UIDocument uidoc = commandData.Application.ActiveUIDocument;

            ISelectionFilter iselfilterScopeBox = new ScopeBoxesSelectionFilter();
            Element eScopeBox = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element, iselfilterScopeBox, "Please select a Section Box"));

            View3D view3DCurrent = doc.ActiveView as View3D;
            if (view3DCurrent == null) {
                TaskDialog.Show("XXX", "Please use this command in a 3D view.");
                return Result.Failed;
            }

            BoundingBoxXYZ bbXYZScopeBox = GetSectionBoundingBoxFromScopeBox(eScopeBox, view3DCurrent.ViewDirection);
            ViewOrientation3D vieworientation3D = view3DCurrent.GetOrientation();
            using (Transaction t = new Transaction(doc, "Create View")) {
                t.Start();
                ViewFamilyType viewFamilyType = (from v in new FilteredElementCollector(doc).OfClass(typeof(ViewFamilyType)).Cast<ViewFamilyType>()
                                                 where v.ViewFamily == ViewFamily.ThreeDimensional
                                                 select v).First();
                View3D view3DNew = View3D.CreateIsometric(doc, viewFamilyType.Id);
                view3DNew.SetOrientation(vieworientation3D);
                view3DNew.SetSectionBox(bbXYZScopeBox);
                t.Commit();
                uidoc.ActiveView = view3DNew;
            }

            return Result.Succeeded;
        }

 

 

0 Likes