This commit is contained in:
Jon Mirtschin 2024-08-23 21:38:27 +10:00
Родитель e429810ca7
Коммит 8364a847e5
18 изменённых файлов: 62 добавлений и 43 удалений

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

@ -153,11 +153,13 @@ namespace GeometryGym.Ifc
mRelease = schema;
mModelView = view;
#if (RHINO || GH)
//mModelSIScale = 1 / Utils.mLengthConversion[(int) GeometryGym.GGRhino.GGRhino.ActiveUnits()];
Rhino.RhinoDoc doc = Rhino.RhinoDoc.ActiveDoc;
if (doc != null)
{
Tolerance = doc.ModelAbsoluteTolerance;
double tol = doc.ModelAbsoluteTolerance;
if (tol * GGRhino.GGRhino.mScaleFromCAD > 0.0001)
tol = 0.0001 / GGRhino.GGRhino.mScaleFromCAD;
Tolerance = tol;
ToleranceAngleRadians = Math.Min(Math.PI/1800, doc.ModelAngleToleranceRadians);
}
#endif
@ -590,7 +592,7 @@ namespace GeometryGym.Ifc
internal IfcProduct ConstructProduct(string className, IfcObjectDefinition host, IfcObjectPlacement placement, IfcProductDefinitionShape representation, IfcDistributionSystem system)
{
string str = className, predefinedTypeConstant = "";
string str = className.Trim(), predefinedTypeConstant = "";
ReleaseVersion release = mDatabase.Release;
if (string.IsNullOrEmpty(str))
return null;
@ -2601,7 +2603,7 @@ namespace GeometryGym.Ifc
BaseClassIfc o = obj.Object;
if (o is IfcPropertySet || o is IfcMaterialConstituentSet || o is IfcPropertySetTemplate)
secondPass.Add(obj);
else if (o is IfcTessellatedFaceSet || o is IfcPolyLoop || o is IfcFacetedBrep)
else if (o is IfcTriangulatedFaceSet || o is IfcPolyLoop || o is IfcFacetedBrep)
threadSafeConstructors.Add(obj);
else
firstPass.Add(obj);

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

@ -895,15 +895,22 @@ namespace GeometryGym.Ifc
catch (Exception) { }
}
IfcCompositeCurve compositeCurve = new IfcCompositeCurve(curveSegments);
var subContext = mDatabase.Factory.SubContext(IfcGeometricRepresentationSubContext.SubContextIdentifier.FootPrint);
IfcShapeRepresentation shapeRepresentation = new IfcShapeRepresentation(subContext, compositeCurve, ShapeRepresentationType.Curve2D);
if (alignment != null)
{
var subContext = mDatabase.Factory.SubContext(IfcGeometricRepresentationSubContext.SubContextIdentifier.FootPrint);
IfcShapeRepresentation shapeRepresentation = new IfcShapeRepresentation(subContext, compositeCurve, ShapeRepresentationType.Curve2D);
if (alignment.Representation == null)
alignment.Representation = new IfcProductDefinitionShape(shapeRepresentation);
else
alignment.Representation.Representations.Add(shapeRepresentation);
}
else
{
if(Representation == null)
Representation = new IfcProductDefinitionShape(shapeRepresentation);
else
Representation.Representations.Add(shapeRepresentation);
}
return compositeCurve;
}

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

@ -635,13 +635,11 @@ namespace GeometryGym.Ifc
{
private IfcBuildingElementProxyTypeEnum mPredefinedType = IfcBuildingElementProxyTypeEnum.NOTDEFINED; // : OPTIONAL IfcBuildingElementProxyTypeEnum;
//Ifc2x3 internal IfcElementCompositionEnum mCompositionType = IfcElementCompositionEnum.NA;// : OPTIONAL IfcElementCompositionEnum;
public IfcBuildingElementProxyTypeEnum PredefinedType { get { return mPredefinedType; } set { mPredefinedType = validPredefinedType<IfcBuildingElementProxyTypeEnum>(value, mDatabase == null ? ReleaseVersion.IFC4X3 : mDatabase.Release); } }
public override string Name { get { return base.Name; } set { base.Name = (string.IsNullOrEmpty(value) ? "NOTDEFINED" : value); } }
internal IfcBuildingElementProxy() : base() { }
internal IfcBuildingElementProxy(DatabaseIfc db, IfcBuildingElementProxy p, DuplicateOptions options) : base(db, p, options) { PredefinedType = p.PredefinedType; }
public IfcBuildingElementProxy(IfcObjectDefinition host, IfcObjectPlacement p, IfcProductDefinitionShape r) : base(host, p, r) { Name = "NOTDEFINED"; }
public IfcBuildingElementProxy(IfcObjectDefinition host, IfcObjectPlacement p, IfcProductDefinitionShape r) : base(host, p, r) { }
public IfcBuildingElementProxy(IfcProduct host, IfcMaterialProfileSetUsage profile, IfcAxis2Placement3D placement, double length) : base(host, profile, placement,length) { }
}
[Serializable]

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

@ -718,10 +718,11 @@ namespace GeometryGym.Ifc
}
}
public IfcGroup(DatabaseIfc db, string name) : base(db) { Name = name; }
public IfcGroup(IfcSpatialElement spatial, string name) : base(spatial.Database)
public IfcGroup(IfcSpatialElement spatial, string name) : base(spatial.Database)
{
Name = name;
if (!(this is IfcZone))
var release = (spatial.mDatabase == null ? ReleaseVersion.IFC4 : spatial.mDatabase.Release);
if (!(release < ReleaseVersion.IFC4 && spatial is IfcZone))
{
if (spatial.mDatabase.Release <= ReleaseVersion.IFC4X3_RC1)
{

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

@ -112,9 +112,10 @@ namespace GeometryGym.Ifc
}
public IfcPhysicalQuantity FindQuantity(string name)
{
foreach(IfcElementQuantity qset in mIsDefinedBy.ConvertAll(x=>x.RelatingPropertyDefinition).OfType<IfcElementQuantity>())
List<IfcElementQuantity> elementQuantities = mIsDefinedBy.SelectMany(x => x.RelatingPropertyDefinition.OfType<IfcElementQuantity>()).ToList();
foreach(IfcElementQuantity quantitySet in elementQuantities)
{
IfcPhysicalQuantity quantity = qset[name];
IfcPhysicalQuantity quantity = quantitySet[name];
if (quantity != null)
return quantity;
}
@ -464,7 +465,7 @@ namespace GeometryGym.Ifc
Type enumType = fieldInfo.FieldType;
if (enumType != null)
{
FieldInfo fi = enumType.GetField(predefinedTypeConstant);
FieldInfo fi = enumType.GetField(predefinedTypeConstant.ToUpper());
if (fi == null)
{
objectType = predefinedTypeConstant;

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

@ -2133,7 +2133,7 @@ namespace GeometryGym.Ifc
public Dictionary<string, IfcProperty> HasProperties { get { return mHasProperties; } }
internal IfcPropertySet() : base() { }
protected IfcPropertySet(IfcObjectDefinition obj) : base(obj.mDatabase,"") { Name = this.GetType().Name; new IfcRelDefinesByProperties(obj, this); }
protected IfcPropertySet(IfcObjectDefinition obj) : base(obj.mDatabase, "") { Name = this.GetType().Name; new IfcRelDefinesByProperties(obj, this); }
protected IfcPropertySet(IfcTypeObject type) : base(type.mDatabase,"") { Name = this.GetType().Name; type.HasPropertySets.Add(this); }
public IfcPropertySet(IfcPropertySet pset) : base(pset)
{

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

@ -2384,6 +2384,7 @@ namespace GeometryGym.Ifc
public string RepresentationType { get { return mRepresentationType; } set { mRepresentationType = value; } }
public SET<RepresentationItem> Items { get { return mItems; } }
public IfcRepresentationMap RepresentationMap { get { return mRepresentationMap; } set { mRepresentationMap = value; } }
public IfcPresentationLayerAssignment LayerAssignment { get { return mLayerAssignment; } set { mLayerAssignment = value; } }
public SET<IfcProductDefinitionShape> OfProductRepresentation { get { return mOfProductRepresentation; } }

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

@ -532,8 +532,9 @@ namespace GeometryGym.Ifc
public override object Value { get { return mValue; } set { mValue = Convert.ToDouble(value); } }
public override Type ValueType { get { return typeof(double); } }
public double Measure { get { return mValue; } set { mValue = value; } }
public string Format { get; set; } = "{0:0.0################}";
protected IfcMeasureValue(double value) { mValue = value; }
public override string ToString() { return this.GetType().Name.ToUpper() + "(" + ParserSTEP.DoubleToString(mValue) + ")"; }
public override string ToString() { return this.GetType().Name.ToUpper() + "(" + ParserSTEP.DoubleToString(mValue, Format) + ")"; }
public override string ValueString { get { return Value.ToString(); } }
}
[Serializable]
@ -901,8 +902,9 @@ namespace GeometryGym.Ifc
public double Magnitude { get; set; }
public override object Value { get { return Magnitude; } set { Magnitude = Convert.ToDouble(value); } }
public override Type ValueType { get { return typeof(double); } }
public string Format { get; set; } = "{0:0.0################}";
public IfcReal(double value) { Magnitude = value; }
public override string ToString() { return "IFCREAL(" + ParserSTEP.DoubleToString(Magnitude) + ")"; }
public override string ToString() { return "IFCREAL(" + ParserSTEP.DoubleToString(Magnitude, Format) + ")"; }
}
[Serializable]
public partial class IfcText : IfcSimpleValue

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

@ -540,7 +540,7 @@ namespace GeometryGym.Ifc
string result = className;
if (indexOf > 0)
{
result = className.Substring(0, indexOf);
result = className.Substring(0, indexOf).Trim();
string remainder = predefinedConstant = className.Substring(indexOf + 1);
indexOf = remainder.IndexOf('(');
if (indexOf > 0)

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

@ -103,7 +103,7 @@ namespace GeometryGym.Ifc
public IfcPropertyListValue<IfcURIReference> MessagingIDs { set { value.Name = "MessagingIDs"; addProperty(value); } }
public Pset_Address(IfcBuilding instance) : base(instance) { }
public Pset_Address(IfcActor instance) : base(instance) { }
public Pset_Address(IfcFacility instance) : base(instance) { }
public Pset_Address(IfcSite instance) : base(instance) { }
}
public partial class Pset_AirSideSystemInformation : IfcPropertySet
{

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

@ -339,7 +339,8 @@ namespace GeometryGym.Ifc
}
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary<int, BaseClassIfc> dictionary)
{
mTangentialContinuity = ParserIfc.StripLogical(str, ref pos, len);
if (str[0] != '\'')
mTangentialContinuity = ParserIfc.StripLogical(str, ref pos, len);
mStartTag = ParserSTEP.Decode(ParserSTEP.StripString(str, ref pos, len));
mEndTag = ParserSTEP.Decode(ParserSTEP.StripString(str, ref pos, len));
}
@ -403,10 +404,10 @@ namespace GeometryGym.Ifc
{
protected override string BuildStringSTEP(ReleaseVersion release)
{
return base.BuildStringSTEP(release) + "," + ParserSTEP.DoubleOptionalToString(mStartDistAlong) + "," +
ParserSTEP.DoubleOptionalToString(mHorizontalLength) + "," + ParserSTEP.DoubleToString(mStartCantLeft) + "," +
ParserSTEP.DoubleOptionalToString(mEndCantLeft) + "," + ParserSTEP.DoubleToString(mStartCantRight) + "," +
ParserSTEP.DoubleOptionalToString(mEndCantRight) + (release == ReleaseVersion.IFC4X3_RC3 ? ",$" : "") +
return base.BuildStringSTEP(release) + "," + formatLength(mStartDistAlong) + "," +
formatLength(mHorizontalLength) + "," + formatLength(mStartCantLeft) + "," +
formatLength(mEndCantLeft) + "," + formatLength(mStartCantRight) + "," +
formatLength(mEndCantRight) + (release == ReleaseVersion.IFC4X3_RC3 ? ",$" : "") +
",." + mPredefinedType.ToString() + ".";
}
internal override void parse(string str, ref int pos, ReleaseVersion release, int len, ConcurrentDictionary<int, BaseClassIfc> dictionary)

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

@ -1583,6 +1583,8 @@ namespace GeometryGym.Ifc
protected override string BuildStringSTEP(ReleaseVersion release)
{
string name = Name;
if(string.IsNullOrEmpty(name) && this is IfcBuildingElementProxy)
name = "NOTDEFINED";
return "'" + mGlobalId + (mOwnerHistory == null ? "',$" : "',#" + mOwnerHistory.StepId) +
(string.IsNullOrEmpty(name) ? ",$," : ",'" + ParserSTEP.Encode(name) + "',") +
(string.IsNullOrEmpty(mDescription) ? "$" : "'" + ParserSTEP.Encode(mDescription) + "'");

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

@ -330,11 +330,15 @@ namespace GeometryGym.STEP
return new IfcBinary(array);
}
public static string BoolToString(bool b) { return (b ? ".T." : ".F."); }
public static string DoubleToString(double d)
public static string DoubleToString(double d)
{
return DoubleToString(d, "{0:0.0################}");
}
public static string DoubleToString(double d, string format)
{
if (double.IsNaN(d) || double.IsInfinity(d))
return "0.0";
return String.Format(CultureInfo.InvariantCulture, "{0:0.0################}", d);
return String.Format(CultureInfo.InvariantCulture, format, d);
}
public static string DoubleExponentialString(double d)
{

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

@ -20,8 +20,8 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("24.05.08.0")]
[assembly: AssemblyFileVersion("24.05.08.0")]
[assembly: AssemblyVersion("24.08.23.0")]
[assembly: AssemblyFileVersion("24.08.23.0")]
[assembly: AssemblyTitle("GeometryGymIFC")]
[assembly: AssemblyDescription("C# classes to generate and parse buildingSMART IFC (Industry Foundation Class) files")]

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

@ -20,8 +20,8 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("24.05.08.0")]
[assembly: AssemblyFileVersion("24.05.08.0")]
[assembly: AssemblyVersion("24.08.23.0")]
[assembly: AssemblyFileVersion("24.08.23.0")]
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

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

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>GeometryGymIFC_Core</PackageId>
<Version>24.05.08</Version>
<Version>24.08.23</Version>
<Authors>Geometry Gym</Authors>
<Product>GeometryGymIFC_Core</Product>
<Description>.Net Standard 2.0 C# classes to generate and parse buildingSMART IFC (Industry Foundation Class) files
@ -14,8 +14,8 @@ License https://github.com/GeometryGym/GeometryGymIFC/blob/master/LICENSE</Descr
<PackageProjectUrl></PackageProjectUrl>
<RepositoryUrl>https://github.com/GeometryGym/GeometryGymIFC</RepositoryUrl>
<PackageTags>BIM, IFC, openBIM</PackageTags>
<AssemblyVersion>24.05.08.0</AssemblyVersion>
<FileVersion>24.05.08.0</FileVersion>
<AssemblyVersion>24.08.23.0</AssemblyVersion>
<FileVersion>24.08.23.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

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

@ -29,8 +29,8 @@ namespace GeometryGym.Ifc
{
public partial class IfcBSplineCurve
{
protected IfcBSplineCurve(DatabaseIfc m, NurbsCurve nonRationalCurve, bool twoD)
: this(m, nonRationalCurve.Degree)
protected IfcBSplineCurve(DatabaseIfc db, NurbsCurve nonRationalCurve, bool twoD)
: this(db, nonRationalCurve.Degree)
{
int ilast = nonRationalCurve.Points.Count - (nonRationalCurve.IsPeriodic ? mDegree : 0);
if (twoD)
@ -38,7 +38,7 @@ namespace GeometryGym.Ifc
for (int icounter = 0; icounter < ilast; icounter++)
{
Point3d p3 = nonRationalCurve.Points[icounter].Location;
mControlPointsList.Add(new IfcCartesianPoint(m, new Point2d(p3.X, p3.Y)));
mControlPointsList.Add(new IfcCartesianPoint(db, new Point2d(p3.X, p3.Y)));
}
if (nonRationalCurve.IsPeriodic)
{
@ -49,7 +49,7 @@ namespace GeometryGym.Ifc
else
{
for (int icounter = 0; icounter < ilast; icounter++)
mControlPointsList.Add(new IfcCartesianPoint(m, nonRationalCurve.Points[icounter].Location));
mControlPointsList.Add(new IfcCartesianPoint(db, nonRationalCurve.Points[icounter].Location));
if (nonRationalCurve.IsPeriodic)
{
for (int icounter = 0; icounter < mDegree; icounter++)
@ -66,16 +66,16 @@ namespace GeometryGym.Ifc
mKnotMultiplicities.AddRange(multiplicities);
mKnots.AddRange(knots);
}
internal IfcBSplineCurveWithKnots(DatabaseIfc m, NurbsCurve nc, bool twoD)
: base(m, nc, twoD)
internal IfcBSplineCurveWithKnots(DatabaseIfc db, NurbsCurve nc, bool twoD)
: base(db, nc, twoD)
{
if (mDatabase.mModelView == ModelView.Ifc4Reference)
throw new Exception("Invalid Model View for IfcBSplineCurveWithKnots : " + mDatabase.ModelView.ToString());
ClosedCurve = nc.IsClosed ? IfcLogicalEnum.TRUE : IfcLogicalEnum.FALSE;
adoptKnotsAndMultiplicities(nc);
}
public IfcBSplineCurveWithKnots(DatabaseIfc m, int degree, List<Point2d> controlPoints, IEnumerable<int> multiplicities, IEnumerable<double> knots, IfcKnotType knotSpec) :
base(degree, controlPoints.ConvertAll(x => new IfcCartesianPoint(m, x)))
public IfcBSplineCurveWithKnots(DatabaseIfc db, int degree, List<Point2d> controlPoints, IEnumerable<int> multiplicities, IEnumerable<double> knots, IfcKnotType knotSpec) :
base(degree, controlPoints.ConvertAll(x => new IfcCartesianPoint(db, x)))
{
if (mDatabase.mModelView != ModelView.Ifc4Reference)
throw new Exception("Invalid Model View for IfcBSplineCurveWithKnots : " + mDatabase.ModelView.ToString());

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

@ -34,7 +34,7 @@ namespace GeometryGym.Ifc
public Point2d Location2d() { return new Point2d(mCoordinateX, double.IsNaN( mCoordinateY) ? 0 : mCoordinateY); }
internal Point3d Coordinates3d { set { mCoordinateX = value.X; mCoordinateY = value.Y; mCoordinateZ = value.Z; } }
internal Point2d Coordinates2d { set { mCoordinateX = value.X; mCoordinateY = value.Y; mCoordinateZ = double.NaN; } }
internal IfcCartesianPoint(DatabaseIfc m, Point3d pt) : base(m) { Coordinates3d = pt; }
internal IfcCartesianPoint(DatabaseIfc db, Point3d pt) : base(db) { Coordinates3d = pt; }
internal void adopt(Point3d pt)
{
if (this.is2D)
@ -42,7 +42,7 @@ namespace GeometryGym.Ifc
else
Coordinates3d = pt;
}
internal IfcCartesianPoint(DatabaseIfc m, Point2d pt) : base(m) { Coordinates2d = pt; }
internal IfcCartesianPoint(DatabaseIfc db, Point2d pt) : base(db) { Coordinates2d = pt; }
}
public partial class IfcCartesianPointList
{