/// <summary> /// binds the data from the FILE_NAME object of the STEP HEADER section /// </summary> /// <param name="sdo"></param> /// <param name="header"></param> private void bindFileName(StepDataObject sdo, iso_10303_28_header header) { if (sdo == null) { throw new ArgumentNullException("sdo"); } if (header == null) { throw new ArgumentNullException("header"); } if (sdo.ObjectName != "FILE_NAME") { throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "bindFileName(StepDataObject, iso_10303_28_header) should only be called for StepDataObject FILE_NAME, and not {0}", sdo.ObjectName)); } if (sdo.Properties == null || sdo.Properties.Count != 7) { throw new ArgumentException("sdo does not have the correct number of properties"); } header.name = (string)sdo.Properties[0].Value; header.time_stamp = (DateTime)sdo.Properties[1].Value; header.author = (string)((IList <StepValue>)sdo.Properties[2].Value)[0].Value; //FIXME only copies first value in the array as header.author is a string, and not a list header.organization = (string)((IList <StepValue>)sdo.Properties[3].Value)[0].Value; //FIXME only copies first value in the array as header.author is a string, and not a list header.preprocessor_version = (string)sdo.Properties[4].Value; header.originating_system = (string)sdo.Properties[5].Value; header.authorization = (string)sdo.Properties[6].Value; }
private StepDataObject ExtractFileName(iso_10303 iso10303) { if (iso10303 == null) { throw new ArgumentNullException("iso10303"); } iso_10303_28_header header = iso10303.iso_10303_28_header; if (header == null) { throw new ArgumentNullException("iso10303.iso_10303_28_header"); } StepDataObject sdo = new StepDataObject(); sdo.ObjectName = "FILE_NAME"; sdo.Properties.Add(StepValue.CreateString(header.name)); sdo.Properties.Add(StepValue.CreateDate(header.time_stamp)); sdo.Properties.Add(StepValue.CreateArray(StepValue.CreateString(header.author))); //FIXME header.organization is a string and not a list, but the Step file expects an array sdo.Properties.Add(StepValue.CreateArray(StepValue.CreateString(header.organization))); sdo.Properties.Add(StepValue.CreateString(header.preprocessor_version)); sdo.Properties.Add(StepValue.CreateString(header.originating_system)); sdo.Properties.Add(StepValue.CreateString(header.authorization)); return(sdo); }
/// <summary> /// binds the data from the FILE_NAME object of the STEP HEADER section /// </summary> /// <param name="sdo"></param> /// <param name="header"></param> private void bindFileName(StepDataObject sdo, iso_10303_28_header header){ if(sdo == null) throw new ArgumentNullException("sdo"); if(header == null) throw new ArgumentNullException("header"); if(sdo.ObjectName != "FILE_NAME") throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, "bindFileName(StepDataObject, iso_10303_28_header) should only be called for StepDataObject FILE_NAME, and not {0}", sdo.ObjectName)); if(sdo.Properties == null || sdo.Properties.Count != 7) throw new ArgumentException("sdo does not have the correct number of properties"); header.name = (string)sdo.Properties[0].Value; header.time_stamp = (DateTime)sdo.Properties[1].Value; header.author = (string)((IList<StepValue>)sdo.Properties[2].Value)[0].Value; //FIXME only copies first value in the array as header.author is a string, and not a list header.organization = (string)((IList<StepValue>)sdo.Properties[3].Value)[0].Value; //FIXME only copies first value in the array as header.author is a string, and not a list header.preprocessor_version = (string)sdo.Properties[4].Value; header.originating_system = (string)sdo.Properties[5].Value; header.authorization = (string)sdo.Properties[6].Value; }