This commit is contained in:
Jon Mirtschin 2022-07-23 11:03:29 +10:00
Родитель f4187135dd
Коммит 60f87d5db4
8 изменённых файлов: 125 добавлений и 73 удалений

Просмотреть файл

@ -1410,7 +1410,6 @@ namespace GeometryGym.Ifc
internal SET<IfcRepresentationContext> mRepresentationContexts = new SET<IfcRepresentationContext>();// : OPTIONAL SET [1:?] OF IfcRepresentationContext;
private IfcUnitAssignment mUnitsInContext;// : OPTIONAL IfcUnitAssignment; IFC2x3 not Optional
//INVERSE
internal SET<IfcRelDefinesByProperties> mIsDefinedBy = new SET<IfcRelDefinesByProperties>();
internal SET<IfcRelDeclares> mDeclares = new SET<IfcRelDeclares>();
public string ObjectType { get { return mObjectType; } set { mObjectType = value; } }
@ -2017,7 +2016,7 @@ namespace GeometryGym.Ifc
public IfcCrewResourceType(DatabaseIfc db, string name, IfcCrewResourceTypeEnum type) : base(db) { Name = name; PredefinedType = type; }
}
[Serializable]
public abstract partial class IfcCsgPrimitive3D : IfcGeometricRepresentationItem, IfcBooleanOperand, IfcCsgSelect /*ABSTRACT SUPERTYPE OF (ONEOF (IfcBlock ,IfcRectangularPyramid ,IfcRightCircularCone ,IfcRightCircularCylinder ,IfcSphere))*/
public abstract partial class IfcCsgPrimitive3D : IfcGeometricRepresentationItem, IfcBooleanOperand, IfcCsgSelect /*ABSTRACT SUPERTYPE OF (ONEOF (IfcBlock, IfcRectangularPyramid, IfcRightCircularCone, IfcRightCircularCylinder, IfcSphere))*/
{
private IfcAxis2Placement3D mPosition;// : IfcAxis2Placement3D;
public IfcAxis2Placement3D Position { get { return mPosition; } set { mPosition = value; } }

Просмотреть файл

@ -167,8 +167,8 @@ namespace GeometryGym.Ifc
[Serializable]
public partial class IfcRationalBSplineSurfaceWithKnots : IfcBSplineSurfaceWithKnots
{
internal LIST<List<double>> mWeightsData = new LIST<List<double>>();// : LIST [2:?] OF LIST [2:?] OF IfcReal;
public LIST<List<double>> WeightsData { get { return new LIST<List<double>>(mWeightsData); } }
internal List<List<double>> mWeightsData = new List<List<double>>();// : LIST [2:?] OF LIST [2:?] OF IfcReal;
public List<List<double>> WeightsData { get { return mWeightsData; } }
internal IfcRationalBSplineSurfaceWithKnots() : base() { }
internal IfcRationalBSplineSurfaceWithKnots(DatabaseIfc db, IfcRationalBSplineSurfaceWithKnots s, DuplicateOptions options) : base(db, s, options)
{

Просмотреть файл

@ -219,7 +219,7 @@ namespace GeometryGym.Ifc
}
}
}
public abstract partial class IfcBSplineCurve : IfcBoundedCurve //SUPERTYPE OF(IfcBSplineCurveWithKnots)
public abstract partial class IfcBSplineCurve
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
@ -230,11 +230,13 @@ namespace GeometryGym.Ifc
array.Add(point.getJson(this, options));
obj["ControlPointsList"] = array;
obj["CurveForm"] = CurveForm.ToString();
obj["ClosedCurve"] = ClosedCurve.ToString();
obj["SelfIntersect"] = SelfIntersect.ToString();
if(ClosedCurve != IfcLogicalEnum.UNKNOWN)
obj["ClosedCurve"] = ClosedCurve == IfcLogicalEnum.TRUE;
if (SelfIntersect != IfcLogicalEnum.UNKNOWN)
obj["SelfIntersect"] = SelfIntersect == IfcLogicalEnum.TRUE;
}
}
public partial class IfcBSplineCurveWithKnots : IfcBSplineCurve
public partial class IfcBSplineCurveWithKnots
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
@ -250,7 +252,56 @@ namespace GeometryGym.Ifc
obj["KnotSpec"] = mKnotSpec.ToString();
}
}
public partial class IfcBuilding : IfcFacility
public abstract partial class IfcBSplineSurface
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
base.setJSON(obj, host, options);
obj["UDegree"] = UDegree;
obj["VDegree"] = VDegree;
JArray array = new JArray();
foreach (var points in ControlPointsList)
{
JArray sub = new JArray();
foreach (var point in points)
sub.Add(point.getJson(this, options));
array.Add(sub);
}
obj["ControlPointsList"] = array;
obj["SurfaceForm"] = SurfaceForm.ToString();
if(UClosed != IfcLogicalEnum.UNKNOWN)
obj["UClosed"] = UClosed == IfcLogicalEnum.TRUE;
if(VClosed != IfcLogicalEnum.UNKNOWN)
obj["VClosed"] = VClosed == IfcLogicalEnum.TRUE;
if (SelfIntersect != IfcLogicalEnum.UNKNOWN)
obj["SelfIntersect"] = SelfIntersect == IfcLogicalEnum.TRUE;
}
}
public partial class IfcBSplineSurfaceWithKnots
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
base.setJSON(obj, host, options);
JArray array = new JArray();
foreach (int i in mUMultiplicities)
array.Add(i);
obj["UMultiplicities"] = array;
array = new JArray();
foreach (int i in mVMultiplicities)
array.Add(i);
obj["VMultiplicities"] = array;
array = new JArray();
foreach (int i in mUKnots)
array.Add(i);
obj["UKnots"] = array;
array = new JArray();
foreach (int i in mVKnots)
array.Add(i);
obj["VKnots"] = array;
obj["KnotSpec"] = mKnotSpec.ToString();
}
}
public partial class IfcBuilding
{
internal override void parseJObject(JObject obj)
{

Просмотреть файл

@ -55,7 +55,7 @@ namespace GeometryGym.Ifc
obj["FbsmFaces"] = new JArray(mFbsmFaces.ConvertAll(x => x.getJson(this, options)));
}
}
public partial class IfcFaceBound : IfcTopologicalRepresentationItem //SUPERTYPE OF (ONEOF (IfcFaceOuterBound))
public partial class IfcFaceBound
{
internal override void parseJObject(JObject obj)
{
@ -74,7 +74,16 @@ namespace GeometryGym.Ifc
obj["Orientation"] = Orientation;
}
}
public partial class IfcFillAreaStyle : IfcPresentationStyle, IfcPresentationStyleSelect
public partial class IfcFaceSurface
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
base.setJSON(obj, host, options);
obj["FaceSurface"] = FaceSurface.getJson(this, options);
obj["SameSense"] = SameSense;
}
}
public partial class IfcFillAreaStyle
{
internal override void parseJObject(JObject obj)
{

Просмотреть файл

@ -60,7 +60,34 @@ namespace GeometryGym.Ifc
Enum.TryParse<IfcRailTypeEnum>(token.Value<string>(), true, out mPredefinedType);
}
}
public partial class IfcRectangleHollowProfileDef : IfcRectangleProfileDef
public partial class IfcRationalBSplineCurveWithKnots
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
base.setJSON(obj, host, options);
JArray array = new JArray();
foreach (double weight in mWeightsData)
array.Add(weight);
obj["WeightsData"] = array;
}
}
public partial class IfcRationalBSplineSurfaceWithKnots
{
protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
{
base.setJSON(obj, host, options);
JArray array = new JArray();
foreach (List<double> weights in mWeightsData)
{
JArray sub = new JArray();
foreach (double weight in weights)
sub.Add(weight);
array.Add(sub);
}
obj["WeightsData"] = array;
}
}
public partial class IfcRectangleHollowProfileDef
{
internal override void parseJObject(JObject obj)
{

Просмотреть файл

@ -327,19 +327,9 @@ namespace GeometryGym.Ifc
{
protected override string BuildStringSTEP(ReleaseVersion release)
{
string str = base.BuildStringSTEP(release) + ",(" + ParserSTEP.IntToString(mUMultiplicities[0]);
for (int jcounter = 1; jcounter < mUMultiplicities.Count; jcounter++)
str += "," + ParserSTEP.IntToString(mUMultiplicities[jcounter]);
str += "),(" + ParserSTEP.IntToString(mVMultiplicities[0]);
for (int jcounter = 1; jcounter < mVMultiplicities.Count; jcounter++)
str += "," + ParserSTEP.IntToString(mVMultiplicities[jcounter]);
str += "),(" + ParserSTEP.DoubleToString(mUKnots[0]);
for (int jcounter = 1; jcounter < mUKnots.Count; jcounter++)
str += "," + ParserSTEP.DoubleToString(mUKnots[jcounter]);
str += "),(" + ParserSTEP.DoubleToString(mVKnots[0]);
for (int jcounter = 1; jcounter < mVKnots.Count; jcounter++)
str += "," + ParserSTEP.DoubleToString(mVKnots[jcounter]);
return str + "),." + mKnotSpec.ToString() + ".";
return base.BuildStringSTEP(release) + ",(" + string.Join(",", mUMultiplicities) + "),(" +
string.Join(",", mVMultiplicities) + "),(" + string.Join(",", mUKnots.Select(x=>ParserSTEP.DoubleToString(x))) + "),(" +
string.Join(",", mVKnots.Select(x=>ParserSTEP.DoubleToString(x))) + "),." + mKnotSpec.ToString() + ".";
}
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary<int,BaseClassIfc> dictionary)
{

Просмотреть файл

@ -185,9 +185,12 @@ namespace GeometryGym.Ifc
{
protected override string BuildStringSTEP(ReleaseVersion release)
{
string s = (release < ReleaseVersion.IFC4 ? "" : (string.IsNullOrEmpty(mName) ? ",$," : ",'" + ParserIfc.Encode(mName) + "',") +
(string.IsNullOrEmpty(mDescription) ? "$," : "'" + ParserIfc.Encode(mDescription) + "',") + (string.IsNullOrEmpty(mCategory) ? "$," : "'" + ParserIfc.Encode(mCategory) + "',") + ParserSTEP.DoubleOptionalToString(mPriority));
return "#" + mMaterial.StepId + "," + ParserSTEP.DoubleToString(mLayerThickness) + "," + ParserIfc.LogicalToString(mIsVentilated) + s;
return (mMaterial == null ? "$," : "#" + mMaterial.StepId + ",") + ParserSTEP.DoubleToString(mLayerThickness) + "," +
ParserIfc.LogicalToString(mIsVentilated) + (release < ReleaseVersion.IFC4 ? "" :
(string.IsNullOrEmpty(mName) ? ",$," : ",'" + ParserIfc.Encode(mName) + "',") +
(string.IsNullOrEmpty(mDescription) ? "$," : "'" + ParserIfc.Encode(mDescription) + "',") +
(string.IsNullOrEmpty(mCategory) ? "$," : "'" + ParserIfc.Encode(mCategory) + "',") +
ParserSTEP.DoubleOptionalToString(mPriority));
}
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary<int,BaseClassIfc> dictionary)
{

Просмотреть файл

@ -83,61 +83,34 @@ namespace GeometryGym.Ifc
mKnots.AddRange(knots);
}
private void adoptKnotsAndMultiplicities(NurbsCurve nc)
{
double tol = (nc.Knots[nc.Knots.Count - 1] - nc.Knots[0]) / Math.Max(1000, nc.Knots.Count) / 1000;
{
var knotList = nc.Knots;
int count = knotList.Count;
if (nc.IsPeriodic)
{
int kc = 1;
if (nc.Knots[1] - nc.Knots[0] < tol)
kc = 2;
else
{
mKnots.Add(nc.Knots[0] - (nc.Knots[1] - nc.Knots[0]));
mKnotMultiplicities.Add(1);
}
double knot = nc.Knots[0];
for (int icounter = 1; icounter < nc.Knots.Count; icounter++)
mKnots.Add(knot - (nc.Knots[1] - knot));
mKnotMultiplicities.Add(1);
for(int u = 0; u < count; u++)
{
double t = nc.Knots[icounter];
if ((t - knot) > tol)
{
mKnots.Add(knot);
mKnotMultiplicities.Add(kc);
knot = t;
kc = 1;
}
else
kc++;
}
mKnots.Add(knot);
if (kc > 1)
mKnotMultiplicities.Add(kc + 1);
else
{
mKnotMultiplicities.Add(1);
mKnots.Add(knot + (knot - nc.Knots[nc.Knots.Count - 2]));
mKnotMultiplicities.Add(1);
int multiplicity = knotList.KnotMultiplicity(u);
mKnots.Add(knotList[u]);
mKnotMultiplicities.Add(multiplicity);
u += multiplicity - 1;
}
knot = nc.Knots[count - 1];
mKnots.Add(knot + (knot - nc.Knots[count - 2]));
mKnotMultiplicities.Add(1);
}
else
{
int kc = 2;
double knot = nc.Knots[0];
for (int icounter = 1; icounter < nc.Knots.Count; icounter++)
for (int u = 0; u < count; u++)
{
double t = nc.Knots[icounter];
if ((t - knot) > tol)
{
mKnots.Add(knot);
mKnotMultiplicities.Add(kc);
knot = t;
kc = 1;
}
else
kc++;
int multiplicity = knotList.KnotMultiplicity(u) + (u == 0 || u + 1 == count ? 1 : 0);
mKnots.Add(knotList[u]);
mKnotMultiplicities.Add(multiplicity);
u += multiplicity - 1;
}
mKnots.Add(knot);
mKnotMultiplicities.Add(kc + 1);
}
}
}