예제 #1
0
        // each list is optional- if specified then must be followed; if null, then no filter applies (all included)
        internal static void ExportMvd(
            mvdXML mvd,
            DocProject docProject,
            Dictionary<DocObject, bool> included)
        {
            mvd.Uuid = Guid.NewGuid(); // changes every time saved
            mvd.Name = String.Empty;

            foreach (DocTemplateDefinition docTemplateDef in docProject.Templates)
            {
                if (included == null || included.ContainsKey(docTemplateDef))
                {
                    ConceptTemplate mvdConceptTemplate = new ConceptTemplate();
                    mvd.Templates.Add(mvdConceptTemplate);
                    ExportMvdTemplate(mvdConceptTemplate, docTemplateDef, included, true);
                }
            }

            foreach (DocModelView docModelView in docProject.ModelViews)
            {
                if (included == null || included.ContainsKey(docModelView))
                {
                    ModelView mvdModelView = new ModelView();
                    mvd.Views.Add(mvdModelView);
                    ExportMvdObject(mvdModelView, docModelView, true);
                    mvdModelView.ApplicableSchema = "IFC4";
                    mvdModelView.BaseView = docModelView.BaseView;

                    foreach (DocExchangeDefinition docExchangeDef in docModelView.Exchanges)
                    {
                        ExchangeRequirement mvdExchangeDef = new ExchangeRequirement();
                        mvdModelView.ExchangeRequirements.Add(mvdExchangeDef);
                        ExportMvdObject(mvdExchangeDef, docExchangeDef, true);
                        switch (docExchangeDef.Applicability)
                        {
                            case DocExchangeApplicabilityEnum.Export:
                                mvdExchangeDef.Applicability = ApplicabilityEnum.Export;
                                break;

                            case DocExchangeApplicabilityEnum.Import:
                                mvdExchangeDef.Applicability = ApplicabilityEnum.Import;
                                break;
                        }
                    }

                    // export template usages for model view
                    foreach (DocConceptRoot docRoot in docModelView.ConceptRoots)
                    {
                        if (docRoot.ApplicableEntity != null)
                        {
                            // check if entity contains any concept roots
                            ConceptRoot mvdConceptRoot = new ConceptRoot();
                            mvdModelView.Roots.Add(mvdConceptRoot);

                            Program.ExportMvdConceptRoot(mvdConceptRoot, docRoot, true);
                        }
                    }
                }
            }
        }
예제 #2
0
        // each list is optional- if specified then must be followed; if null, then no filter applies (all included)
        internal static void ExportMvd(
            mvdXML mvd,
            DocProject docProject,
            Dictionary<DocObject, bool> included)
        {
            mvd.Name = String.Empty;

            foreach (DocTemplateDefinition docTemplateDef in docProject.Templates)
            {
                if (included == null || included.ContainsKey(docTemplateDef))
                {
                    ConceptTemplate mvdConceptTemplate = new ConceptTemplate();
                    mvd.Templates.Add(mvdConceptTemplate);
                    ExportMvdTemplate(mvdConceptTemplate, docTemplateDef, included);
                }
            }

            foreach (DocModelView docModelView in docProject.ModelViews)
            {
                if (included == null || included.ContainsKey(docModelView))
                {
                    ModelView mvdModelView = new ModelView();
                    mvd.Views.Add(mvdModelView);
                    ExportMvdObject(mvdModelView, docModelView);
                    mvdModelView.ApplicableSchema = "IFC4";
                    mvdModelView.BaseView = docModelView.BaseView;

                    foreach (DocExchangeDefinition docExchangeDef in docModelView.Exchanges)
                    {
                        ExchangeRequirement mvdExchangeDef = new ExchangeRequirement();
                        mvdModelView.ExchangeRequirements.Add(mvdExchangeDef);
                        ExportMvdObject(mvdExchangeDef, docExchangeDef);
                        switch (docExchangeDef.Applicability)
                        {
                            case DocExchangeApplicabilityEnum.Export:
                                mvdExchangeDef.Applicability = ApplicabilityEnum.Export;
                                break;

                            case DocExchangeApplicabilityEnum.Import:
                                mvdExchangeDef.Applicability = ApplicabilityEnum.Import;
                                break;
                        }
                    }

                    // export template usages for model view
                    foreach (DocConceptRoot docRoot in docModelView.ConceptRoots)
                    {
                        if (docRoot.ApplicableEntity != null)
                        {
                            // check if entity contains any concept roots
                            ConceptRoot mvdConceptRoot = new ConceptRoot();
                            mvdModelView.Roots.Add(mvdConceptRoot);

                            ExportMvdObject(mvdConceptRoot, docRoot);
                            mvdConceptRoot.ApplicableRootEntity = docRoot.ApplicableEntity.Name;
                            if (docRoot.ApplicableTemplate != null)
                            {
                                mvdConceptRoot.Applicability = new ApplicabilityRules();
                                mvdConceptRoot.Applicability.Template = new TemplateRef();
                                mvdConceptRoot.Applicability.Template.Ref = docRoot.ApplicableTemplate.Uuid;
                                mvdConceptRoot.Applicability.TemplateRules = new TemplateRules();

                                mvdConceptRoot.Applicability.TemplateRules.Operator = (TemplateOperator)Enum.Parse(typeof(TemplateOperator), docRoot.ApplicableOperator.ToString());
                                foreach (DocTemplateItem docItem in docRoot.ApplicableItems)
                                {
                                    TemplateRule rule = ExportMvdItem(docItem);
                                    mvdConceptRoot.Applicability.TemplateRules.TemplateRule.Add(rule);
                                }
                            }

                            foreach (DocTemplateUsage docTemplateUsage in docRoot.Concepts)
                            {
                                Concept mvdConceptLeaf = new Concept();
                                mvdConceptRoot.Concepts.Add(mvdConceptLeaf);
                                ExportMvdConcept(mvdConceptLeaf, docTemplateUsage);
                            }
                        }
                    }
                }
            }
        }