Esempio n. 1
0
 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);
     mRecurrencePattern = ParserSTEP.StripLink(str, ref pos, len);
     mStart             = IfcDate.ParseSTEP(ParserSTEP.StripString(str, ref pos, len));
     mFinish            = IfcDate.ParseSTEP(ParserSTEP.StripString(str, ref pos, len));
 }
Esempio n. 2
0
        internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary <int, BaseClassIfc> dictionary)
        {
            mName        = ParserSTEP.StripString(str, ref pos, len);
            mDescription = ParserSTEP.StripString(str, ref pos, len);
            string s = ParserSTEP.StripField(str, ref pos, len);

            if (s.StartsWith("IFC"))
            {
                mAppliedValue = ParserIfc.parseValue(s);
            }
            else
            {
                mAppliedValue = dictionary[ParserSTEP.ParseLink(s)] as IfcAppliedValueSelect;
            }
            mUnitBasis = ParserSTEP.StripLink(str, ref pos, len);
            if (release < ReleaseVersion.IFC4)
            {
                mSSApplicableDate = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcDateTimeSelect;
                mSSFixedUntilDate = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcDateTimeSelect;
            }
            else
            {
                mApplicableDate = IfcDate.ParseSTEP(ParserSTEP.StripString(str, ref pos, len));
                mFixedUntilDate = IfcDate.ParseSTEP(ParserSTEP.StripString(str, ref pos, len));
                mCategory       = ParserSTEP.StripString(str, ref pos, len);
                mCondition      = ParserSTEP.StripString(str, ref pos, len);
                s = ParserSTEP.StripField(str, ref pos, len);
                if (s.StartsWith("."))
                {
                    Enum.TryParse <IfcArithmeticOperatorEnum>(s.Replace(".", ""), true, out mArithmeticOperator);
                }
                mComponents = ParserSTEP.StripListLink(str, ref pos, len);
            }
        }
Esempio n. 3
0
 protected override string BuildStringSTEP(ReleaseVersion release)
 {
     return(base.BuildStringSTEP(release) + ",." + mPredefinedType.ToString() + ".,#" + mJurisdiction.StepId + ",(" +
            string.Join(",", mResponsiblePersons.Select(x => "#" + x.StepId)) +
            (release < ReleaseVersion.IFC4 ? "),#" + mLastUpdateDate : ")," + IfcDate.STEPAttribute(mLastUpdateDate)) +
            (mCurrentValue == null ? ",$" : ",#" + mCurrentValue.StepId) + (mOriginalValue == null ? ",$" : ",#" + mOriginalValue.StepId));
 }
Esempio n. 4
0
 internal IfcWorkTime(DatabaseIfc db, IfcRecurrencePattern recur, DateTime start, DateTime finish)
     : base(db)
 {
     if (recur != null)
     {
         mRecurrencePattern = recur.mIndex;
     }
     if (start != DateTime.MinValue)
     {
         mStart = IfcDate.convert(start);
     }
     if (finish != DateTime.MinValue)
     {
         mFinish = IfcDate.convert(finish);
     }
 }
Esempio n. 5
0
 internal IfcWorkTime(DatabaseIfc m, string name, IfcDataOriginEnum origin, string userOrigin, IfcRecurrencePattern recur, DateTime start, DateTime finish)
     : base(m, name, origin, userOrigin)
 {
     if (recur != null)
     {
         mRecurrencePattern = recur.mIndex;
     }
     if (start != DateTime.MinValue)
     {
         mStart = IfcDate.convert(start);
     }
     if (finish != DateTime.MinValue)
     {
         mFinish = IfcDate.convert(finish);
     }
 }
Esempio n. 6
0
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     setAttribute(obj, "Source", Source);
     setAttribute(obj, "Edition", Edition);
     if (mEditionDate != DateTime.MinValue)
     {
         setAttribute(obj, "EditionDate", IfcDate.FormatSTEP(EditionDate));
     }
     setAttribute(obj, "Name", Name);
     setAttribute(obj, "Description", Description);
     setAttribute(obj, "Location", Location);
     if (mReferenceTokens.Count > 0)
     {
         obj["ReferenceTokens"] = new JArray(ReferenceTokens);
     }
 }
Esempio n. 7
0
 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);
     Enum.TryParse <IfcInventoryTypeEnum>(ParserSTEP.StripField(str, ref pos, len).Replace(".", ""), true, out mPredefinedType);
     mJurisdiction = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcActorSelect;
     mResponsiblePersons.AddRange(ParserSTEP.StripListLink(str, ref pos, len).Select(x => dictionary[x] as IfcPerson));
     if (release < ReleaseVersion.IFC4)
     {
         mLastUpdateDateSS = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcCalendarDate;
     }
     else
     {
         mLastUpdateDate = IfcDate.ParseSTEP(ParserSTEP.StripString(str, ref pos, len));
     }
     mCurrentValue  = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcCostValue;
     mOriginalValue = dictionary[ParserSTEP.StripLink(str, ref pos, len)] as IfcCostValue;
 }
Esempio n. 8
0
 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() + "."));
 }
Esempio n. 9
0
 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();
     }
 }
Esempio n. 10
0
        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);
            }
        }
Esempio n. 11
0
 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);
     mIdentification       = ParserIfc.Decode(ParserSTEP.StripString(str, ref pos, len));
     mOriginalValue        = ParserSTEP.StripLink(str, ref pos, len);
     mCurrentValue         = ParserSTEP.StripLink(str, ref pos, len);
     mTotalReplacementCost = ParserSTEP.StripLink(str, ref pos, len);
     mOwner             = ParserSTEP.StripLink(str, ref pos, len);
     mUser              = ParserSTEP.StripLink(str, ref pos, len);
     mResponsiblePerson = ParserSTEP.StripLink(str, ref pos, len);
     if (release < ReleaseVersion.IFC4)
     {
         mIncorporationDateSS = ParserSTEP.StripLink(str, ref pos, len);
     }
     else
     {
         mIncorporationDate = IfcDate.ParseSTEP(ParserSTEP.StripString(str, ref pos, len));
     }
     mDepreciatedValue = ParserSTEP.StripLink(str, ref pos, len);
 }
Esempio n. 12
0
        protected override string BuildStringSTEP(ReleaseVersion release)
        {
            string result = base.BuildStringSTEP(release) + (mName == "$" ? ",$," : ",'" + mName + "',") + (mDescription == "$" ? "$," : "'" + mDescription + "',");

            if (mAppliedValue == null)
            {
                result += "$";
            }
            else
            {
                IfcValue val = mAppliedValue as IfcValue;
                if (val != null)
                {
                    result += val.ToString();
                }
                else
                {
                    result += ParserSTEP.LinkToString((mAppliedValue as BaseClassIfc).StepId);
                }
            }
            result += "," + ParserSTEP.LinkToString(mUnitBasis) + ",";
            if (release < ReleaseVersion.IFC4)
            {
                return(result + (mSSApplicableDate == null ? ",$" : ",#" + mSSApplicableDate.Index) + (mSSFixedUntilDate == null ? ",$" : ",#" + mSSFixedUntilDate.Index));
            }
            string str = "$";

            if (mComponents.Count > 0)
            {
                result += IfcDate.STEPAttribute(mApplicableDate) + "," + IfcDate.STEPAttribute(mFixedUntilDate);
                str     = "(" + ParserSTEP.LinkToString(mComponents[0]);
                for (int icounter = 1; icounter < mComponents.Count; icounter++)
                {
                    str += "," + ParserSTEP.LinkToString(mComponents[icounter]);
                }
                str += ")";
            }
            result += (mCategory == "$" ? ",$," : ",'" + mCategory + "',") + (mCondition == "$" ? "$," : "'" + mCondition + "',");
            return(result + (mArithmeticOperator == IfcArithmeticOperatorEnum.NONE ? "$," : "." + mArithmeticOperator.ToString() + ".,") + str);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
 protected override string BuildStringSTEP(ReleaseVersion release)
 {
     return(release < ReleaseVersion.IFC4 ? "" : base.BuildStringSTEP(release) + "," + ParserSTEP.LinkToString(mRecurrencePattern) + "," + IfcDate.STEPAttribute(mStart) + "," + IfcDate.STEPAttribute(mFinish));
 }
Esempio n. 15
0
 protected override string BuildStringSTEP(ReleaseVersion release)
 {
     return(release < ReleaseVersion.IFC4 ? "" :
            base.BuildStringSTEP(release) + (mRecurrencePattern == null ? ",$" : ",#" + mRecurrencePattern.StepId) + "," +
            IfcDate.STEPAttribute(mStartDate) + "," + IfcDate.STEPAttribute(mFinishDate));
 }
Esempio n. 16
0
 protected override string BuildStringSTEP(ReleaseVersion release)
 {
     return(base.BuildStringSTEP(release) + (string.IsNullOrEmpty(mIdentification) ? ",$," : ",'" + ParserIfc.Encode(mIdentification) + "',") + ParserSTEP.LinkToString(mOriginalValue) + "," + ParserSTEP.LinkToString(mCurrentValue) + "," +
            ParserSTEP.LinkToString(mTotalReplacementCost) + "," + ParserSTEP.LinkToString(mOwner) + "," +
            ParserSTEP.LinkToString(mUser) + "," + ParserSTEP.LinkToString(mResponsiblePerson) + "," +
            (mDatabase.Release < ReleaseVersion.IFC4 ? ParserSTEP.LinkToString(mIncorporationDateSS) : IfcDate.STEPAttribute(mIncorporationDate)) + "," + ParserSTEP.LinkToString(mDepreciatedValue));
 }