- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
NOTE:
Based on the communication with Civil 3D developer, I can confirm that the problem in the original test case is a bug.
A fix is underway, but don't know when will come.
Problem description:
I have the following code that works very well when I convert from PolyFaceMesh to TinSurface under simple situation (eg: if I have a L shape PolyFaceMesh, then the TinSurface converted will preserve the PolyFaceMesh).
[CommandMethod(nameof(ConvertFromMeshToTinSurface))]
public void ConvertFromMeshToTinSurface()
{
using (var tsDest = ActiveACADDocument.TransactionManager.StartTransaction())
{
var destBlockTable = tsDest.GetObject(ActiveACADDocument.Database.BlockTableId, OpenMode.ForRead) as BlockTable;
var destinationModelSpace = tsDest.GetObject(destBlockTable[BlockTableRecord.ModelSpace],
OpenMode.ForWrite) as BlockTableRecord;
foreach (var id in destinationModelSpace)
{
var entity = tsDest.GetObject(id, OpenMode.ForRead) as PolyFaceMesh;
if(entity== null)
continue;
var surfaceId2 = TinSurface.Create(ActiveACADDocument.Database, "FromMeshTest");
var platformSurface = tsDest.GetObject(surfaceId2, OpenMode.ForWrite) as TinSurface;
platformSurface.DrawingObjectsDefinition.AddFromPolyFaces(new ObjectIdCollection(new[] { entity.Id }),
true, $"Normal Platform");
var spuriousEdges = platformSurface.GetEdges().Where(ee => !ee.IsLocked).ToList(); //IsLocked indicates that it's not a part of the edge in PolyMesh
if (spuriousEdges.Count > 0)
{
platformSurface.DeleteLines(spuriousEdges);
}
platformSurface.Rebuild();
break;
//MessageBox.Show(platformSurface.GetTerrainProperties().SurfaceArea2D.ToString());
}
tsDest.Commit();
ACADEditor.ZoomExtents();
}
}
However, for a slightly complicated drawing like the one I attach here, it seems that some face is not properly converted into TinSurface, as shown when you compare the two screenshots for the PolyFaceMesh object and the TinSurface object:
Note that some face is missing in TinSurface as per above screenshot.
How can I fix this? Is there a robust way that guarantees 100% conversion from PolyFaceMesh to TinSurface?
Ngu Soon Hui
##########
I'm the Benevolent Dictator for Life for MiTS Software.
Read more at here
Solved! Go to Solution.