예제 #1
0
        protected override void Process(IFCAnyHandle ifcPoint)
        {
            base.Process(ifcPoint);

            XYZ unScaledPoint = IFCPoint.IFCPointToXYZ(ifcPoint);

            XYZPoint = IFCUnitUtil.ScaleLength(unScaledPoint);
        }
예제 #2
0
        /// <summary>
        /// Converts an IfcVector into a UV or XYZ value.
        /// </summary>
        /// <param name="vector">The handle to the IfcVector.</param>
        /// <returns>An XYZ value corresponding to the value in the file.  There are no transformations done in this routine.
        /// If the return is an XY point, the Z value will be set to 0.</returns>
        public static XYZ ProcessScaledLengthIFCVector(IFCAnyHandle vector)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(vector))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcVector);
                return(null);
            }

            if (!IFCAnyHandleUtil.IsValidSubTypeOf(vector, IFCEntityType.IfcVector))
            {
                Importer.TheLog.LogUnexpectedTypeError(vector, IFCEntityType.IfcVector, false);
                return(null);
            }

            XYZ xyz;
            int stepId = vector.StepId;

            if (IFCImportFile.TheFile.XYZMap.TryGetValue(stepId, out xyz))
            {
                return(xyz);
            }

            IFCAnyHandle direction = IFCImportHandleUtil.GetRequiredInstanceAttribute(vector, "Orientation", false);

            if (direction == null)
            {
                return(null);
            }

            bool   found     = false;
            double magnitude = IFCImportHandleUtil.GetRequiredScaledLengthAttribute(vector, "Magnitude", out found);

            if (!found)
            {
                magnitude = 1.0;
            }

            XYZ directionXYZ = IFCPoint.ProcessIFCDirection(direction);

            if (directionXYZ == null)
            {
                return(null);
            }

            xyz = directionXYZ * magnitude;
            AddToCaches(stepId, IFCEntityType.IfcVector, xyz);
            return(xyz);
        }
예제 #3
0
        /// <summary>
        /// Create an IFCPoint object from a handle of type IfcPoint.
        /// </summary>
        /// <param name="ifcPoint">The IFC handle.</param>
        /// <returns>The IFCPoint object.</returns>
        public static IFCPoint ProcessIFCPoint(IFCAnyHandle ifcPoint)
        {
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcPoint))
            {
                Importer.TheLog.LogNullError(IFCEntityType.IfcPoint);
                return(null);
            }

            IFCEntity point;

            if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcPoint.StepId, out point))
            {
                point = new IFCPoint(ifcPoint);
            }
            return(point as IFCPoint);
        }