Cannot create IfcAlignmentCant
eihov opened this issue · 2 comments
Hi,
I would like to create a IfcAlignmetCant object. To create a IfcAlignmentVertical object is easy, then I use the following method:
When I want to create IfcAlignmetCant I cannot do this the same way since the constructor for IfcAlignmentCant that only takes "database" does not exist:
Is there is a different way I cant create IfcAlignmentCant, or could this constructor be implemented? I see that there is a second constructor that takes ifcLinearPlacement and GradientCurve, is this the correct constructor and how do I use this? When I use the constructor without arguments then the IfcAlignmetCant object will not show up in the Ifc file (since it is not connected to the database?)
I am quite new to Ifc and GeometryGym, so any help is very appreciated. Thank you for your time.
Sincerely
Eirik Hovind
Mail: eirik.hovind@railcomplete.com
Hi Erik,
Thanks for raising this question. In general, it's best to use the constructors with multiple parameters, these are typically the "mandatory" attributes that need to be provided.
I take it you're testing the IFC4x3RC schema? This has an improved cant definition.
Here's some snippet of code to generate a basic (single alignment in horizontal, vertical and cant). There are other overloaded constructors for some of these concepts. Let me know if it helps,
Jon
DatabaseIfc db = new DatabaseIfc(ReleaseVersion.IFC4X3_RC2);
db.Factory.Options.AngleUnitsInRadians = false;
db.Factory.Options.GenerateOwnerHistory = false;
IfcRailway railway = new IfcRailway(db) { Name = "Test Railway", Guid = new Guid("{BD25606D-4F14-44EC-909B-F094D89D93E6}") };
IfcProject project = new IfcProject(railway, "Chardon Bridge Road, Ceder Creek Replacement", IfcUnitAssignment.Length.Metre) { GlobalId = "2VgFtp_1zCO98zJG_O3kln" };
IfcCartesianPoint alignmentOrigin = new IfcCartesianPoint(db, 0, 0, 0);
railway.ObjectPlacement = new IfcLocalPlacement(new IfcAxis2Placement3D(alignmentOrigin));
IfcAlignment alignment = new IfcAlignment(railway) { Name = "TestRailwayAlignment", GlobalId = "1F78QPlVv6N9AnnF$LSkp$" };
alignment.ObjectPlacement = railway.ObjectPlacement;
//IfcCartesianPoint alignmentOrigin = new IfcCartesianPoint(db, 1000, 2000, 3000);
IfcAlignmentHorizontalSegment arcSegment = new IfcAlignmentHorizontalSegment(new IfcCartesianPoint(db,0,0),0, 1200, 1200, 300, IfcAlignmentHorizontalSegmentTypeEnum.CIRCULARARC);
IfcCompositeCurve horizontalCurve = null;
IfcAlignmentHorizontal alignmentHorizontal = new IfcAlignmentHorizontal(alignment.ObjectPlacement, 0, out horizontalCurve, arcSegment);
alignmentHorizontal.GlobalId = "0sEEGBFgr289x9s$R$T7N9";
alignment.AddAggregated(alignmentHorizontal);
IfcAlignmentVerticalSegment verticalSegment = new IfcAlignmentVerticalSegment(db, 0, 300, 123, 0.0004, 0.0004, IfcAlignmentVerticalSegmentTypeEnum.CONSTANTGRADIENT);
IfcGradientCurve gradientCurve = null;
IfcAlignmentVertical alignmentVertical = new IfcAlignmentVertical(alignment.ObjectPlacement, horizontalCurve, 0, out gradientCurve, verticalSegment);
alignmentVertical.GlobalId = "2YR0TUxTv75RC2XxZVmlj8";
alignment.AddAggregated(alignmentVertical);
IfcAlignmentCantSegment cantSegment = new IfcAlignmentCantSegment(db, 0, 300, -0.044, 0.044, IfcAlignmentCantSegmentTypeEnum.CONSTANTCANT);
IfcSegmentedReferenceCurve cantCurve = null;
IfcAlignmentCant alignmentCant = new IfcAlignmentCant(alignment.ObjectPlacement, 1.5, new List<IfcAlignmentCantSegment>() { cantSegment }, gradientCurve, 0, out cantCurve);
alignment.AddAggregated(alignmentCant);
Hi, thanks for the information!
Yes, I am exploring the new IFC4x3RC schema. With your example I managed to export a basic alignment with cant. I also explored the other overloaded constructors for alignment that includes the IfcCurve in the constructor. I noticed these constructors also automatically set the shapeRepresentationCurve.
With all the information it is easy to get a bit lost, but now it makes more sense!
Eirik