Message 1 of 1
Corridor Solids trough API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to implement the Export Corridor to Solids command in .NET so I can run the command over multiple corridors and to add parameter information as property sets. I have readed this forum post:
And I am able to iterate trough the Applied Subassemblies. I understand the concept of creating regions from the CalculatedShapes and create a 3D solid from it, but how can I test if a CalculatedShape is current in the previous calculated station? In the forum post above they test if the shape codes is current, but that is not a tight test because shapes can have the same code. Has anyone an idea? Is there a (hidden) way to do this test?
Thanks in advance!
My current testing code:
using (Corridor corridor = corrId.GetObject(OpenMode.ForRead) as Corridor)
{
BaselineCollection corrBaselines = corridor.Baselines;
foreach (Baseline baseline in corrBaselines)
{
ObjectId almId = baseline.AlignmentId;
Alignment alm = almId.GetObject(OpenMode.ForRead) as Alignment;
BaselineRegionCollection blRegions = baseline.BaselineRegions;
foreach (BaselineRegion region in blRegions)
{
AppliedAssemblyCollection appAssCol = region.AppliedAssemblies;
double[] appliedStations = appAssCol.Stations();
List<double> stationList = appliedStations.ToList();
stationList.Sort();
foreach (double station in stationList)
{
AppliedAssembly appliedAss = appAssCol.GetItemAt(station);
CiDb.Assembly ass = t.GetObject(appliedAss.AssemblyId, OpenMode.ForRead) as CiDb.Assembly;
ed.WriteMessage("\n\nAssembly:" + ass.Name);
ed.WriteMessage("\n\tStation:" + station.ToString());
AppliedSubassemblyCollection appSubassCol = appliedAss.GetAppliedSubassemblies();
foreach (AppliedSubassembly appSubass in appSubassCol)
{
Subassembly subAss = t.GetObject(appSubass.SubassemblyId, OpenMode.ForRead) as Subassembly;
ed.WriteMessage("\n\t\tSubassembly:" + subAss.Name);
ed.WriteMessage("\n\t\t\tHashCode:" + appSubass.GetHashCode());
CalculatedShapeCollection calcShapeCol = appSubass.Shapes;
if (calcShapeCol.Count > 0)
{
ed.WriteMessage("\n\t\t\tNumber of shapes:" + calcShapeCol.Count);
for (int i = 0; i < calcShapeCol.Count; i++)
{
CalculatedShape link = calcShapeCol[i];
if (i > 0)
{
//How to test if the shape is current in previous (i-1) station?
}