public void Oversized() { UIDocument uidoc = this.ActiveUIDocument; Document doc = uidoc.Document; Reference vpRef = uidoc.Selection.PickObject(ObjectType.Element, "Select VP"); Viewport vp = doc.GetElement(vpRef) as Viewport; // double scale = 304.8; XYZ center = new XYZ(432/scale,305/scale,0); double width = 864/scale; double height = 482/scale; XYZ minPt = new XYZ(center.X-width/2, center.Y-height/2,0); XYZ maxPt = new XYZ(center.X+width/2, center.Y+height/2,0); Outline sheetOutline = new Outline(minPt, maxPt); //assumed titleblock size 823x532 DrawRectangle(doc, doc.ActiveView, maxPt, minPt); // // List vpOutline = new List(); // vpOutline.Add(vp.GetBoxOutline()); // // Outline viewportOutline = vp.GetBoxOutline(); // // View pView = doc.GetElement(vp.ViewId) as View; try{ //BoundingBoxXYZ bbox = vp.GetBoxOutline(); //Outline viewportOutline = new Outline(bbox.Min, bbox.Max); Outline viewportOutline = vp.GetBoxOutline(); DrawRectangle(doc, doc.ActiveView, viewportOutline.MinimumPoint, viewportOutline.MaximumPoint); XYZ vpMinPoint = viewportOutline.MinimumPoint; XYZ vpMaxPoint = viewportOutline.MaximumPoint; XYZ newMin = new XYZ(vpMinPoint.X, vpMinPoint.Y, 0); XYZ newMax = new XYZ(vpMaxPoint.X, vpMinPoint.Y, 0); StringBuilder sb = new StringBuilder(); if (sheetOutline.Contains(newMin,0) && sheetOutline.Contains(newMax,0)){ TaskDialog.Show("re", "Not intersect"); } else{ TaskDialog.Show("re", "Intersect"); } } catch(Exception ex){ TaskDialog.Show("R", ex.Message); } // XYZ vpMinPoint = viewportOutline.MinimumPoint; // XYZ vpMaxPoint = viewportOutline.MaximumPoint; // // XYZ newMin = new XYZ(vpMinPoint.X, vpMinPoint.Y, 0); // XYZ newMax = new XYZ(vpMaxPoint.X, vpMinPoint.Y, 0); // // StringBuilder sb = new StringBuilder(); // // if (sheetOutline.Contains(newMin,0) && sheetOutline.Contains(newMax11,0)){ // TaskDialog.Show("re", "Not intersect"); // } // else{ // TaskDialog.Show("re", "Intersect"); // } //TaskDialog.Show("re", Points(sheetOutline)+"\n"+Points(vp.GetBoxOutline())); }