Exemple #1
0
        private void buttonProperty_Click(object sender, EventArgs e)
        {
            using (FormSelectProperty form = new FormSelectProperty(this.m_base as DocEntity, this.m_project, false))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    string valueprop = "NominalValue";
                    switch (form.SelectedProperty.PropertyType)
                    {
                    case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
                        valueprop = "SetPointValue";
                        break;

                    case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE:
                        valueprop = "EnumerationValues";
                        break;

                    case DocPropertyTemplateTypeEnum.P_LISTVALUE:
                        valueprop = "ListValues";
                        break;

                        // other property types are not supported
                    }

                    string value = @"\" + this.m_base.Name + @".IsDefinedBy['" + form.SelectedPropertySet +
                                   @"']\IfcRelDefinesByProperties.RelatingPropertyDefinition\IfcPropertySet.HasProperties['" + form.SelectedProperty +
                                   @"']\" + form.SelectedProperty.GetEntityName() + @"." + valueprop + @"\" + form.SelectedProperty.PrimaryDataType;

                    CvtValuePath valuepath = CvtValuePath.Parse(value, this.m_map);
                    LoadValuePath(valuepath);
                }
            }
        }
Exemple #2
0
 private void buttonProperty_Click(object sender, EventArgs e)
 {
     using (FormSelectProperty form = new FormSelectProperty(this.m_base as DocEntity, this.m_project, false))
     {
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             string       value     = form.GenerateValuePath();
             CvtValuePath valuepath = CvtValuePath.Parse(value, this.m_map);
             LoadValuePath(valuepath);
         }
     }
 }
Exemple #3
0
        private void buttonProperty_Click(object sender, EventArgs e)
        {
            using (FormSelectProperty form = new FormSelectProperty(this.m_base as DocEntity, this.m_project, false))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    string valueprop = "NominalValue";
                    string datatype  = form.SelectedProperty.PrimaryDataType;
                    switch (form.SelectedProperty.PropertyType)
                    {
                    case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
                        valueprop = "SetPointValue";
                        break;

                    case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE:
                        valueprop = "EnumerationValues";
                        break;

                    case DocPropertyTemplateTypeEnum.P_LISTVALUE:
                        valueprop = "ListValues";
                        break;

                    case DocPropertyTemplateTypeEnum.P_REFERENCEVALUE:
                        valueprop = "PropertyReference";
                        datatype  = "IfcIrregularTimeSeries.Values[]\\" + form.SelectedProperty.SecondaryDataType;
                        break;

                        // other property types are not supported
                    }

                    string portprefix = String.Empty;
                    if (form.SelectedPort != null)
                    {
                        portprefix = @".IsNestedBy[]\IfcRelNests.RelatedObjects['" + form.SelectedPort + @"']\IfcDistributionPort";
                    }

                    string value = @"\" + this.m_base.Name + portprefix + @".IsDefinedBy['" + form.SelectedPropertySet +
                                   @"']\IfcRelDefinesByProperties.RelatingPropertyDefinition\IfcPropertySet.HasProperties['" + form.SelectedProperty +
                                   @"']\" + form.SelectedProperty.GetEntityName() + @"." + valueprop + @"\" + datatype;

                    CvtValuePath valuepath = CvtValuePath.Parse(value, this.m_map);
                    LoadValuePath(valuepath);
                }
            }
        }
Exemple #4
0
        private void toolStripButtonProperty_Click(object sender, EventArgs e)
        {
            DocEntity docBaseEntity = this.m_project.GetDefinition(this.m_template.Type) as DocEntity;

            if (this.m_conceptroot != null && this.m_conceptroot.ApplicableEntity != null)
            {
                docBaseEntity = this.m_conceptroot.ApplicableEntity;
            }

            using (FormSelectProperty form = new FormSelectProperty(docBaseEntity, this.m_project, false))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    string value = form.GenerateValuePath();

                    Dictionary <string, DocObject> mapEntity = new Dictionary <string, DocObject>();
                    foreach (DocSection docSection in this.m_project.Sections)
                    {
                        foreach (DocSchema docSchema in docSection.Schemas)
                        {
                            foreach (DocEntity docEntity in docSchema.Entities)
                            {
                                mapEntity.Add(docEntity.Name, docEntity);
                            }
                            foreach (DocType docType in docSchema.Types)
                            {
                                mapEntity.Add(docType.Name, docType);
                            }
                        }
                    }

                    CvtValuePath valuepath = CvtValuePath.Parse(value, mapEntity);
                    this.ChangeTemplate(valuepath.ToTemplateDefinition());
                }
            }
        }
Exemple #5
0
        private void buttonProperty_Click(object sender, EventArgs e)
        {
            using (FormSelectProperty form = new FormSelectProperty(this.m_base as DocEntity, this.m_project, false))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    string portprefix = String.Empty;
                    if (form.SelectedPort != null)
                    {
                        portprefix = @".IsNestedBy[]\IfcRelNests.RelatedObjects['" + form.SelectedPort + @"']\IfcDistributionPort";
                    }

                    if (form.SelectedPropertySet != null && form.SelectedPropertySet.PropertySetType == "PSET_PERFORMANCEDRIVEN")
                    {
                        portprefix += @".HasAssignments[]\IfcRelAssignsToControl.RelatingControl\IfcPerformanceHistory";
                    }

                    string value = @"\" + this.m_base.Name + portprefix;

                    if (form.SelectedProperty != null)
                    {
                        string valueprop = "NominalValue";
                        string datatype  = form.SelectedProperty.PrimaryDataType;
                        switch (form.SelectedProperty.PropertyType)
                        {
                        case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
                            if (form.SelectedQualifier != null)
                            {
                                valueprop = form.SelectedQualifier;
                            }
                            else
                            {
                                valueprop = "SetPointValue";
                            }
                            break;

                        case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE:
                            valueprop = "EnumerationValues";
                            break;

                        case DocPropertyTemplateTypeEnum.P_LISTVALUE:
                            valueprop = "ListValues";
                            break;

                        case DocPropertyTemplateTypeEnum.P_REFERENCEVALUE:
                            valueprop = "PropertyReference";
                            datatype  = "IfcIrregularTimeSeries.Values[]\\IfcIrregularTimeSeriesValue.ListValues[]\\" + form.SelectedProperty.SecondaryDataType;
                            break;

                            // other property types are not supported
                        }

                        if (form.SelectedProperty.PropertyType == DocPropertyTemplateTypeEnum.COMPLEX)
                        {
                            value += @".IsDefinedBy['" + form.SelectedPropertySet +
                                     @"']\IfcRelDefinesByProperties.RelatingPropertyDefinition\IfcPropertySet.HasProperties['" + form.SelectedProperty +
                                     @"']\" + form.SelectedProperty.GetEntityName();
                        }
                        else
                        {
                            value += @".IsDefinedBy['" + form.SelectedPropertySet +
                                     @"']\IfcRelDefinesByProperties.RelatingPropertyDefinition\IfcPropertySet.HasProperties['" + form.SelectedProperty +
                                     @"']\" + form.SelectedProperty.GetEntityName() + @"." + valueprop + @"\" + datatype;
                        }

                        // special cases
                        if (this.m_base.Name.Equals("IfcMaterial"))
                        {
                            value =
                                @"\IfcMaterial.HasProperties['" + form.SelectedPropertySet +
                                @"']\IfcMaterialProperties.Properties['" + form.SelectedProperty +
                                @"']\" + form.SelectedProperty.GetEntityName() + @"." + valueprop + @"\" + datatype;
                        }
                    }
                    else
                    {
                        value += @".GlobalId\IfcGloballyUniqueId";
                    }

                    CvtValuePath valuepath = CvtValuePath.Parse(value, this.m_map);
                    LoadValuePath(valuepath);
                }
            }
        }
Exemple #6
0
        private void toolStripButtonProperty_Click(object sender, EventArgs e)
        {
            DocEntity docBaseEntity = this.m_project.GetDefinition(this.m_template.Type) as DocEntity;

            if (this.m_conceptroot != null && this.m_conceptroot.ApplicableEntity != null)
            {
                docBaseEntity = this.m_conceptroot.ApplicableEntity;
            }

            using (FormSelectProperty form = new FormSelectProperty(docBaseEntity, this.m_project, false))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    string value = form.GenerateValuePath();

                    Dictionary <string, DocObject> mapEntity = new Dictionary <string, DocObject>();
                    foreach (DocSection docSection in this.m_project.Sections)
                    {
                        foreach (DocSchema docSchema in docSection.Schemas)
                        {
                            foreach (DocEntity docEntity in docSchema.Entities)
                            {
                                mapEntity.Add(docEntity.Name, docEntity);
                            }
                            foreach (DocType docType in docSchema.Types)
                            {
                                mapEntity.Add(docType.Name, docType);
                            }
                        }
                    }

                    if (docBaseEntity.BaseDefinition == "IfcElement" || docBaseEntity.BaseDefinition == "IfcElementComponent" || docBaseEntity.BaseDefinition == "IfcBuildingElement" ||
                        docBaseEntity.BaseDefinition == "IfcReinforcingElement" || docBaseEntity.BaseDefinition == "IfcFlowSegment" || docBaseEntity.BaseDefinition == "IfcFeatureElement" ||
                        docBaseEntity.BaseDefinition == "IfcContext" || docBaseEntity.BaseDefinition == "IfcSpatialStructureElement" || docBaseEntity.BaseDefinition == "IfcFacility" ||
                        docBaseEntity.BaseDefinition == "IfcFacilityPart")
                    {
                        this.ChangeTemplate(this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePsetObject));

                        string[]        psetParamNames = this.Concept.Definition.GetParameterNames();
                        DocTemplateItem pset           = new DocTemplateItem();
                        pset.Name = form.SelectedPropertySet.Name;

                        if (form.SelectedPropertySet.Name == "Pset_ElementCommon")
                        {
                            pset.Name = form.SelectedPropertySet.Name.Replace("Element", docBaseEntity.Name);
                        }

                        pset.RuleParameters = "PsetName=" + pset.Name;
                        if (this.Concept.Items.Count == 0)
                        {
                            this.Concept.Items.Add(pset);
                        }
                        else
                        {
                            bool addItem = true;
                            foreach (DocTemplateItem existingPsetDefinition in this.Concept.Items)
                            {
                                if (existingPsetDefinition.Name == pset.Name)
                                {
                                    addItem = false;
                                }
                            }
                            if (addItem)
                            {
                                this.Concept.Items.Add(pset);
                            }
                        }

                        DocTemplateUsage            propertyConcept = new DocTemplateUsage();
                        DocPropertyTemplateTypeEnum propertyType    = form.SelectedProperty.PropertyType;
                        propertyConcept.Operator = DocTemplateOperator.And;
                        DocTemplateItem property = new DocTemplateItem();
                        string          psetName = pset.Name;
                        propertyConcept.Name = String.Join(" ", Regex.Split(form.SelectedProperty.Name, @"(?<!^)(?=[A-Z])"));
                        switch (propertyType)
                        {
                        case DocPropertyTemplateTypeEnum.P_SINGLEVALUE:
                            //propertyConcept.Name = "Single Value";
                            //propertyRule.RuleParameters = parameterNames[0] + "[Value]=" + "'" + form.SelectedProperty.Name + "'" + parameterNames[1] + "[Type]=" + "'" + form.SelectedProperty.PrimaryDataType + "'";
                            propertyConcept.Definition = this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePropertySingle);
                            //parameterNames = property.Definition.GetParameterNames();
                            property.RuleParameters = propertyConcept.Definition.GetParameterNames()[0] + "=" + form.SelectedProperty.Name + ";" + propertyConcept.Definition.GetParameterNames()[1] + "=" + form.SelectedProperty.PrimaryDataType + ";";
                            CreateAndAssignProperty(form, propertyConcept, property, psetName);
                            break;

                        case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE:
                            //propertyConcept.Name = "Enumerated Value";
                            propertyConcept.Definition = this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePropertyEnumerated);
                            //parameterNames = property.Definition.GetParameterNames();
                            property.RuleParameters = propertyConcept.Definition.GetParameterNames()[0] + "=" + form.SelectedProperty.Name + ";" + propertyConcept.Definition.GetParameterNames()[1] + "=" + form.SelectedProperty.PrimaryDataType + ";";
                            CreateAndAssignProperty(form, propertyConcept, property, psetName);
                            break;

                        case DocPropertyTemplateTypeEnum.P_LISTVALUE:
                            propertyConcept.Definition = this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePropertyList);
                            property.RuleParameters    = propertyConcept.Definition.GetParameterNames()[0] + "=" + form.SelectedProperty.Name + ";" + propertyConcept.Definition.GetParameterNames()[1] + "=" + form.SelectedProperty.PrimaryDataType + ";";
                            CreateAndAssignProperty(form, propertyConcept, property, psetName);
                            break;

                        case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
                            propertyConcept.Definition = this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePropertyBounded);
                            property.RuleParameters    = propertyConcept.Definition.GetParameterNames()[0] + "=" + form.SelectedProperty.Name + ";" + propertyConcept.Definition.GetParameterNames()[1] + "=" + form.SelectedProperty.PrimaryDataType + ";";
                            CreateAndAssignProperty(form, propertyConcept, property, psetName);
                            break;

                        case DocPropertyTemplateTypeEnum.P_REFERENCEVALUE:
                            propertyConcept.Definition = this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePropertyReference);
                            property.RuleParameters    = propertyConcept.Definition.GetParameterNames()[0] + "=" + form.SelectedProperty.Name + ";" + propertyConcept.Definition.GetParameterNames()[1] + "=" + form.SelectedProperty.PrimaryDataType + ";";
                            CreateAndAssignProperty(form, propertyConcept, property, psetName);
                            break;

                        case DocPropertyTemplateTypeEnum.P_TABLEVALUE:
                            propertyConcept.Definition = this.m_project.GetTemplate(DocTemplateDefinition.guidTemplatePropertyTable);
                            property.RuleParameters    = propertyConcept.Definition.GetParameterNames()[0] + "=" + form.SelectedProperty.Name + ";" + propertyConcept.Definition.GetParameterNames()[1] + "=" + form.SelectedProperty.PrimaryDataType + ";";
                            CreateAndAssignProperty(form, propertyConcept, property, psetName);
                            break;
                        }

                        //foreach(DocModelRule rule in property.Definition.Rules)
                        //{
                        //    if (!string.IsNullOrEmpty(rule.Identification))
                        //    {

                        //    }
                        //}
                    }
                    else
                    {
                        CvtValuePath valuepath = CvtValuePath.Parse(value, mapEntity);
                        this.ChangeTemplate(valuepath.ToTemplateDefinition());
                    }
                }
            }
        }
Exemple #7
0
        private void toolStripMenuItemEditBuildConcepts_Click(object sender, EventArgs e)
        {
            DocTemplateDefinition docTemplatePset = this.m_project.GetTemplate(new Guid("f74255a6-0c0e-4f31-84ad-24981db62461"));

            // also check for new template additions
            DocTemplateDefinition docTemplatePropertyReference = this.m_project.GetTemplate(new Guid("e20bc116-889b-46cc-b193-31b3e2376a8e"));

            if (docTemplatePset == null || docTemplatePropertyReference == null)
            {
                // import it
                string filepath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\defaults.mvdxml";
                this.ImportMVD(filepath);
                docTemplatePset = this.m_project.GetTemplate(new Guid("f74255a6-0c0e-4f31-84ad-24981db62461"));
                if(docTemplatePset == null)
                {
                    MessageBox.Show(this, "The required file information is missing. You may need to re-download the application from www.buildingsmart-tech.org.");
                    return;
                }
            }

            // select property sets within dialog
            DocConceptRoot docRoot = null;
            DocEntity docEntity = null; // all properties
            if(this.treeView.SelectedNode.Tag is DocConceptRoot)
            {
                docRoot = (DocConceptRoot)this.treeView.SelectedNode.Tag;
                docEntity = docRoot.ApplicableEntity;
                using (FormSelectProperty form = new FormSelectProperty(docEntity, this.m_project, true))
                {
                    if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        this.BuildConceptForPropertySets(docRoot, docTemplatePset, form.IncludedPropertySets);
                    }
                }
            }
            else if (this.treeView.SelectedNode.Tag is DocModelView)
            {
                // all entities
                DocModelView docView = (DocModelView)this.treeView.SelectedNode.Tag;
                foreach (DocConceptRoot docEachRoot in docView.ConceptRoots)
                {
                    docEntity = docEachRoot.ApplicableEntity;

                    // find all property sets directly linked to object
                    List<DocPropertySet> psets = new List<DocPropertySet>();
                    foreach(DocSection docSection in this.m_project.Sections)
                    {
                        foreach(DocSchema docSchema in docSection.Schemas)
                        {
                            foreach(DocPropertySet docPset in docSchema.PropertySets)
                            {
                                if ((docPset.PropertySetType == "PSET_OCCURRENCEDRIVEN" ||
                                    docPset.PropertySetType == "PSET_TYPEDRIVENOVERRIDE") &&
                                    !String.IsNullOrEmpty(docPset.ApplicableType) && docPset.ApplicableType.Equals(docEntity.Name))
                                {
                                    psets.Add(docPset);
                                }
                            }
                        }
                    }

                    this.BuildConceptForPropertySets(docEachRoot, docTemplatePset, psets.ToArray());
                }
            }
        }
Exemple #8
0
        private void buttonProperty_Click(object sender, EventArgs e)
        {
            using(FormSelectProperty form = new FormSelectProperty(this.m_base as DocEntity, this.m_project, false))
            {
                if(form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    string valueprop = "NominalValue";
                    switch(form.SelectedProperty.PropertyType)
                    {
                        case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
                            valueprop = "SetPointValue";
                            break;

                        case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE:
                            valueprop = "EnumerationValues";
                            break;

                        case DocPropertyTemplateTypeEnum.P_LISTVALUE:
                            valueprop = "ListValues";
                            break;

                            // other property types are not supported
                    }

                    string value = @"\" + this.m_base.Name + @".IsDefinedBy['" + form.SelectedPropertySet +
                        @"']\IfcRelDefinesByProperties.RelatingPropertyDefinition\IfcPropertySet.HasProperties['" + form.SelectedProperty +
                        @"']\" + form.SelectedProperty.GetEntityName() + @"." + valueprop + @"\" + form.SelectedProperty.PrimaryDataType;

                    CvtValuePath valuepath = CvtValuePath.Parse(value, this.m_map);
                    LoadValuePath(valuepath);
                }
            }
        }
Exemple #9
0
        private void toolStripMenuItemEditBuildConcepts_Click(object sender, EventArgs e)
        {
            DocTemplateDefinition docTemplatePset = this.m_project.GetTemplate(new Guid("f74255a6-0c0e-4f31-84ad-24981db62461"));
            if(docTemplatePset == null)
            {
                // import it
                string filepath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\defaults.mvdxml";
                this.ImportMVD(filepath);
                docTemplatePset = this.m_project.GetTemplate(new Guid("f74255a6-0c0e-4f31-84ad-24981db62461"));
                if(docTemplatePset == null)
                {
                    MessageBox.Show(this, "The required file information is missing. You may need to re-download the application from www.buildingsmart-tech.org.");
                    return;
                }
            }

            // select property sets within dialog
            DocConceptRoot docRoot = null;
            DocEntity docEntity = null; // all properties
            if(this.treeView.SelectedNode.Tag is DocConceptRoot)
            {
                docRoot = (DocConceptRoot)this.treeView.SelectedNode.Tag;
                docEntity = docRoot.ApplicableEntity;
            }

            using (FormSelectProperty form = new FormSelectProperty(docEntity, this.m_project, true))
            {
                if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    if (docRoot != null)
                    {
                        this.BuildConceptForPropertySets(docRoot, docTemplatePset, form.IncludedPropertySets);
                    }
                    else
                    {
                        // all entities
                        DocModelView docView = (DocModelView)this.treeView.SelectedNode.Tag;
                        foreach (DocConceptRoot docEachRoot in docView.ConceptRoots)
                        {
                            this.BuildConceptForPropertySets(docEachRoot, docTemplatePset, form.IncludedPropertySets);
                        }
                    }
                }
            }
        }