Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I want to use PathOFTravel feature in my addin, but view breaks exist that give the "A crop region is enabled in the view. The Path of Travel may not be the optimized route because it is calculating only inside the crop region. ... " error.
I used the following code to remove the view breaks, but it doesn't work.
Does anyone know how to temporarily remove the view breaks and use the PathOfTravel without this annoying warning?
I checked the UI, and it gives the same error, but when I check the route, to me it's good and seems to be the shortest and optimal path. So I was wondering if there is no straightforward solution for the above problem, adding a remove warning command. Any idea?
public static void RemoveCropRegionsInAllViews(Document mydoc)
{
#region Code for making a list of levels on Floor plans
List<View> Floorplans = new FilteredElementCollector(mydoc).OfClass(typeof(View)).WhereElementIsNotElementType().Cast<View>().Where(e => e.ViewType == ViewType.FloorPlan).ToList();
List<ElementId> Levels = new List<ElementId>();
List<View> FloorViews = new List<View>();
try
{
foreach (Element e in Floorplans)
{
if (e is View)
{
View floorview = e as View;
Level floorlevel;
if (floorview.GenLevel == null)
{
continue;
}
else
{
floorlevel = floorview.GenLevel;
bool check = false;
if (!Levels.Contains(floorlevel.Id))
{
Levels.Add(floorlevel.Id);
check = true;
}
if (!floorview.IsTemplate && check == true) //|| !Levels.Contains(floorlevel.Name))
{
FloorViews.Add(floorview);
}
}
}
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
#endregion
using (Transaction t = new Transaction(mydoc, "Remove the croped lines from the view"))
{
t.Start();
foreach (var v in FloorViews)
{
MessageBox.Show("Hi", v.Id.ToString());
ViewCropRegionShapeManager cropedView = v.GetCropRegionShapeManager();
cropedView.RemoveSplit();
}
t.Commit();
}
}
Solved! Go to Solution.
Developer Advocacy and Support +