private BbCurveSegment(BbCurve bbCurve) { IfcCompositeCurveSegment = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = bbCurve.IfcCurve }; }
public void CompositeCurve2DTest() { var operandStack = new Stack(); operandStack.Push('{'); operandStack.Push(IfcGeom.CreatePolyLine(new List <double[]>() { new double[] { -0.5, -0.5 }, new double[] { 0, 0 } })); operandStack.Push(IfcGeom.CreatePolyLine(new List <double[]>() { new double[] { 0, 0 }, new double[] { 0.5, 0.5 } })); var operation = OperationName.COMPOSITE_CURVE2D; ConstructionOperations.ExecuteOperation(operation, operandStack); Assert.Single(operandStack); var response = operandStack.Pop(); Assert.IsType <IfcCompositeCurve>(response); IfcCompositeCurve curve = (IfcCompositeCurve)response; Assert.Equal(2, curve.Segments.Count); IfcCompositeCurveSegment curve0 = curve.Segments[0]; Assert.Equal(IfcTransitionCode.CONTINUOUS, curve0.Transition); Assert.True(curve0.SameSense.Value); Assert.Equal(-0.5, ((IfcPolyline)curve0.ParentCurve).Points[0].Coordinates[0].Value); Assert.Equal(-0.5, ((IfcPolyline)curve0.ParentCurve).Points[0].Coordinates[1].Value); Assert.Equal(0, ((IfcPolyline)curve0.ParentCurve).Points[1].Coordinates[0].Value); Assert.Equal(0, ((IfcPolyline)curve0.ParentCurve).Points[1].Coordinates[1].Value); IfcCompositeCurveSegment curve1 = curve.Segments[1]; Assert.Equal(IfcTransitionCode.CONTINUOUS, curve1.Transition); Assert.True(curve1.SameSense.Value); Assert.Equal(0, ((IfcPolyline)curve1.ParentCurve).Points[0].Coordinates[0].Value); Assert.Equal(0, ((IfcPolyline)curve1.ParentCurve).Points[0].Coordinates[1].Value); Assert.Equal(0.5, ((IfcPolyline)curve1.ParentCurve).Points[1].Coordinates[0].Value); Assert.Equal(0.5, ((IfcPolyline)curve1.ParentCurve).Points[1].Coordinates[1].Value); }
internal static IfcCompositeCurveSegment CreateCurveSegment(IfcStore model, Point3D p1, Point3D p2) { // Create PolyLine for rebar IfcPolyline pL = model.Instances.New <IfcPolyline>(); var startPoint = model.Instances.New <IfcCartesianPoint>(); startPoint.SetXYZ(p1.X, p1.Y, p1.Z); var EndPoint = model.Instances.New <IfcCartesianPoint>(); EndPoint.SetXYZ(p2.X, p2.Y, p2.Z); pL.Points.Add(startPoint); pL.Points.Add(EndPoint); IfcCompositeCurveSegment segment = model.Instances.New <IfcCompositeCurveSegment>(); segment.Transition = IfcTransitionCode.CONTINUOUS; segment.ParentCurve = pL; segment.SameSense = true; return(segment); }
public IXbimWire CreateWire(IfcCompositeCurveSegment compCurveSeg) { return(_engine.CreateWire(compCurveSeg)); }
public BbSlottedHoleProfile(double cToCDistance, double radius) { var cir1 = new IfcCircle { Position = new IfcAxis2Placement { Value = new IfcAxis2Placement2D { Location = new IfcCartesianPoint(cToCDistance / 2.0, 0), }, }, Radius = radius, }; var trimmed1 = new IfcTrimmedCurve { BasisCurve = cir1, Trim1 = new List<IfcTrimmingSelect>{new IfcTrimmingSelect{Value = new IfcParameterValue{Value = 270}}}, Trim2 = new List<IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 90 } } }, SenseAgreement = true, MasterRepresentation = IfcTrimmingPreference.PARAMETER, }; var line1 = new IfcPolyline { Points = new List<IfcCartesianPoint> { new IfcCartesianPoint(cToCDistance / 2.0, radius), new IfcCartesianPoint(cToCDistance / -2.0, radius), }, }; var cir2 = new IfcCircle { Position = new IfcAxis2Placement { Value = new IfcAxis2Placement2D { Location = new IfcCartesianPoint(cToCDistance / -2.0, 0), }, }, Radius = radius, }; var trimmed2 = new IfcTrimmedCurve { BasisCurve = cir2, Trim1 = new List<IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 90 } } }, Trim2 = new List<IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 270 } } }, SenseAgreement = true, MasterRepresentation = IfcTrimmingPreference.PARAMETER, }; var line2 = new IfcPolyline { Points = new List<IfcCartesianPoint> { new IfcCartesianPoint(cToCDistance / -2.0, -radius), new IfcCartesianPoint(cToCDistance / 2.0, -radius), }, }; var seg1 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = trimmed1, }; var seg2 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = line1, }; var seg3 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = trimmed2, }; var seg4 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = line2, }; var cCurve = new IfcCompositeCurve { Segments = new List<IfcCompositeCurveSegment> { seg1, seg2, seg3, seg4 }, SelfIntersect = EbInstanceModel.LOGICAL.dbTrue, }; _ifcProfileDef = new IfcArbitraryClosedProfileDef { ProfileType = IfcProfileTypeEnum.AREA, OuterCurve = cCurve, }; }
public IXbimWire CreateWire(IfcCompositeCurveSegment compCurveSeg) { return _engine.CreateWire(compCurveSeg); }
public void ArbitraryClosedProfileDefWithIncorrectPlacementTest() { using (var model = IfcStore.Create(new XbimEditorCredentials(), IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel)) { using (var txn = model.BeginTransaction("Create Column")) { IfcProject project = model.Instances.New <IfcProject>(); project.Initialize(ProjectUnits.SIUnitsUK); project.Name = "Test Project"; IfcColumn col = model.Instances.New <IfcColumn>(); col.Name = "Column With ArbitraryClosedProfileDef"; //Creating IfcArbitraryClosedProfileDef that will contain IfcCompositeCurve IfcArbitraryClosedProfileDef arbClosedProf = model.Instances.New <IfcArbitraryClosedProfileDef>(); //To create IfcArbitraryClosedProfileDef, we'll need to create IfcCompositeCurve //Creating IfcCompositeCurve IfcCompositeCurve myCompCurve = model.Instances.New <IfcCompositeCurve>(); //To Create IfcCompositeCurve, We'll need to create IfcCompositeCurveSegment //create IfcCompositeCurveSegment (polyline) IfcCompositeCurveSegment polylineSeg = model.Instances.New <IfcCompositeCurveSegment>(); //create IfcCompositeCurveSegment (arc) IfcCompositeCurveSegment arcSeg = model.Instances.New <IfcCompositeCurveSegment>(); //Creating IfcPolyline that will be the parent curve for IfcCompositeCurveSegment "polylineSeg" IfcPolyline myPolyline = model.Instances.New <IfcPolyline>(); //Creating Points to build the IfcPolyline IfcCartesianPoint p0 = model.Instances.New <IfcCartesianPoint>(); p0.SetXY(200, 100); IfcCartesianPoint p1 = model.Instances.New <IfcCartesianPoint>(); p1.SetXY(0, 100); IfcCartesianPoint p2 = model.Instances.New <IfcCartesianPoint>(); p2.SetXY(0, 0); IfcCartesianPoint p3 = model.Instances.New <IfcCartesianPoint>(); p3.SetXY(400, 0); IfcCartesianPoint p4 = model.Instances.New <IfcCartesianPoint>(); p4.SetXY(400, 600); IfcCartesianPoint p5 = model.Instances.New <IfcCartesianPoint>(); p5.SetXY(0, 600); IfcCartesianPoint p6 = model.Instances.New <IfcCartesianPoint>(); p6.SetXY(0, 500); IfcCartesianPoint p7 = model.Instances.New <IfcCartesianPoint>(); p7.SetXY(200, 500); //Adding points to the polyline myPolyline.Points.Add(p0); myPolyline.Points.Add(p1); myPolyline.Points.Add(p2); myPolyline.Points.Add(p3); myPolyline.Points.Add(p4); myPolyline.Points.Add(p5); myPolyline.Points.Add(p6); myPolyline.Points.Add(p7); //Assigning myPolyline to the IfcCompositeCurveSegment polylineSeg polylineSeg.ParentCurve = myPolyline; //Creating Arc using IfcTrimmedCurve IfcTrimmedCurve myArc = model.Instances.New <IfcTrimmedCurve>(); //To create IfcTrimmedCurve, We'll need to create IfcCircle and trim it using IfcTrimmingSelect IfcCircle myCirc = model.Instances.New <IfcCircle>(); myCirc.Radius = 213.554; IfcCartesianPoint cP = model.Instances.New <IfcCartesianPoint>(); cP.SetXY(125.1312, 300); //this should really be a 3D point IfcAxis2Placement3D plcmnt = model.Instances.New <IfcAxis2Placement3D>(); plcmnt.Location = cP; plcmnt.RefDirection = model.Instances.New <IfcDirection>(); plcmnt.RefDirection.SetXY(0, 1);//this should eb a 3D axis myCirc.Position = plcmnt; myArc.BasisCurve = myCirc; IfcTrimmingSelect v1 = p7; IfcTrimmingSelect v2 = p0; myArc.Trim1.Add(v1); myArc.Trim2.Add(v2); arcSeg.ParentCurve = myArc; //Adding the created two IfcCompositeCurveSegments to the IfcCompositeCurve myCompCurve.Segments.Add(arcSeg); myCompCurve.Segments.Add(polylineSeg); //Assigning IfcCompositeCurve "myCompCurve" to the IfcArbitraryClosedProfileDef arbClosedProf.OuterCurve = myCompCurve; arbClosedProf.ProfileType = IfcProfileTypeEnum.AREA; //model as a swept area solid IfcExtrudedAreaSolid body = model.Instances.New <IfcExtrudedAreaSolid>(); body.Depth = 2000; body.SweptArea = arbClosedProf; body.ExtrudedDirection = model.Instances.New <IfcDirection>(); body.ExtrudedDirection.SetXYZ(0, 0, 1); txn.Commit(); var solid = _xbimGeometryCreator.CreateSolid(body); Assert.IsTrue((int)solid.Volume == 239345450); } } }
internal static IfcSweptDiskSolid ProfileSweptDiskSolidByCompositeCurve(IfcStore model, Entity profPath, double raduis) { IfcSweptDiskSolid body = model.Instances.New <IfcSweptDiskSolid>(); IfcCompositeCurve compositeCurve = model.Instances.New <IfcCompositeCurve>(); compositeCurve.SelfIntersect = false; if (profPath is LinearPath) { LinearPath linearPath = profPath as LinearPath; IfcCompositeCurveSegment segment = model.Instances.New <IfcCompositeCurveSegment>(); IfcPolyline pLine = model.Instances.New <IfcPolyline>(); for (int i = 0; i < linearPath.Vertices.Length; i++) { IfcCartesianPoint point = model.Instances.New <IfcCartesianPoint>(); point.SetXYZ(linearPath.Vertices[i].X, linearPath.Vertices[i].Y, linearPath.Vertices[i].Z); pLine.Points.Add(point); } segment.ParentCurve = pLine; segment.Transition = IfcTransitionCode.CONTINUOUS; compositeCurve.Segments.Add(segment); } else if (profPath is CompositeCurve) { CompositeCurve compCurvePath = profPath as CompositeCurve; for (int i = 0; i < compCurvePath.CurveList.Count; i++) { IfcCompositeCurveSegment segment = model.Instances.New <IfcCompositeCurveSegment>(); //segment.Transition = i == compCurvePath.CurveList.Count - 1 ? IfcTransitionCode.DISCONTINUOUS : IfcTransitionCode.CONTINUOUS; segment.Transition = IfcTransitionCode.DISCONTINUOUS; if (compCurvePath.CurveList[i] is Line) { segment.SameSense = true; Line line = compCurvePath.CurveList[i] as Line; IfcPolyline pLine = model.Instances.New <IfcPolyline>(); for (int j = 0; j < line.Vertices.Length; j++) { IfcCartesianPoint point = model.Instances.New <IfcCartesianPoint>(); point.SetXYZ(line.Vertices[j].X, line.Vertices[j].Y, line.Vertices[j].Z); pLine.Points.Add(point); } segment.ParentCurve = pLine; compositeCurve.Segments.Add(segment); } else { Arc arc = compCurvePath.CurveList[i] as Arc; IfcTrimmedCurve trimmedCurve = model.Instances.New <IfcTrimmedCurve>(); IfcCircle cir = model.Instances.New <IfcCircle>(e => e.Radius = arc.Radius); cir.Position = model.Instances.New <IfcAxis2Placement3D>(e => e.Location = model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(arc.Center.X, arc.Center.Y, arc.Center.Z))); trimmedCurve.BasisCurve = cir; trimmedCurve.Trim1.Add(model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(arc.StartPoint.X, arc.StartPoint.Y, arc.StartPoint.Z))); trimmedCurve.Trim2.Add(model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(arc.EndPoint.X, arc.EndPoint.Y, arc.EndPoint.Z))); trimmedCurve.SenseAgreement = arc.Plane.AxisZ == Vector3D.AxisZ ? true : false; //segment.SameSense = arc.Plane.AxisZ == Vector3D.AxisZ ? false : true; trimmedCurve.MasterRepresentation = IfcTrimmingPreference.CARTESIAN; segment.ParentCurve = trimmedCurve; compositeCurve.Segments.Add(segment); } } } else if (profPath is Circle) { IfcCircle ifcCirc = model.Instances.New <IfcCircle>(); } body.Directrix = compositeCurve; body.Radius = raduis; body.InnerRadius = raduis * .75; return(body); }
internal static IfcSurfaceCurveSweptAreaSolid ProfileSurfaceSweptSolidCreateByCompositeCurve(IfcStore model, IfcProfileDef prof, Entity profPath) { IfcSurfaceCurveSweptAreaSolid body = model.Instances.New <IfcSurfaceCurveSweptAreaSolid>(); IfcCompositeCurve compositeCurve = model.Instances.New <IfcCompositeCurve>(); if (profPath is LinearPath) { LinearPath linearPath = profPath as LinearPath; IfcCompositeCurveSegment segment = model.Instances.New <IfcCompositeCurveSegment>(); IfcPolyline pLine = model.Instances.New <IfcPolyline>(); for (int i = 0; i < linearPath.Vertices.Length; i++) { IfcCartesianPoint point = model.Instances.New <IfcCartesianPoint>(); point.SetXYZ(linearPath.Vertices[i].X, linearPath.Vertices[i].Y, linearPath.Vertices[i].Z); pLine.Points.Add(point); } segment.ParentCurve = pLine; segment.Transition = IfcTransitionCode.CONTINUOUS; compositeCurve.Segments.Add(segment); } else { CompositeCurve compCurvePath = profPath as CompositeCurve; for (int i = 0; i < compCurvePath.CurveList.Count; i++) { if (compCurvePath.CurveList[i] is Line) { Line line = compCurvePath.CurveList[i] as Line; IfcCompositeCurveSegment segment = model.Instances.New <IfcCompositeCurveSegment>(); IfcPolyline pLine = model.Instances.New <IfcPolyline>(); for (int j = 0; j < line.Vertices.Length; j++) { IfcCartesianPoint point = model.Instances.New <IfcCartesianPoint>(); point.SetXYZ(line.Vertices[j].X, line.Vertices[j].Y, line.Vertices[j].Z); pLine.Points.Add(point); } segment.ParentCurve = pLine; segment.Transition = IfcTransitionCode.CONTINUOUS; compositeCurve.Segments.Add(segment); } else { Arc arc = compCurvePath.CurveList[i] as Arc; IfcCompositeCurveSegment segment = model.Instances.New <IfcCompositeCurveSegment>(); IfcTrimmedCurve trimmedCurve = model.Instances.New <IfcTrimmedCurve>(); IfcCircle cir = model.Instances.New <IfcCircle>(e => e.Radius = arc.Radius); cir.Position = model.Instances.New <IfcAxis2Placement3D>(e => e.Location = model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(arc.Center.X, arc.Center.Y, arc.Center.Z))); trimmedCurve.BasisCurve = cir; trimmedCurve.Trim1.Add(model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(arc.StartPoint.X, arc.StartPoint.Y, arc.StartPoint.Z))); trimmedCurve.Trim2.Add(model.Instances.New <IfcCartesianPoint>(p => p.SetXYZ(arc.EndPoint.X, arc.EndPoint.Y, arc.EndPoint.Z))); trimmedCurve.SenseAgreement = arc.Plane.AxisZ == Vector3D.AxisZ ? false : true; trimmedCurve.MasterRepresentation = IfcTrimmingPreference.CARTESIAN; segment.ParentCurve = trimmedCurve; segment.Transition = IfcTransitionCode.CONTINUOUS; compositeCurve.Segments.Add(segment); } } } body.Directrix = compositeCurve; body.SweptArea = prof; var plane = model.Instances.New <IfcPlane>(); plane.Position = model.Instances.New <IfcAxis2Placement3D>(); plane.Position.Location = model.Instances.New <IfcCartesianPoint>(); //plane.Position.Location.SetXYZ(profPath.X, lstPoints[0].Y, lstPoints[0].Z); plane.Position.Axis = model.Instances.New <IfcDirection>(); plane.Position.Axis.SetXYZ(0, 0, 1); plane.Position.RefDirection = model.Instances.New <IfcDirection>(); plane.Position.RefDirection.SetXYZ(1, 0, 0); body.ReferenceSurface = plane; //body.FixedReference.SetXYZ(1, 0, 0); return(body); }
public BbSlottedHoleProfile(double cToCDistance, double radius) { var cir1 = new IfcCircle { Position = new IfcAxis2Placement { Value = new IfcAxis2Placement2D { Location = new IfcCartesianPoint(cToCDistance / 2.0, 0), }, }, Radius = radius, }; var trimmed1 = new IfcTrimmedCurve { BasisCurve = cir1, Trim1 = new List <IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 270 } } }, Trim2 = new List <IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 90 } } }, SenseAgreement = true, MasterRepresentation = IfcTrimmingPreference.PARAMETER, }; var line1 = new IfcPolyline { Points = new List <IfcCartesianPoint> { new IfcCartesianPoint(cToCDistance / 2.0, radius), new IfcCartesianPoint(cToCDistance / -2.0, radius), }, }; var cir2 = new IfcCircle { Position = new IfcAxis2Placement { Value = new IfcAxis2Placement2D { Location = new IfcCartesianPoint(cToCDistance / -2.0, 0), }, }, Radius = radius, }; var trimmed2 = new IfcTrimmedCurve { BasisCurve = cir2, Trim1 = new List <IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 90 } } }, Trim2 = new List <IfcTrimmingSelect> { new IfcTrimmingSelect { Value = new IfcParameterValue { Value = 270 } } }, SenseAgreement = true, MasterRepresentation = IfcTrimmingPreference.PARAMETER, }; var line2 = new IfcPolyline { Points = new List <IfcCartesianPoint> { new IfcCartesianPoint(cToCDistance / -2.0, -radius), new IfcCartesianPoint(cToCDistance / 2.0, -radius), }, }; var seg1 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = trimmed1, }; var seg2 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = line1, }; var seg3 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = trimmed2, }; var seg4 = new IfcCompositeCurveSegment { Transition = IfcTransitionCode.CONTSAMEGRADIENTSAMECURVATURE, SameSense = true, ParentCurve = line2, }; var cCurve = new IfcCompositeCurve { Segments = new List <IfcCompositeCurveSegment> { seg1, seg2, seg3, seg4 }, SelfIntersect = EbInstanceModel.LOGICAL.dbTrue, }; _ifcProfileDef = new IfcArbitraryClosedProfileDef { ProfileType = IfcProfileTypeEnum.AREA, OuterCurve = cCurve, }; }