Skip to content

Commit

Permalink
update revision clouds in drafting views
Browse files Browse the repository at this point in the history
  • Loading branch information
giobel committed Aug 16, 2021
1 parent 8337453 commit 9a1afd2
Showing 1 changed file with 44 additions and 27 deletions.
71 changes: 44 additions & 27 deletions ReviTab/Buttons Tools/RevCloudsSelected.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,41 +92,47 @@ public Result Execute(

t.Start("Hide Categories");

elementView.IsolateCategoriesTemporary(categoryToIsolate);

//Use the annotation crop region to find the view centroid
ViewCropRegionShapeManager vcr = elementView.GetCropRegionShapeManager();
//Set the annotation offset to the minimum (3mm)
vcr.BottomAnnotationCropOffset = 3 / 304.8;
vcr.TopAnnotationCropOffset = 3 / 304.8;
vcr.LeftAnnotationCropOffset = 3 / 304.8;
vcr.RightAnnotationCropOffset = 3 / 304.8;
//Get the Viewport Center. This will match the View centroid
changedVPcenter = viewport.GetBoxCenter();

//Find the view centroid using the annotation crop shape (it should always be a rectangle, while the cropbox shape can be a polygon).
CurveLoop cloop = vcr.GetAnnotationCropShape();
List<XYZ> pts = new List<XYZ>();

foreach (Curve crv in cloop)
if (elementView.ViewType != ViewType.DraftingView)
{
pts.Add(crv.GetEndPoint(0));
pts.Add(crv.GetEndPoint(1));
elementView.IsolateCategoriesTemporary(categoryToIsolate);
//Use the annotation crop region to find the view centroid
ViewCropRegionShapeManager vcr = elementView.GetCropRegionShapeManager();
//Set the annotation offset to the minimum (3mm)
vcr.BottomAnnotationCropOffset = 3 / 304.8;
vcr.TopAnnotationCropOffset = 3 / 304.8;
vcr.LeftAnnotationCropOffset = 3 / 304.8;
vcr.RightAnnotationCropOffset = 3 / 304.8;

//Find the view centroid using the annotation crop shape (it should always be a rectangle, while the cropbox shape can be a polygon).
CurveLoop cloop = vcr.GetAnnotationCropShape();

foreach (Curve crv in cloop)
{
pts.Add(crv.GetEndPoint(0));
pts.Add(crv.GetEndPoint(1));
}

//View centroid with elements hidden
viewCenter = GetCentroid(pts, pts.Count);
}
else
{
//TaskDialog.Show("r", "View type is drafting");
viewCenter = uidoc.Selection.PickPoint();

//pts.Add(uidoc.Selection.PickPoint());
}

//View centroid with elements hidden
viewCenter = GetCentroid(pts, pts.Count);
//Get the Viewport Center. This will match the View centroid
changedVPcenter = viewport.GetBoxCenter();

t.RollBack();


int scale = elementView.Scale;






//VIEWPORT CENTER
//XYZ vpMax = viewport.GetBoxOutline().MaximumPoint;
//XYZ vpMin = viewport.GetBoxOutline().MinimumPoint;
Expand Down Expand Up @@ -174,6 +180,13 @@ public Result Execute(
viewCenter = ProjectOnto(p, viewCenter);
//doc.Create.NewDetailCurve(doc.ActiveView, Line.CreateBound(pt1, pt3));
}
else if (doc.ActiveView.ViewType == ViewType.DraftingView)
{
Plane p = Plane.CreateByNormalAndOrigin(XYZ.BasisZ, XYZ.Zero);
pt1 = ProjectOnto(p, pt1);
pt3 = ProjectOnto(p, pt3);
viewCenter = ProjectOnto(p, viewCenter);
}
else
{
//TaskDialog.Show("r", "Not a plan view!");
Expand Down Expand Up @@ -224,6 +237,10 @@ public Result Execute(
{
moveToViewLocation = new XYZ(-xOffset, -yOffset, 0);
}
else if (doc.ActiveView.ViewType == ViewType.DraftingView)
{
moveToViewLocation = new XYZ(-xOffset, -yOffset, 0);
}
else //IF IT IS A SECTION
{
moveToViewLocation = new XYZ(yOffset, -zOffset, -xOffset);
Expand All @@ -241,15 +258,15 @@ public Result Execute(
//doc.Create.NewDetailCurve(doc.ActiveView, l);

//BBOX CENTER TO VIEW CENTER
//doc.Create.NewDetailCurve(doc.ActiveView, Line.CreateBound(viewCenter, bboxCenter));
doc.Create.NewDetailCurve(doc.ActiveView, Line.CreateBound(viewCenter, bboxCenter));

// SHEET 0,0,0 TO VIEWPORT CENTER
//doc.Create.NewDetailCurve(selectedViewSheet, Line.CreateBound(XYZ.Zero, new XYZ(changedVPcenter.X, changedVPcenter.Y, 0)));

//VIEWPORT CENTRE
//viewport.GetBoxCenter()
//doc.Create.NewDetailCurve(selectedViewSheet, Line.CreateBound(new XYZ(0,0,0), FlattenPoint(vpCen)));
//doc.Create.NewDetailCurve(selectedViewSheet, Line.CreateBound(new XYZ(0,0,0), FlattenPoint(viewport.GetBoxCenter())));
doc.Create.NewDetailCurve(selectedViewSheet, Line.CreateBound(new XYZ(0,0,0), FlattenPoint(vpCen)));
doc.Create.NewDetailCurve(selectedViewSheet, Line.CreateBound(new XYZ(0,0,0), FlattenPoint(viewport.GetBoxCenter())));

//INSIDE VIEW

Expand Down

0 comments on commit 9a1afd2

Please sign in to comment.