public static IfcProductDefinitionShape CreateExtruded(IfcRepresentationContext representationContext,
            IfcProfileDef ifcProfileDef, IfcAxis2Placement3D placement3D, IfcDirection direction, double depth)
        {
            var extruded = new IfcExtrudedAreaSolid
                               {
                                   SweptArea = ifcProfileDef,
                                   Position =  placement3D,
                                   ExtrudedDirection = direction ,
                                   Depth = depth,
                               };

            var shaperep = new IfcShapeRepresentation
                               {
                                   ContextOfItems = representationContext,
                                   RepresentationIdentifier = "Body",
                                   RepresentationType = "SweptSolid",
                                   Items = new List<IfcRepresentationItem>(),
                               };
            shaperep.Items.Add(extruded);

            var ifcShape = new IfcProductDefinitionShape
                               {
                                   // Name=
                                   // Description =
                                   Representations = new List<IfcRepresentation>(),
                               };
            ifcShape.Representations.Add(shaperep);

            return ifcShape;
        }
        public static Matrix4 Axis2Placement3DToMatrix(IfcAxis2Placement3D axis2Placement3)
        {
            if (axis2Placement3.Axis == null)
            {
                axis2Placement3.Axis = new IfcDirection(0, 0, 1);
            }

            if (axis2Placement3.RefDirection == null)
            {
                axis2Placement3.RefDirection = new IfcDirection(1, 0, 0);
            }

            // Y direction is Z x ref direction
            // Caution
            // X direction is YxZ, not ZxY, which is reverse direction

            IfcDirection yDirection = IfcDirection.GetCrossProduct(axis2Placement3.Axis, axis2Placement3.RefDirection);
            IfcDirection xDirection = IfcDirection.GetCrossProduct(yDirection, axis2Placement3.Axis);
            IfcDirection zDirection = axis2Placement3.Axis;

            return new Matrix4(
                xDirection.DirectionRatios[0], yDirection.DirectionRatios[0], zDirection.DirectionRatios[0],
                axis2Placement3.Location.Coordinates[0],
                xDirection.DirectionRatios[1], yDirection.DirectionRatios[1], zDirection.DirectionRatios[1],
                axis2Placement3.Location.Coordinates[1],
                xDirection.DirectionRatios[2], yDirection.DirectionRatios[2], zDirection.DirectionRatios[2],
                axis2Placement3.Location.Coordinates[2],
                0, 0, 0, 1
                );
        }
Exemple #3
0
        //BbPosition3D()
        //    : this(BbCoordinate3D.Origin)
        //{
        //}
        //BbPosition3D(BbCoordinate3D coordinate3D)
        //    : this(coordinate3D,  BbDirection3D.Axis, BbDirection3D.RefDirection)
        //{
        //}
        BbPosition3D(BbCoordinate3D coordinate3D,
                          BbDirection3D axis, BbDirection3D refDirection)
        {
            Coordinate3D = coordinate3D;
            Axis = axis;
            RefDirection = refDirection;

            ifcAxis2Placement3D = new IfcAxis2Placement3D
            {
                Location = coordinate3D.IfcCartesianPoint,
                RefDirection = refDirection.IfcDirection,
                Axis = axis.IfcDirection,
            };
        }
        public static Matrix4 LocalTransform(IfcLocalPlacement localPlacement)
        {
            Matrix4 rMatrix = null;

            if (localPlacement.RelativePlacement.Value is IfcAxis2Placement3D)
            {
                var relPlacement = localPlacement.RelativePlacement.Value as IfcAxis2Placement3D;

                rMatrix = IfcAxis2Placement3D.Axis2Placement3DToMatrix(relPlacement);


                // Check the nodes found.
                if (localPlacement.PlacementRelTo != null)
                {
                    var ifcLocalPlacement = localPlacement.PlacementRelTo as IfcLocalPlacement;
                    if (ifcLocalPlacement != null)
                    {
                        rMatrix.MultiplyRev(LocalTransform(ifcLocalPlacement));
                    }
                }
            }
            return(rMatrix);
        }
        public static IfcProductDefinitionShape CreateExtruded(IfcRepresentationContext representationContext,
                                                               IfcProfileDef ifcProfileDef, IfcAxis2Placement3D placement3D, IfcDirection direction, double depth)
        {
            var extruded = new IfcExtrudedAreaSolid
            {
                SweptArea         = ifcProfileDef,
                Position          = placement3D,
                ExtrudedDirection = direction,
                Depth             = depth,
            };

            var shaperep = new IfcShapeRepresentation
            {
                ContextOfItems           = representationContext,
                RepresentationIdentifier = "Body",
                RepresentationType       = "SweptSolid",
                Items = new List <IfcRepresentationItem>(),
            };

            shaperep.Items.Add(extruded);

            var ifcShape = new IfcProductDefinitionShape
            {
                // Name=
                // Description =
                Representations = new List <IfcRepresentation>(),
            };

            ifcShape.Representations.Add(shaperep);

            return(ifcShape);
        }