Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys
I have problem with editing start and end station of Corridor Baseline regions,my code doing change but after the finishing the command the changes will not takeplaces ,Can anyone help
thank
here its my code:
[CommandMethod("CutRegion2")]
public void CutRegion2()
{
Document doc = appy.DocumentManager.MdiActiveDocument;
CivilDocument cdoc = CivilApplication.ActiveDocument;
Editor ed = appy.DocumentManager.MdiActiveDocument.Editor;
Transaction ts = null;
PointGroup pg = null;
Alignment al = null;
using (ts = appy.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction())
{
using (DocumentLock dl = doc.LockDocument())
{
PromptEntityOptions opt = null;
PromptDoubleOptions odt1 = null;
PromptDoubleOptions odt2 = null;
SO so = null;
bool flag = true;
while (flag)
{
opt = null;
so = null;
al = null;
odt1 = null;
odt2 = null;
opt = new PromptEntityOptions("\nPlease Select A Corridor");
opt.SetRejectMessage("\n... Error, The Selection Must be Corridor!");
opt.AddAllowedClass(typeof(Corridor), false);
PromptEntityResult ent = ed.GetEntity(opt);
if (ent.Status != PromptStatus.OK)
{
flag = false;
return;
}
Corridor cor = (Corridor)ent.ObjectId.GetObject(OpenMode.ForWrite);
foreach (Baseline bl in cor.Baselines)
{
al = ts.GetObject(bl.AlignmentId, OpenMode.ForWrite) as Alignment;
foreach (BaselineRegion br in bl.BaselineRegions)
{
PromptPointOptions ppo = new PromptPointOptions("\nplease, pick a point");
ppo.AllowNone = true;
PromptPointResult ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK)
return;
double sta1 =0;
double sta2 =0;
double off=0;
al.StationOffset(ppr.Value.X,ppr.Value.Y,ref Sta1,off);
ppo = new PromptPointOptions("\nplease, pick a point");
ppo.AllowNone = true;
ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK)
return;
al.StationOffset(ppr.Value.X,ppr.Value.Y,ref Sta2,off);
try
{
br.SartStation(sta1);
br.EndStation(sta2);
//cor.Rebuild();
}
catch (System.Exception ex)
{
}
break;
}
break;
}
}
}
//=====================================================================================================
ts.Commit();
}
}
Solved! Go to Solution.