Exemple #1
0
        /// <summary>
        /// Create geometry for a particular representation item, and add to scope.
        /// </summary>
        /// <param name="shapeEditScope">The geometry creation scope.</param>
        /// <param name="lcs">Local coordinate system for the geometry, without scale.</param>
        /// <param name="scaledLcs">Local coordinate system for the geometry, including scale, potentially non-uniform.</param>
        /// <param name="guid">The guid of an element for which represntation is being created.</param>
        /// <remarks>This currently assumes that we are create plan view curves.</remarks>
        protected override void CreateShapeInternal(IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid)
        {
            base.CreateShapeInternal(shapeEditScope, lcs, scaledLcs, guid);

            // TODO: set graphics style.
            if (Curve != null)
            {
                Curve transformedCurve = Curve.CreateTransformed(lcs);
                shapeEditScope.AddFootprintCurve(transformedCurve);
            }
            else if (CurveLoop != null)
            {
                foreach (Curve curve in CurveLoop)
                {
                    Curve transformedCurve = curve.CreateTransformed(lcs);
                    shapeEditScope.AddFootprintCurve(transformedCurve);
                }
            }
        }
        /// <summary>
        /// Create geometry for a particular representation item, and add to scope.
        /// </summary>
        /// <param name="shapeEditScope">The geometry creation scope.</param>
        /// <param name="lcs">Local coordinate system for the geometry, without scale.</param>
        /// <param name="scaledLcs">Local coordinate system for the geometry, including scale, potentially non-uniform.</param>
        /// <param name="guid">The guid of an element for which represntation is being created.</param>
        protected override void CreateShapeInternal(IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid)
        {
            // Reject Axis curves - not yet supported.
            IFCRepresentation parentRep = shapeEditScope.ContainingRepresentation;

            IFCRepresentationIdentifier repId = (parentRep == null) ? IFCRepresentationIdentifier.Unhandled : parentRep.Identifier;
            bool createModelGeometry = (repId == IFCRepresentationIdentifier.Axis);
            if (createModelGeometry)
            {
                Importer.TheLog.LogWarning(Id, "Can't process Axis representation, ignoring.", true);
                return;
            } 
            
            base.CreateShapeInternal(shapeEditScope, lcs, scaledLcs, guid);

            IList<Curve> transformedCurves = new List<Curve>();
            if (Curve != null)
            {
                Curve transformedCurve = CreateTransformedCurve(Curve, parentRep, lcs);
                if (transformedCurve != null)
                    transformedCurves.Add(transformedCurve);
            }
            else if (CurveLoop != null)
            {
                foreach (Curve curve in CurveLoop)
                {
                    Curve transformedCurve = CreateTransformedCurve(curve, parentRep, lcs);
                    if (transformedCurve != null)
                        transformedCurves.Add(transformedCurve);
                }
            }

            // TODO: set graphics style for footprint curves.
            ElementId gstyleId = ElementId.InvalidElementId;
            foreach (Curve curve in transformedCurves)
            {
                // Default: assume a plan view curve.
                shapeEditScope.AddFootprintCurve(curve);
            }
        }
        /// <summary>
        /// Create geometry for a particular representation item, and add to scope.
        /// </summary>
        /// <param name="shapeEditScope">The geometry creation scope.</param>
        /// <param name="lcs">Local coordinate system for the geometry, without scale.</param>
        /// <param name="scaledLcs">Local coordinate system for the geometry, including scale, potentially non-uniform.</param>
        /// <param name="guid">The guid of an element for which represntation is being created.</param>
        protected override void CreateShapeInternal(IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid)
        {
            base.CreateShapeInternal(shapeEditScope, lcs, scaledLcs, guid);

            IFCRepresentation parentRep = shapeEditScope.ContainingRepresentation;
            
            IList<Curve> transformedCurves = new List<Curve>();
            if (Curve != null)
            {
                Curve transformedCurve = CreateTransformedCurve(Curve, parentRep, lcs);
                if (transformedCurve != null)
                    transformedCurves.Add(transformedCurve);
            }
            else if (CurveLoop != null)
            {
                foreach (Curve curve in CurveLoop)
                {
                    Curve transformedCurve = CreateTransformedCurve(curve, parentRep, lcs);
                    if (transformedCurve != null)
                        transformedCurves.Add(transformedCurve);
                }
            }

            // TODO: set graphics style for footprint curves.
            IFCRepresentationIdentifier repId = (parentRep == null) ? IFCRepresentationIdentifier.Unhandled : parentRep.Identifier;
            bool createModelGeometry = (repId == IFCRepresentationIdentifier.Axis);

            ElementId gstyleId = ElementId.InvalidElementId;
            if (createModelGeometry)
            {
                Category curveCategory = IFCCategoryUtil.GetSubCategoryForRepresentation(shapeEditScope.Document, Id, parentRep.Identifier);
                if (curveCategory != null)
                {
                    GraphicsStyle graphicsStyle = curveCategory.GetGraphicsStyle(GraphicsStyleType.Projection);
                    if (graphicsStyle != null)
                        gstyleId = graphicsStyle.Id;
                }
            }

            foreach (Curve curve in transformedCurves)
            {
                if (createModelGeometry)
                {
                    curve.SetGraphicsStyleId(gstyleId);
                    shapeEditScope.AddGeometry(IFCSolidInfo.Create(Id, curve));
                }
                else
                {
                    // Default: assume a plan view curve.
                    shapeEditScope.AddFootprintCurve(curve);
                }
            }
        }