Exemple #1
0
 protected override void setJSON(JObject obj, BaseClassIfc host, HashSet <int> processed)
 {
     base.setJSON(obj, host, processed);
     obj["MaterialLayers"] = new JArray(MaterialLayers.ToList().ConvertAll(x => x.getJson(this, processed)));
     setAttribute(obj, "LayerSetName", Name);
     setAttribute(obj, "Description", Description);
 }
        protected override void Process(IFCAnyHandle ifcMaterialLayerSet)
        {
            base.Process(ifcMaterialLayerSet);

            IList <IFCAnyHandle> ifcMaterialLayers =
                IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcMaterialLayerSet, "MaterialLayers");

            if (ifcMaterialLayers == null)
            {
                Importer.TheLog.LogError(ifcMaterialLayerSet.Id, "Expected at least 1 IfcMaterialLayer, found none.", false);
                return;
            }

            foreach (IFCAnyHandle ifcMaterialLayer in ifcMaterialLayers)
            {
                IFCMaterialLayer materialLayer = null;
                if (materialLayer is IFCMaterialLayerWithOffsets)
                {
                    materialLayer = IFCMaterialLayerWithOffsets.ProcessIFCMaterialLayerWithOffsets(ifcMaterialLayer);
                }
                else
                {
                    materialLayer = IFCMaterialLayer.ProcessIFCMaterialLayer(ifcMaterialLayer);
                }

                if (materialLayer != null)
                {
                    MaterialLayers.Add(materialLayer);
                }
            }

            LayerSetName = IFCImportHandleUtil.GetOptionalStringAttribute(ifcMaterialLayerSet, "LayerSetName", null);
        }
 internal override void parseJObject(JObject obj)
 {
     base.parseJObject(obj);
     MaterialLayers.AddRange(mDatabase.extractJArray <IfcMaterialLayer>(obj.GetValue("MaterialLayers", StringComparison.InvariantCultureIgnoreCase) as JArray));
     LayerSetName = extractString(obj.GetValue("LayerSetName", StringComparison.InvariantCultureIgnoreCase));
     Description  = extractString(obj.GetValue("Description", StringComparison.InvariantCultureIgnoreCase));
 }
Exemple #4
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "MaterialLayers") == 0)
         {
             foreach (XmlNode node in child.ChildNodes)
             {
                 IfcMaterialLayer l = mDatabase.ParseXml <IfcMaterialLayer>(node as XmlElement);
                 if (l != null)
                 {
                     MaterialLayers.Add(l);
                 }
             }
         }
     }
     if (xml.HasAttribute("LayerSetName"))
     {
         LayerSetName = xml.Attributes["LayerSetName"].Value;
     }
     if (xml.HasAttribute("Description"))
     {
         Description = xml.Attributes["Description"].Value;
     }
 }
        internal PrinterSettingsLayer GetMaterialLayer(string layerID)
        {
            if (string.IsNullOrEmpty(layerID))
            {
                return(null);
            }

            return(MaterialLayers.Where(layer => layer.LayerID == layerID).FirstOrDefault());
        }
 internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary)
 {
     MaterialLayers.AddRange(ParserSTEP.StripListLink(str, ref pos, len).Select(x => dictionary[x] as IfcMaterialLayer));
     mLayerSetName = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len));
     if (release != ReleaseVersion.IFC2x3)
     {
         mDescription = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len));
     }
 }
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(MaterialLayers != null ? MaterialLayers.ToStepValue() : "$");
            parameters.Add(LayerSetName != null ? LayerSetName.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
        internal SettingsLayer GetMaterialLayer(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return(null);
            }

            // Find the first matching layer in either the user or the OEM layers
            SettingsLayer layer = null;

            if (!MaterialLayers.TryGetValue(key, out layer))
            {
                OemProfile.MaterialLayers.TryGetValue(key, out layer);
            }

            return(layer);
        }