Hi,
I wanted to create a lofted solid3d from polyline3ds which I got from shape points in an applied subassembly in a corridor. But some of them are not planar. So I ortho-projected shape points onto a plane created from corridor frequency but this didn't work either even though point coordinates were slightly modified.
Tested on Civil 24 and 25.
But when I use autocad command LOFT solid is created.
Any idea how to deal with that non-planar 3d polylines?
Thanks for any recommendations.
Corridor created along Y axis but some of polylines are still not planar.
Corridor Corridor = corrId.GetObject(OpenMode.ForRead) as Corridor;
foreach (Baseline bl in Corridor.Baselines)
{
foreach (BaselineRegion reg in bl.BaselineRegions)
{
foreach (double station in reg.SortedStations())
{
AppliedAssembly appliedAssembly = reg.AppliedAssemblies.GetItemAt(station);
foreach (var subass in appliedAssembly.GetAppliedSubassemblies())
{
foreach (CalculatedShape cShape in subass.Shapes)
{
foreach (string shapeCode in cShape.CorridorCodes)
{
foreach (CalculatedLink cLink in cShape.CalculatedLinks)
{
foreach (CalculatedPoint cPoint in cLink.CalculatedPoints)
{
// cPoint.XYZ <-- points for polylines
}
}
}
}
}
}
}
}
internal void CreatePolyline3d(List<Point3d> points, Transaction tr)
{
if (points.Count < 3) return;
Polyline3d Polyline3d = new Polyline3d();
Polyline3d.ColorIndex = 3;
var bt = (BlockTable)tr.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead, false);
var btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
btr.AppendEntity(Polyline3d);
tr.AddNewlyCreatedDBObject(Polyline3d, true);
foreach (Point3d p in points)
{
PolylineVertex3d vertex = new PolylineVertex3d(p);
Polyline3d.AppendVertex(vertex);
tr.AddNewlyCreatedDBObject(vertex, true);
}
Polyline3d.Closed = true;
}
internal void CreateSolid3d(Polyline3d poly1, Polyline3d poly2, Transaction tr)
{
if (poly1.IsPlanar && poly2.IsPlanar) // <-- some of them are not planar
{
Solid3d s = new Solid3d();
s.CreateLoftedSolid(new Entity[2] { poly1, poly2 }, new Entity[0], null, new LoftOptions());
var bt = (BlockTable)tr.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead, false);
var btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
btr.AppendEntity(s);
tr.AddNewlyCreatedDBObject(s, true);
}
}
Solved! Go to Solution.
Solved by hosneyalaa. Go to Solution.
Can't find what you're looking for? Ask the community or share your knowledge.