Elevation View cropBox trasform can not modify orign XYZ value?

Elevation View cropBox trasform can not modify orign XYZ value?

Anonymous
Not applicable
674 Views
4 Replies
Message 1 of 5

Elevation View cropBox trasform can not modify orign XYZ value?

Anonymous
Not applicable

Elevation View cropBox trasform can not modify orign XYZ value?

 

view.CropBox = sectionBox;

 

But orign is not changed.

 

why?

 

0 Likes
Accepted solutions (1)
675 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

my code:  ref 

http://thebuildingcoder.typepad.com/blog/2012/06/create-section-view-parallel-to-wall.html?cid=6a00e...

 

 

BoundingBoxXYZ bb = wall.get_BoundingBox(null);
double minZ = bb.Min.Z;
double maxZ = bb.Max.Z;

double w = v.GetLength();
double h = maxZ - minZ;
double d = wall.WallType.Width;
double offset = 0.1 * w;

XYZ min = new XYZ(-w, minZ - offset, -offset);
//XYZ max = new XYZ( w, maxZ + offset, 0 ); // section view dotted line in center of wall
XYZ max = new XYZ(w, maxZ + offset, offset); // section view dotted line offset from center of wall

XYZ midpoint = p + 0.5 * v;
XYZ walldir = v.Normalize();
XYZ up = XYZ.BasisZ;
XYZ viewdir = walldir.CrossProduct(up);

Transform t = Transform.Identity;
t.Origin = midpoint;
t.BasisX = walldir;
t.BasisY = up;
t.BasisZ = viewdir;

BoundingBoxXYZ sectionBox = new BoundingBoxXYZ();
sectionBox.Transform = t;
sectionBox.Min = min;
sectionBox.Max = max;

return sectionBox;

0 Likes
Message 3 of 5

FAIR59
Advisor
Advisor

to move the cropbox, you have to move the associated "ElevationSectionMarker"  (category OST_VIEWER) of the elevation

 

ElevSectionMarker.Location.Move(translation);

 

ElevationSectionMarker.PNG

to rotate the cropbox, you have to rotate the ElevationMarker

                ElevationMarker elevation;
                Location loc = elevation.Location;
                loc.Rotate(Line.CreateBound(XYZ.Zero, XYZ.BasisZ), viewAngle);

ElevationMarker.PNG

 

0 Likes
Message 4 of 5

sr
Contributor
Contributor

hi,

 

 Rotate is OK.   I  use  ElementTransformUtils.RotateElement, is ok , too.

 

but

 

Move is not OK!

 

ElevationMarker is  moved Succeeded,  but CropBox.Transform.Origin is not modified!

 

why?

0 Likes
Message 5 of 5

FAIR59
Advisor
Advisor
Accepted solution

you have to move the "ElevationSectionMarker" (the element that looks like my first picture).

 

here's how you find that element:

 

List<Element> ElevSectionMarkers = new FilteredElementCollector(doc, viewPlanId)
            .OfCategory(BuiltInCategory.OST_Viewers)
            .ToList();
Element ElevSectionMarker = null; // element to find
foreach (Element elem in ElevSectionMarkers)
{
      Parameter par = elem.get_Parameter(BuiltInParameter.VIEW_NAME);
      if (par != null)
      {
                    if (string.Compare(par.AsString(), view.Name) == 0)
                    {
                        ElevSectionMarker = elem;
                        break;
                    }
       }
}
0 Likes