示例#1
0
        private XPolygon CreateProfileP(double wallThickness)
        {
            double   unitWidth = UnitWidth - wallThickness;
            double   unitDepth = UnitDepth - wallThickness;
            XPolygon profile   = new XPolygon();

            profile.Add(new XbimPoint3D(-unitWidth / 2, UnitDepth / 2, 0));
            profile.Add(new XbimPoint3D(unitWidth / 2, UnitDepth / 2, 0));
            profile.Add(new XbimPoint3D(unitWidth / 2, -unitDepth / 2, 0));
            profile.Add(new XbimPoint3D(-unitWidth / 2, -unitDepth / 2, 0));
            return(profile);
        }
示例#2
0
        public XPreviewElement(IfcProduct ifcEntity)
            : base(ifcEntity)
        {
            Color       = ifcEntity.Description;
            ProfilePath = LoadProfilePath();

            XPolygon LoadProfilePath()
            {
                XPolygon profile = new XPolygon();

                foreach (var rep in ifcEntity.Representation.Representations)
                {
                    if (rep.RepresentationIdentifier == "Plan" && rep.RepresentationType == "Curve2D")
                    {
                        foreach (var item in rep.Items)
                        {
                            if (item is IfcPolyline polyline)
                            {
                                foreach (var point in polyline.Points)
                                {
                                    profile.Add(new XbimPoint3D(point.X, point.Y, point.Z));
                                }
                            }
                        }
                    }
                }

                return(profile);
            }
        }
示例#3
0
        /// <summary>
        /// Creates a transformed copy of the polygon
        /// </summary>
        /// <param name="transform"></param>
        /// <returns></returns>
        public XPolygon Transformed(XbimMatrix3D transform)
        {
            XPolygon transformed = new XPolygon();

            ForEach(p => transformed.Add(transform.Transform(p)));
            return(transformed);
        }
示例#4
0
        /// <summary>
        /// Creates an identical copy of the polygon
        /// </summary>
        /// <returns></returns>
        public XPolygon Clone()
        {
            XPolygon copy = new XPolygon();

            ForEach(pt => copy.Add(new XbimPoint3D(pt.X, pt.Y, pt.Z)));
            return(copy);
        }
示例#5
0
        public XPolygon Normalized(XbimPoint3D origin)
        {
            XPolygon temp = new XPolygon();

            ForEach(pt => temp.Add(new XbimPoint3D(pt.X, pt.Y, pt.Z)));
            temp.Normalize(origin);
            return(temp);
        }
示例#6
0
        private static XPolygon FromPath(Path clipPath, double scaleBy = 1)
        {
            XPolygon path = new XPolygon();

            foreach (IntPoint pt in clipPath)
            {
                XbimPoint3D p = new XbimPoint3D(pt.X / scaleBy, pt.Y / scaleBy, 0);
                //p.UserData = pt.userData;
                path.Add(p);
            }
            return(path);
        }