Message 1 of 7
AddFrom3DFaces creates additional area
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Not sure whether this is related to this one, but I found that AddFrom3DFaces will create additional (unwanted) area, when you are dealing with concave faces. Here's the code to reproduce the problem.
public void FromMesh()
{
try
{
using (var ts = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
{
var surfaceId2 = TinSurface.Create(ActiveACADDocument.Database, "FromMeshTest");
var platformSurface = ts.GetObject(surfaceId2, OpenMode.ForWrite) as TinSurface;
var bt = (BlockTable)ts.GetObject(ActiveACADDocument.Database.BlockTableId, OpenMode.ForRead, false);
var btr = (BlockTableRecord)ts.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
var vertices = platformSurface.Vertices;
if (vertices.Count != 0)
{
platformSurface.DeleteVertices(vertices);
}
var faces = new ObjectIdCollection();
var vertex1 = new Point3d(0, 0, 0);
var vertex2 = new Point3d(10, 0, 0);
var vertex3 = new Point3d(10, 10, 0);
var vertex4 = new Point3d(0, 10, 0);
var polyMesh1 = new Face(vertex1, vertex2, vertex3, vertex4, true, true, true, true);
polyMesh1.SetDatabaseDefaults();
btr.AppendEntity(polyMesh1);
ts.AddNewlyCreatedDBObject(polyMesh1, true);
faces.Add(polyMesh1.ObjectId);
var vertex5 = new Point3d(5,10,0);
var vertex6 = new Point3d(10,10,0);
var vertex7 = new Point3d(10, 20, 0);
var vertex8 = new Point3d(5, 20, 0);
var polyMesh2 = new Face(vertex5, vertex6, vertex7, vertex8, true, true, true, true);
polyMesh2.SetDatabaseDefaults();
btr.AppendEntity(polyMesh2);
ts.AddNewlyCreatedDBObject(polyMesh2, true);
faces.Add(polyMesh2.ObjectId);
platformSurface.DrawingObjectsDefinition.AddFrom3DFaces(faces, true, $"Normal Platform");
platformSurface.Rebuild();
ACADEditor.ZoomExtents();
ts.Commit();
}
}
catch (System.Exception e)
{
MessageBox.Show(e.ToString());
}
}
The correct area for this TINSurface should be 150 sq. meter, but Civil 3D gives 175 sq. meter!
How to properly add my faces to Surface, so that the topology is preserved?
Note that the cousin method, AddFromPolyFaces, doesn't seem to work.
##########
Ngu Soon Hui
##########
I'm the Benevolent Dictator for Life for MiTS Software. Read more here
I also setup Civil WHIZ in order to share what I learnt about Civil 3D
Ngu Soon Hui
##########
I'm the Benevolent Dictator for Life for MiTS Software. Read more here
I also setup Civil WHIZ in order to share what I learnt about Civil 3D