Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I reference this post,
add widening to alignment,
but the transition isn't smooth。
I know using command “Addwidening” create widening manually,
I can modify the command settings “LinearTransitionAroundCurves.NumberOfSegments”,
and then the transition is smooth 。
How to modify the code to create a smooth transition?
thanks!
[CommandMethod("TestOffsetAlign")]
public void offalign()
{
var doc = Application.DocumentManager.MdiActiveDocument;
var ed = doc.Editor;
var db = doc.Database;
var civDoc = CivilApplication.ActiveDocument;
var entOpts = new PromptEntityOptions("\nSelect an alignment to offset:");
entOpts.SetRejectMessage("...not an alignment, try again!");
entOpts.AddAllowedClass(typeof(Alignment), true);
var entSel = ed.GetEntity(entOpts);
if (entSel.Status != PromptStatus.OK)
return;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
var align1 = (Alignment)tr.GetObject(entSel.ObjectId, OpenMode.ForRead);
var align2id = Alignment.CreateOffsetAlignment("OffsetAlignment", align1.ObjectId, 10.0, align1.StyleId);
var align2 = (Alignment)tr.GetObject(align2id, OpenMode.ForWrite);
var oInfo = align2.OffsetAlignmentInfo;
oInfo.AddWidening(150, 250, 20);
var r2 = oInfo.Regions[1];
r2.EntryTransition.TransitionType = Autodesk.Civil.TransitionType.CurveLineCurve;
CurveLineCurveTransitionDescription entrydesc = (CurveLineCurveTransitionDescription)r2.EntryTransition.TransitionDescription;
entrydesc.StartStation = 100;
entrydesc.Length = 50;
entrydesc.EntryCurveRadius = 15;
entrydesc.ExitCurveRadius = 15;
r2.ExitTransition.TransitionType = Autodesk.Civil.TransitionType.Linear;
LinearTransitionDescription exitdesc = (LinearTransitionDescription)r2.ExitTransition.TransitionDescription;
exitdesc.StartStation = 250;
exitdesc.Length = 250;
tr.Commit();
}
}
王磊
您认为此帖子是否有用?欢迎为此帖点赞。
您的问题是否已得到解答?请点击“接受解答”按钮。
Solved! Go to Solution.