コード例 #1
0
        protected override void Process(IFCAnyHandle ifcCurve)
        {
            base.Process(ifcCurve);
            KnotMultiplicities = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcCurve, "KnotMultiplicities");
            Knots = IFCAnyHandleUtil.GetAggregateDoubleAttribute <List <double> >(ifcCurve, "Knots");

            if (KnotMultiplicities == null || Knots == null)
            {
                Importer.TheLog.LogError(ifcCurve.StepId, "Cannot find the KnotMultiplicities or Knots attribute of this IfcBSplineCurveWithKnots", true);
            }

            if (KnotMultiplicities.Count != Knots.Count)
            {
                Importer.TheLog.LogError(ifcCurve.StepId, "The number of knots and knot multiplicities are not the same", true);
            }

            IList <double> revitKnots = IFCGeometryUtil.ConvertIFCKnotsToRevitKnots(KnotMultiplicities, Knots);

            Curve nurbsSpline = NurbSpline.CreateCurve(Degree, revitKnots, ControlPointsList);

            SetCurve(nurbsSpline);

            if (nurbsSpline == null)
            {
                Importer.TheLog.LogWarning(ifcCurve.StepId, "Cannot get the curve representation of this IfcCurve", false);
            }
        }
コード例 #2
0
        /// <summary>
        /// Processes IfcSite attributes.
        /// </summary>
        /// <param name="ifcIFCSite">The IfcSite handle.</param>
        protected override void Process(IFCAnyHandle ifcIFCSite)
        {
            using (ActiveSiteSetter setter = new ActiveSiteSetter(this))
            {
                base.Process(ifcIFCSite);
            }

            RefElevation = IFCImportHandleUtil.GetOptionalScaledLengthAttribute(ifcIFCSite, "RefElevation", 0.0);

            IList <int> refLatitudeList  = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcIFCSite, "RefLatitude");
            IList <int> refLongitudeList = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcIFCSite, "RefLongitude");

            if (refLatitudeList != null)
            {
                RefLatitude = 0.0;
                int numLats = Math.Min(refLatitudeList.Count, 4); // Only support up to degress, minutes, seconds, and millionths of seconds.
                for (int ii = 0; ii < numLats; ii++)
                {
                    RefLatitude += ((double)refLatitudeList[ii]) / GetLatLongScale(ii);
                }
            }

            if (refLongitudeList != null)
            {
                RefLongitude = 0.0;
                int numLongs = Math.Min(refLongitudeList.Count, 4); // Only support up to degress, minutes, seconds, and millionths of seconds.
                for (int ii = 0; ii < numLongs; ii++)
                {
                    RefLongitude += ((double)refLongitudeList[ii]) / GetLatLongScale(ii);
                }
            }

            LandTitleNumber = IFCAnyHandleUtil.GetStringAttribute(ifcIFCSite, "LandTitleNumber");
        }
コード例 #3
0
ファイル: IFCSite.cs プロジェクト: whztt07/RevitIFC
        /// <summary>
        /// Processes IfcSite attributes.
        /// </summary>
        /// <param name="ifcIFCSite">The IfcSite handle.</param>
        protected override void Process(IFCAnyHandle ifcIFCSite)
        {
            base.Process(ifcIFCSite);

            RefElevation = IFCImportHandleUtil.GetOptionalScaledLengthAttribute(ifcIFCSite, "RefElevation", 0.0);

            IList <int> refLatitudeList  = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcIFCSite, "RefLatitude");
            IList <int> refLongitudeList = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcIFCSite, "RefLongitude");

            if (refLatitudeList != null)
            {
                m_RefLatitude = 0.0;
                double latLongScaler = 1.0;
                foreach (double latVal in refLatitudeList)
                {
                    m_RefLatitude += ((double)latVal) / latLongScaler;
                    latLongScaler *= 60.0;
                }
            }

            if (refLongitudeList != null)
            {
                m_RefLongitude = 0.0;
                double latLongScaler = 1.0;
                foreach (double longVal in refLongitudeList)
                {
                    m_RefLongitude += ((double)longVal) / latLongScaler;
                    latLongScaler  *= 60.0;
                }
            }

            m_LandTitleNumber = IFCAnyHandleUtil.GetStringAttribute(ifcIFCSite, "LandTitleNumber");
        }
コード例 #4
0
        /// <summary>
        /// Process IfcTriangulatedFaceSet instance
        /// </summary>
        /// <param name="ifcTriangulatedFaceSet">the handle</param>
        protected override void Process(IFCAnyHandle ifcTriangulatedFaceSet)
        {
            base.Process(ifcTriangulatedFaceSet);

            IList <IList <double> > normals = IFCImportHandleUtil.GetListOfListOfDoubleAttribute(ifcTriangulatedFaceSet, "Normals");

            if (normals != null)
            {
                if (normals.Count > 0)
                {
                    Normals = normals;
                }
            }

            bool?closed = IFCAnyHandleUtil.GetBooleanAttribute(ifcTriangulatedFaceSet, "Closed");

            if (closed != null)
            {
                Closed = closed;
            }

            IList <IList <int> > coordIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "CoordIndex");

            if (coordIndex != null)
            {
                if (coordIndex.Count > 0)
                {
                    CoordIndex = coordIndex;
                }
            }

            // Note that obsolete IFC4 files had a "NormalIndex".
            // We ignore this because we can't actually distinguish between these files.
            // "PnIndex" is new to IFC4Add2, so we'll protect here in case we see an obsolete file.
            try
            {
                if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4))
                {
                    IList <int> pnIndex = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcTriangulatedFaceSet, "PnIndex");
                    if (pnIndex != null)
                    {
                        if (pnIndex.Count > 0)
                        {
                            PnIndex = pnIndex;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (IFCImportFile.HasUndefinedAttribute(ex))
                {
                    IFCImportFile.TheFile.DowngradeIFC4SchemaTo(IFCSchemaVersion.IFC4Add1Obsolete);
                }
                else
                {
                    throw ex;
                }
            }
        }
コード例 #5
0
        protected override void Process(IFCAnyHandle ifcIndexPolygonalFace)
        {
            base.Process(ifcIndexPolygonalFace);

            IList <int> coordIndex = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcIndexPolygonalFace, "CoordIndex");

            if (coordIndex != null)
            {
                if (coordIndex.Count >= 3)
                {
                    CoordIndex = coordIndex;
                }
            }

            if (IFCAnyHandleUtil.IsTypeOf(ifcIndexPolygonalFace, IFCEntityType.IfcIndexedPolygonalFaceWithVoids))
            {
                IList <IList <int> > innerCoordIndices = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcIndexPolygonalFace, "InnerCoordIndices");
                if (innerCoordIndices != null)
                {
                    if (innerCoordIndices.Count > 0)
                    {
                        InnerCoordIndices = innerCoordIndices;
                    }
                }
            }
        }
コード例 #6
0
 protected override void Process(IFCAnyHandle ifcSurface)
 {
     base.Process(ifcSurface);
     UMultiplicities = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcSurface, "UMultiplicities");
     VMultiplicities = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcSurface, "VMultiplicities");
     UKnots          = IFCAnyHandleUtil.GetAggregateDoubleAttribute <List <double> >(ifcSurface, "UKnots");
     VKnots          = IFCAnyHandleUtil.GetAggregateDoubleAttribute <List <double> >(ifcSurface, "VKnots");
 }
コード例 #7
0
        /// <summary>
        /// Process IfcTriangulatedFaceSet instance
        /// </summary>
        /// <param name="ifcTriangulatedFaceSet">the handle</param>
        protected override void Process(IFCAnyHandle ifcTriangulatedFaceSet)
        {
            base.Process(ifcTriangulatedFaceSet);

            IList <IList <double> > normals = IFCImportHandleUtil.GetListOfListOfDoubleAttribute(ifcTriangulatedFaceSet, "Normals");

            if (normals != null)
            {
                if (normals.Count > 0)
                {
                    Normals = normals;
                }
            }

            bool?closed = IFCAnyHandleUtil.GetBooleanAttribute(ifcTriangulatedFaceSet, "Closed");

            if (closed != null)
            {
                Closed = closed;
            }

            IList <IList <int> > coordIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "CoordIndex");

            if (coordIndex != null)
            {
                if (coordIndex.Count > 0)
                {
                    CoordIndex = coordIndex;
                }
            }

            IList <IList <int> > normalIndex;

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4Add2)
            {
                normalIndex = coordIndex;
            }
            else
            {
                normalIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "NormalIndex");
            }

            if (normalIndex != null)
            {
                if (normalIndex.Count > 0)
                {
                    NormalIndex = normalIndex;
                }
            }

            if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4Add2)
            {
                IList <int> pnIndex = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcTriangulatedFaceSet, "PnIndex");
                if (pnIndex != null)
                {
                    if (pnIndex.Count > 0)
                    {
                        PnIndex = pnIndex;
                    }
                }
            }
        }