protected static void parseFields(IfcWorkControl c, List <string> arrFields, ref int ipos, ReleaseVersion schema) { IfcControl.parseFields(c, arrFields, ref ipos, schema); if (schema == ReleaseVersion.IFC2x3) { c.mIdentification = arrFields[ipos++].Replace("'", ""); c.mSSCreationDate = ParserSTEP.ParseLink(arrFields[ipos++]); c.mCreators = ParserSTEP.SplitListLinks(arrFields[ipos++]); c.mPurpose = arrFields[ipos++]; c.mSSDuration = ParserSTEP.ParseDouble(arrFields[ipos++]); c.mSSTotalFloat = ParserSTEP.ParseDouble(arrFields[ipos++]); c.mSSStartTime = ParserSTEP.ParseLink(arrFields[ipos++]); c.mSSFinishTime = ParserSTEP.ParseLink(arrFields[ipos++]); string s = arrFields[ipos++]; if (s[0] == '.') { c.mWorkControlType = (IfcWorkControlTypeEnum)Enum.Parse(typeof(IfcWorkControlTypeEnum), s.Replace(".", "")); } c.mUserDefinedControlType = arrFields[ipos++]; } else { c.mCreationDate = IfcDateTime.parseSTEP(arrFields[ipos++]); c.mCreators = ParserSTEP.SplitListLinks(arrFields[ipos++]); c.mPurpose = arrFields[ipos++]; c.mDuration = arrFields[ipos++]; c.mTotalFloat = arrFields[ipos++]; c.mStartTime = IfcDateTime.parseSTEP(arrFields[ipos++]); c.mFinishTime = IfcDateTime.parseSTEP(arrFields[ipos++]); } }
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary) { base.parse(str, ref pos, release, len, dictionary); if (release < ReleaseVersion.IFC4) { mIdentification = ParserSTEP.StripString(str, ref pos, len); mSSCreationDate = ParserSTEP.StripLink(str, ref pos, len); Creators.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcPerson)); mPurpose = ParserSTEP.StripString(str, ref pos, len); mSSDuration = ParserSTEP.StripDouble(str, ref pos, len); mSSTotalFloat = ParserSTEP.StripDouble(str, ref pos, len); mSSStartTime = ParserSTEP.StripLink(str, ref pos, len); mSSFinishTime = ParserSTEP.StripLink(str, ref pos, len); string s = ParserSTEP.StripField(str, ref pos, len); if (s.StartsWith(".")) { Enum.TryParse <IfcWorkControlTypeEnum>(s.Replace(".", ""), true, out mWorkControlType); } mUserDefinedControlType = ParserSTEP.StripString(str, ref pos, len); } else { mCreationDate = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); Creators.AddRange(ParserSTEP.StripListLink(str, ref pos, len).ConvertAll(x => dictionary[x] as IfcPerson)); mPurpose = ParserSTEP.StripString(str, ref pos, len); mDuration = ParserSTEP.StripString(str, ref pos, len); mTotalFloat = ParserSTEP.StripString(str, ref pos, len); mStartTime = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); mFinishTime = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); } }
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary) { base.parse(str, ref pos, release, len, dictionary); ActualDate = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); EarlyDate = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); LateDate = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); ScheduleDate = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); }
protected override string BuildStringSTEP(ReleaseVersion release) { return(base.BuildStringSTEP(release) + "," + IfcDateTime.STEPAttribute(mActualDate) + "," + IfcDateTime.STEPAttribute(mEarlyDate) + "," + IfcDateTime.STEPAttribute(mLateDate) + "," + IfcDateTime.STEPAttribute(mScheduleDate)); }
public IfcWorkControl(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__Identification, IfcDateTime __CreationDate, IfcPerson[] __Creators, IfcLabel?__Purpose, IfcDuration?__Duration, IfcDuration?__TotalFloat, IfcDateTime __StartTime, IfcDateTime?__FinishTime) : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __Identification) { this._CreationDate = __CreationDate; this._Creators = new HashSet <IfcPerson>(__Creators); this._Purpose = __Purpose; this._Duration = __Duration; this._TotalFloat = __TotalFloat; this._StartTime = __StartTime; this._FinishTime = __FinishTime; }
protected override string BuildStringSTEP(ReleaseVersion release) { string result = "'" + ParserIfc.Encode(mName) + (string.IsNullOrEmpty(mVersion) ? "',$," : "','" + ParserIfc.Encode(mVersion) + "',") + (mPublisher == null? "$" : "#" + mPublisher.StepId); if (mDatabase.Release < ReleaseVersion.IFC4) { return(result + (mVersionDateSS == null ? ",$" : ",#" + mVersionDateSS.StepId) + ",(" + string.Join(",", mHasConstraintRelationships.Select(x => "#" + x.StepId)) + ")"); } return(result + "," + IfcDateTime.STEPAttribute(mVersionDate) + "," + (string.IsNullOrEmpty(mLocation) ? "$," : "'" + ParserIfc.Encode(mLocation) + "',") + (string.IsNullOrEmpty(mDescription) ? "$" : "'" + ParserIfc.Encode(mDescription) + "'")); }
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary) { mName = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); mVersion = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); mPublisher = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcActorSelect; if (release < ReleaseVersion.IFC4) { mVersionDateSS = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcCalendarDate; mLibraryReference.AddRange(ParserSTEP.StripListLink(str, ref pos, len).Select(x => dictionary[x] as IfcLibraryReference)); } else { mVersionDate = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); mLocation = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); mDescription = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); } }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: case 4: case 5: base.Parse(propIndex, value, nestedIndex); return; case 6: _creationDate = value.StringVal; return; case 7: _creators.InternalAdd((IfcPerson)value.EntityVal); return; case 8: _purpose = value.StringVal; return; case 9: _duration = value.StringVal; return; case 10: _totalFloat = value.StringVal; return; case 11: _startTime = value.StringVal; return; case 12: _finishTime = value.StringVal; return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary) { TimeStamp = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); string s = ParserSTEP.StripField(str, ref pos, len); if (s != "$") { List <string> ss = ParserSTEP.SplitLineFields(s.Substring(1, s.Length - 2)); for (int icounter = 0; icounter < ss.Count; icounter++) { IfcValue v = ParserIfc.parseValue(ss[icounter]); if (v != null) { mListValues.Add(v); } } } }
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options) { base.setJSON(obj, host, options); setAttribute(obj, "Identification", Identification); setAttribute(obj, "Name", Name); setAttribute(obj, "Description", Description); setAttribute(obj, "Location", Location); setAttribute(obj, "Purpose", Purpose); setAttribute(obj, "Revision", Revision); if (mDocumentOwner > 0) { obj["DocumentOwner"] = mDatabase[mDocumentOwner].getJson(this, options); } if (mEditors.Count > 0) { obj["Editors"] = new JArray(mEditors.ToList().ConvertAll(x => mDatabase[x].getJson(this, options))); } if (mCreationTime != DateTime.MinValue) { obj["CreationTime"] = IfcDateTime.FormatSTEP(CreationTime); } if (mLastRevisionTime != DateTime.MinValue) { obj["LastRevisionTime"] = IfcDateTime.FormatSTEP(LastRevisionTime); } setAttribute(obj, "ElectronicFormat", ElectronicFormat); if (mValidFrom != DateTime.MinValue) { obj["ValidFrom"] = IfcDate.FormatSTEP(ValidFrom); } if (mValidUntil != DateTime.MinValue) { obj["ValidUntil"] = IfcDate.FormatSTEP(ValidUntil); } if (mConfidentiality != IfcDocumentConfidentialityEnum.NOTDEFINED) { obj["Confidentiality"] = mConfidentiality.ToString(); } if (mStatus != IfcDocumentStatusEnum.NOTDEFINED) { obj["Status"] = mStatus.ToString(); } }
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary) { mIdentification = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); mName = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); mDescription = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); if (release < ReleaseVersion.IFC4) { mDocumentReferences = ParserSTEP.StripListLink(str, ref pos, len); } else { mLocation = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len)); } mPurpose = ParserSTEP.StripString(str, ref pos, len); mIntendedUse = ParserSTEP.StripString(str, ref pos, len); mScope = ParserSTEP.StripString(str, ref pos, len); mRevision = ParserSTEP.StripString(str, ref pos, len); mDocumentOwner = ParserSTEP.StripLink(str, ref pos, len); mEditors = ParserSTEP.StripListLink(str, ref pos, len); mCreationTime = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); mLastRevisionTime = IfcDateTime.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); if (release < ReleaseVersion.IFC4) { mSSElectronicFormat = ParserSTEP.StripLink(str, ref pos, len); } else { mElectronicFormat = ParserSTEP.StripString(str, ref pos, len); } mValidFrom = IfcDate.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); mValidUntil = IfcDate.ParseSTEP(ParserSTEP.StripField(str, ref pos, len)); string s = ParserSTEP.StripField(str, ref pos, len); if (s[0] == '.') { Enum.TryParse <IfcDocumentConfidentialityEnum>(s.Replace(".", ""), true, out mConfidentiality); } s = ParserSTEP.StripField(str, ref pos, len); if (s[0] == '.') { Enum.TryParse <IfcDocumentStatusEnum>(s.Replace(".", ""), true, out mStatus); } }
public void DateTimeTest() { var dt = new DateTime(2016, 3, 31, 10, 54, 2); IfcDate date = dt; Assert.AreEqual(date.ToString(), "2016-03-31"); Assert.AreEqual((DateTime)date, new DateTime(2016, 3, 31)); date = "2016-03-31"; Assert.AreEqual((DateTime)date, new DateTime(2016, 3, 31)); IfcDateTime dateTime = dt; Assert.AreEqual(dateTime.ToString(), "2016-03-31T10:54:02.0000000"); dateTime = "2016-03-31T10:54:02"; Assert.AreEqual((DateTime)dateTime, dt); IfcTimeStamp stamp = dt; Assert.AreEqual((TimeSpan)stamp, dt - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)); IfcTime time = dt; Assert.AreEqual(time.ToString(), "10:54:02.0000000"); time = "10:54:02.0000000"; var sTime = DateTime.Today.AddHours(10).AddMinutes(54).AddSeconds(2); Assert.AreEqual((DateTime)time, sTime); var span = new TimeSpan(9, 5, 32, 45, 12); IfcDuration duration = span; Assert.AreEqual(duration.ToString(), "P9DT5H32M45.012S"); Assert.AreEqual(span, (TimeSpan)duration); }
protected override string BuildStringSTEP() { return(base.BuildStringSTEP() + "," + IfcDateTime.STEPAttribute(mTimeStamp) + ",(#" + string.Join(",#", mListValues.ConvertAll(x => x.ToString())) + ")"); }
protected override string BuildStringSTEP() { string str = base.BuildStringSTEP() + "," + (mDatabase.mRelease == ReleaseVersion.IFC2x3 ? "'" + mIdentification + "'," + ParserSTEP.LinkToString(mSSCreationDate) : IfcDateTime.formatSTEP(mCreationDate)); if (mCreators.Count > 0) { str += ",(" + ParserSTEP.LinkToString(mCreators[0]); for (int icounter = 1; icounter < mCreators.Count; icounter++) { str += "," + ParserSTEP.LinkToString(mCreators[icounter]); } str += "),"; } else { str += ",$,"; } if (mDatabase.mRelease == ReleaseVersion.IFC2x3) { return(str + (mPurpose == "$" ? "$," : "'" + mPurpose + "',") + ParserSTEP.DoubleOptionalToString(mSSDuration) + "," + ParserSTEP.DoubleOptionalToString(mSSTotalFloat) + "," + ParserSTEP.LinkToString(mSSStartTime) + "," + ParserSTEP.LinkToString(mSSFinishTime) + ",." + mWorkControlType.ToString() + (mUserDefinedControlType == "$" ? ".,$" : ".,'" + mUserDefinedControlType + "'")); } return(str + (mPurpose == "$" ? "$," : "'" + mPurpose + "',") + mDuration + "," + mTotalFloat + "," + IfcDateTime.formatSTEP(mStartTime) + "," + IfcDateTime.formatSTEP(mFinishTime)); }
public IfcWorkSchedule(IfcGloballyUniqueId __GlobalId, IfcOwnerHistory __OwnerHistory, IfcLabel?__Name, IfcText?__Description, IfcLabel?__ObjectType, IfcIdentifier?__Identification, IfcDateTime __CreationDate, IfcPerson[] __Creators, IfcLabel?__Purpose, IfcDuration?__Duration, IfcDuration?__TotalFloat, IfcDateTime __StartTime, IfcDateTime?__FinishTime, IfcWorkScheduleTypeEnum?__PredefinedType) : base(__GlobalId, __OwnerHistory, __Name, __Description, __ObjectType, __Identification, __CreationDate, __Creators, __Purpose, __Duration, __TotalFloat, __StartTime, __FinishTime) { this._PredefinedType = __PredefinedType; }
protected override string BuildStringSTEP(ReleaseVersion release) { if (release < ReleaseVersion.IFC4) { return(""); //to be implemented } return(base.BuildStringSTEP(release) + ",'" + ParserIfc.Encode(mIdentification) + "','" + ParserIfc.Encode(mName) + (string.IsNullOrEmpty(mDescription) ? "',$," : "','" + ParserIfc.Encode(mDescription) + "',") + (release < ReleaseVersion.IFC4 ? (mDocumentReferences.Count == 0 ? "$," : "(#" + string.Join(",#", mDocumentReferences) + "),") : (string.IsNullOrEmpty(mLocation) ? "$," : "'" + ParserIfc.Encode(mLocation) + "',")) + (string.IsNullOrEmpty(mPurpose) ? "$," : "'" + ParserIfc.Encode(mPurpose) + "',") + (string.IsNullOrEmpty(mIntendedUse) ? "$," : "'" + ParserIfc.Encode(mIntendedUse) + "',") + (string.IsNullOrEmpty(mScope) ? "$," : "'" + ParserIfc.Encode(mScope) + "',") + (string.IsNullOrEmpty(mRevision) ? "$," : "'" + ParserIfc.Encode(mRevision) + "',") + ParserSTEP.LinkToString(mDocumentOwner) + (mEditors.Count == 0 ? ",$," : ",(#" + string.Join(",#", mEditors) + "),") + IfcDateTime.STEPAttribute(mCreationTime) + "," + IfcDateTime.STEPAttribute(mLastRevisionTime) + "," + (release < ReleaseVersion.IFC4 ? ParserSTEP.LinkToString(mSSElectronicFormat) : (string.IsNullOrEmpty(mElectronicFormat) ? "$" : "'" + ParserIfc.Encode(mElectronicFormat) + "'")) + (release < ReleaseVersion.IFC4 ? ",$,$" : "," + IfcDate.STEPAttribute(mValidFrom) + "," + IfcDate.STEPAttribute(mValidUntil)) + (mConfidentiality == IfcDocumentConfidentialityEnum.NOTDEFINED ? ",$," : ",." + mConfidentiality.ToString() + ".,") + (mStatus == IfcDocumentStatusEnum.NOTDEFINED ? "$" : "." + mStatus.ToString() + ".")); }
protected override string BuildStringSTEP(ReleaseVersion release) { return(base.BuildStringSTEP(release) + "," + (release < ReleaseVersion.IFC4 ? "'" + mIdentification + "'," + ParserSTEP.LinkToString(mSSCreationDate) : IfcDateTime.STEPAttribute(mCreationDate)) + (mCreators.Count > 0 ? ",(#" + string.Join(",#", Creators.ConvertAll(x => x.Index)) + ")," : ",$,") + (release < ReleaseVersion.IFC4 ? (mPurpose == "$" ? "$," : "'" + mPurpose + "',") + ParserSTEP.DoubleOptionalToString(mSSDuration) + "," + ParserSTEP.DoubleOptionalToString(mSSTotalFloat) + "," + ParserSTEP.LinkToString(mSSStartTime) + "," + ParserSTEP.LinkToString(mSSFinishTime) + ",." + mWorkControlType.ToString() + (mUserDefinedControlType == "$" ? ".,$" : ".,'" + mUserDefinedControlType + "'") : (mPurpose == "$" ? "$," : "'" + mPurpose + "',") + mDuration + "," + mTotalFloat + "," + IfcDateTime.STEPAttribute(mStartTime) + "," + IfcDateTime.STEPAttribute(mFinishTime))); }