Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66666

Re: Room Section box

$
0
0

Hii

Yeah that is weird... When I tested your code it created a Call out and not a section ... ??!!

 

 var m_doc = commandData.Application.ActiveUIDocument.Document;
            var m_uidoc = commandData.Application.ActiveUIDocument;

            Reference r = m_uidoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element);

            SpatialElement sp = m_doc.GetElement(r.ElementId) as SpatialElement;

            var box = sp.get_BoundingBox(null);

            using (Transaction t = new Transaction(m_doc, "CreateSection"))
            {
                t.Start();



                ViewFamilyType vftsec
             = new FilteredElementCollector(m_doc)
               .OfClass(typeof(ViewFamilyType))
               .Cast<ViewFamilyType>()
               .FirstOrDefault<ViewFamilyType>(x =>
                 ViewFamily.Section == x.ViewFamily);


                ViewSection section =    ViewSection.CreateDetail(m_doc, vftsec.Id, box);
                


                t.Commit();
            }

Viewing all articles
Browse latest Browse all 66666

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>