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

Re: Try to Create a Callout for Area plan ViewType

$
0
0

Did you figure this out?  I'm also running into the same error.  

 

@jeremy_tammik Yes this is possible in the UI.  In an area plan, use View > Callout, pick two points.  A new area plan view is created that is cropped by the points picked.  

 

public void AreaPlanCallout() { UIDocument uidoc = this.ActiveUIDocument; Document doc = uidoc.Document; // Select areas in UI then run macro List<Area> areas = GetAreasInSelection(uidoc, doc); using (Transaction t = new Transaction(doc, "Create Callouts")) { t.Start(); foreach (var area in areas) { var box = area.get_BoundingBox(doc.ActiveView); var calloutPlan = ViewSection.CreateCallout(doc, doc.ActiveView.Id, doc.ActiveView.GetTypeId(), box.Min, box.Max); } t.Commit(); } } List<Area> GetAreasInSelection(UIDocument uidoc, Document doc) { var areas = new List<Area>(); var selectionIds = uidoc.Selection.GetElementIds().ToList(); foreach (var id in selectionIds) { var elem = doc.GetElement(id); if (elem is Area) { var area = elem as Area; areas.Add(area); } } return areas; }

 


Viewing all articles
Browse latest Browse all 66894

Trending Articles



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