【问题标题】:How to rotate a family Instance in revit如何在 revit 中旋转族实例
【发布时间】:2019-04-04 23:33:03
【问题描述】:

[在此处输入图像描述]在我的模型中有一个框架元素,我正在计算该元素的边缘,但该元素已旋转并且对于 ex (0.4 , 0.6 , 0.2) 具有不同的面方向。我只想要(x,y)格式的元素边缘坐标,但我得到的坐标为(x,y,z),其中x可以是高度或长度或宽度。我怎样才能得到坐标。

我通过减去元素的位置点将边缘的坐标转换为相对坐标

我在想,如果我可以将元素的面方向更改为 (0, 0, 1),即在 Z 平面中托管它,那么我需要做的就是读取边缘的 (X, y) 和将其存储在列表中。如果这是正确的方法,请建议我如何?或者请提出任何其他方法

    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;
    }

我希望边缘处于相对坐标以及仅在二维维度中。前任。 大小为 4*4 的框架正方形元素

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

【问题讨论】:

  • 我认为一张图片将有助于更好地解释您的意思。只需手绘草图即可。
  • 我添加了有切口而不是开口的图片。我希望检索这些开口的相对边缘,即在 xy 平面中托管框架,然后各自的坐标将是(从最左下角顺时针方向):-(0,0); (0,8); (2 ,8) ; (2,6);(6,6);(6,0)

标签: c# revit-api


【解决方案1】:

我对你的问题了解甚少。然而,最重要的方面似乎是您在 3D 空间中有一个形状,并且实际上希望对其执行 2D 分析。对此,如果能先去掉多余的维度,分析和解决问题显然要简单得多。这可以使用适当的投影轻松实现。我很久以前在analysing 3D Polygon Areas 时遇到过类似的任务。由于我已经有了确定2D Polygon Areas and Outer Loops 的解决方案,因此我将 3D 问题投影到 2D 中,参见。方法GetPolygonPlane 在module CmdWallProfileArea.cs 在The Building Coder samples。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-27
    • 2019-03-29
    • 2023-03-30
    • 2019-11-28
    相关资源
    最近更新 更多