private static void AddSQX(ref Profile myPr, ref SRBA.SQX kitty, ref Editor ed) { Point2d St = new Point2d(kitty.BPDList[0].PK, kitty.BPDList[0].H), Ed; Point2d A = new Point2d(), B = new Point2d(), C = new Point2d(); SRBA.BPD preBPD = new SRBA.BPD(), curBPD = new SRBA.BPD(), nextBPD = new SRBA.BPD(); if (kitty.BPDList.Count <= 2) { curBPD = kitty.BPDList[0]; nextBPD = kitty.BPDList[1]; B = new Point2d(curBPD.PK, curBPD.H); C = new Point2d(nextBPD.PK, nextBPD.H); myPr.Entities.AddFixedTangent(B, C); return; } for (int i = 0; i < kitty.BPDList.Count; i++) { curBPD = kitty.BPDList[i]; if (i != 0) { Ed = new Point2d(curBPD.PK, curBPD.H); myPr.Entities.AddFixedTangent(St, Ed); St = Ed; } } for (int i = 1; i < kitty.BPDList.Count - 2; i++) { curBPD = kitty.BPDList[i]; if (curBPD.R == 0) { continue; } ProfileTangent ptA = (ProfileTangent)myPr.Entities[i]; ProfileTangent ptB = (ProfileTangent)myPr.Entities[i + 1]; VerticalCurveType ct = ptA.Grade < ptB.Grade ? VerticalCurveType.Sag : VerticalCurveType.Crest; double dr = 0.01; double RR = curBPD.R; while (true) { try { myPr.Entities.AddFreeSymmetricParabolaByRadius((uint)i, (uint)(i + 1), ct, RR); break; } catch { RR = RR - dr; continue; } } } //oProfile.Entities.AddFreeSymmetricParabolaByLength(oTangent1.EntityId, oTangent2.EntityId, VerticalCurveType.Sag, 900.1, true); }
private void CreateProfileFromEntities(ProfileEntity pentity, Autodesk.Civil.DatabaseServices.Profile Eprofile, Autodesk.Civil.DatabaseServices.Profile Nprofile, Point2d startPoint, Point2d endPoint) { using (Transaction tr = db.TransactionManager.StartTransaction()) { switch (pentity.EntityType) { case ProfileEntityType.Tangent: ProfileTangent pTangent = Nprofile.Entities.AddFixedTangent(startPoint, endPoint); break; case ProfileEntityType.Circular: ProfileCircular pCircular = pentity as ProfileCircular; ProfilePVI pPVI = Eprofile.PVIs.GetPVIAt(pCircular.PVIStation, pCircular.PVIElevation); double circleLength = pCircular.Length; ProfileCircular pCircularNew = Nprofile.Entities.AddFreeCircularCurveByPVIAndLength(pPVI, circleLength); break; case ProfileEntityType.ParabolaSymmetric: ProfileParabolaSymmetric pParabolaSymetric = pentity as ProfileParabolaSymmetric; double parabolaRadius = pParabolaSymetric.Radius; VerticalCurveType vcType = pParabolaSymetric.CurveType; ProfileParabolaSymmetric pParabolaSymetricNew = Nprofile.Entities.AddFixedSymmetricParabolaByTwoPointsAndRadius(startPoint, endPoint, vcType, parabolaRadius); break; case ProfileEntityType.ParabolaAsymmetric: ProfileParabolaAsymmetric pParabolaAsymmetric = pentity as ProfileParabolaAsymmetric; ProfilePVI paPVI = Eprofile.PVIs.GetPVIAt(pParabolaAsymmetric.PVIStation, pParabolaAsymmetric.PVIElevation); double pLength1 = pParabolaAsymmetric.AsymmetricLength1; double pLength2 = pParabolaAsymmetric.AsymmetricLength2; ProfileParabolaAsymmetric pParabolaAsymmetricNew = Nprofile.Entities.AddFreeAsymmetricParabolaByPVIAndLengths(paPVI, pLength1, pLength2); break; case ProfileEntityType.None: ProfileTangent nTangent = Nprofile.Entities.AddFixedTangent(startPoint, endPoint); break; } tr.Commit(); } }