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(); }