Hi, I m looking to extract cant information from a rail alignment and to be able to edit it.
I am using a windows form to select an alignment and then a method, then du script procedes to excecute the code and finally export the results in an excel. I am able to get everything I need such as the radius, the curve direction... But when I try with the cant I get : "Operation not valid due to the current state of the object"
How can I get cant information?
sample of code working
public ArrayList GetEntities(Alignment al)
{
ArrayList lstEntity = new ArrayList();
foreach (_AcCDb::AlignmentEntity entity in al.Entities)
{
lstEntity.Add(entity);
}
return lstEntity;
}
sample of code not working
public ArrayList TEST_cant_RailInfo(Alignment al)
{
ArrayList lstTest = new ArrayList();
ArrayList lstStations = GetStartStations(al);
RailAlignmentInfo railInfo = al.RailAlignmentInfo;
foreach (double stn in lstStations)
{
MessageBox.Show(stn.ToString());
RailCANTInfo railCantInfo = railInfo.GetCantInfoAtStation(stn); //Operation is not valid due to the current state of the object.
lstTest.Add(railCantInfo.AppliedCANT);
}
return lstTest;
}
Hi,
It is hard to tell from this code snippet.
Do you try to read this data within a database transaction? Is it also recomended to check the type of the alignment, before do some rail alignment specific methods on it.
Try to check if you are able to get the stations listed in Alignment's CANTCriticalStaitons property:
https://help.autodesk.com/view/CIV3D/2023/ENU/?guid=2741ca6f-2f92-84d3-3469-d376a572e9a3
Can't find what you're looking for? Ask the community or share your knowledge.