0

[enter image description here]In my model there is a framing element and I am calculating the edges of that element but the element is rotated and has different face orientation for ex (0.4 , 0.6 , 0.2) . I want the coordinate of edges of the element in ( x , y) format only but I am getting the co-ordinates as (x , y , z) where x can be height or length or width. How can I get the co-ordinates.

I am converting the coordinates of the edges to relative coordinate by subtracting the location point of the element

I was thinking that If I can change the face orientation of the element to ( 0 , 0 , 1) i.e host it in the Z plane then all i need to do is to read (X , y) of the edges and store it in the list. If this is the right approach please suggest me how? Or please suggest any other method

    private List<XYZ> GetFacesAndEdges(Element sheet)
    {
        //Location p1 = sheet.Location;

        //FamilyInstance ins = sheet as FamilyInstance;
        //Transform tra = ins.GetTransform();
        //tra.BasisX = new XYZ(1, 0, 0);
        //tra.BasisY = new XYZ(0, 1, 0);
        //tra.BasisZ = new XYZ(0, 0, 1);

        //Location p2 = ins.Location;

        String faceInfo = "";
        List<XYZ> points = new List<XYZ>();
        Location p = sheet.Location;
        XYZ point = new XYZ();
        if (sheet?.Location is LocationPoint location)
        {
            point = location.Point;
        }

        Autodesk.Revit.DB.Options opt = new Options();
        Autodesk.Revit.DB.GeometryElement geomElem = sheet.get_Geometry(opt);
        foreach (GeometryObject geomObj in geomElem)
        {
            Solid geomSolid = geomObj as Solid;
            if (null != geomSolid)
            {
                int faces = 0;
                double totalArea = 0;

                foreach(Edge e in geomSolid.Edges)
                {
                    IList<XYZ> pointd = e.Tessellate();
                    foreach(XYZ ptr in pointd)
                    {
                        XYZ ptrXYZ = new XYZ(ptr.X - point.X , ptr.Y - point.Y, ptr.Z - point.Z);
                        points.Add(ptrXYZ);
                    }
                }
            }
        }

        return points;
    }

I want the edges to be in relative coordinates as well as only in 2-d dimension. Ex. <(0,0);(0,4);(4,4)(4,0)> A Framing square element of size 4*4

This is the picture of the framing element Which has cuts not openings.

Saurabh Agrawal
  • 150
  • 1
  • 13
  • I think a picture would help explain better what you mean. Just a hand-drawn sketch would help. – Jeremy Tammik Apr 04 '19 at 09:02
  • I have added the picture which has cuts not openings. I want the to retrieve the relative edges of those openings i.e hosting the frame in a xy plane then the respective coordinate will be (from lower leftmost corner in clockwise manner) :- (0,0) ; (0,8); (2 ,8) ; (2,6);(6,6);(6,0) – Saurabh Agrawal Apr 04 '19 at 14:44

1 Answers1

0

I understand very little of what you ask. However, the most important aspect seems to be that you have a shape in 3D space and in fact wish to perform a 2D analysis on it. For this, it is obviously much simpler to analyse and solve the problem if you can first get rid of the superfluous dimension. This can easily be achieved using the appropriate projection. I faced a similar task once long ago when analysing 3D Polygon Areas. Since I already had a solution in place to determine 2D Polygon Areas and Outer Loops, I projected the 3D problem into 2D, cf. the method GetPolygonPlane in the module CmdWallProfileArea.cs in The Building Coder samples.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17