Пример #1
0
        public void CreateProductIfc(ProductIfcRequest request,
                                     Stream outputStream)
        {
            IfcPerson person = IfcInit.CreatePerson(request.owner.person.givenName,
                                                    request.owner.person.familyName,
                                                    request.owner.person.identifier);
            IfcOrganization organization =
                IfcInit.CreateOrganization(request.owner.organization.name,
                                           request.owner.organization.description,
                                           request.owner.organization.identifier);
            IfcOrganization applicationOrganization =
                IfcInit.CreateOrganization(request.owner.application.organization.name,
                                           request.owner.application.organization.description,
                                           request.owner.application.organization.identifier);
            IfcApplication application =
                IfcInit.CreateApplication(applicationOrganization,
                                          request.owner.application.version,
                                          request.owner.application.name,
                                          request.owner.application.identifier);
            IfcOwnerHistory ownerHistory =
                IfcInit.CreateOwnerHistory(person, organization, application);

            IfcProject project = IfcInit.CreateProject(request.project.name,
                                                       request.project.description,
                                                       ownerHistory);
            IfcSite site = IfcInit.CreateSite(null, null, ownerHistory);

            project.Aggregate(site, ownerHistory);
            IfcBuilding building =
                IfcInit.CreateBuilding(null, null, ownerHistory, site.ObjectPlacement);

            site.Aggregate(building, ownerHistory);
            IfcBuildingStorey storey =
                IfcInit.CreateBuildingStorey(null, null, ownerHistory, building.ObjectPlacement);

            building.Aggregate(storey, ownerHistory);
            IfcProduct product;

            switch (request.product.type)
            {
            default:
                product = IfcInit.CreateProxy(request.product.name,
                                              request.product.description,
                                              ownerHistory,
                                              storey.ObjectPlacement,
                                              null);
                break;
            }
            List <IfcRepresentationContext> contextList =
                new List <IfcRepresentationContext> (project.RepresentationContexts);

            product.Representation =
                CreateProductRepresentation(contextList, request.product.representations);
            storey.Contains(product, ownerHistory);
            project.SerializeToStep(outputStream, request.schema.ToString(), null);
            return;
        }
Пример #2
0
        public async Task <IActionResult> Post(string name, [FromBody] ProductIfcRequest request)
        {
            MemoryStream memStream = new MemoryStream();

            await this._responseHelper.PostCommand((ProductIfcRequest request) =>
            {
                return(Task.Run(() =>
                {
                    this._ifcCreator.CreateProductIfc(request, memStream);
                }));
            },
                                                   request,
                                                   HttpContext);

            return(File(memStream, "application/octet-stream", String.Format("{0}.ifc", name)));
        }