消除AutoCAD网格中的对角线(C#)
我正在尝试在AutoCAD中绘制一个由一系列矩形组成的墙。我想使用网格将它们渲染为实体对象。我得到了它,所以视觉效果看起来很像我想要的,除了在每个矩形中有看似随机的对角线 我想要的只是一个简单的矩形。下面是我绘制矩形网格的代码消除AutoCAD网格中的对角线(C#),c#,mesh,autocad,autocad-plugin,C#,Mesh,Autocad,Autocad Plugin,我正在尝试在AutoCAD中绘制一个由一系列矩形组成的墙。我想使用网格将它们渲染为实体对象。我得到了它,所以视觉效果看起来很像我想要的,除了在每个矩形中有看似随机的对角线 我想要的只是一个简单的矩形。下面是我绘制矩形网格的代码 public static ObjectId DrawPolyhedronMesh(Polyhedron polyhedronToDraw, string layerToInsertOn = "0") { using (Transaction acTrans =
public static ObjectId DrawPolyhedronMesh(Polyhedron polyhedronToDraw, string layerToInsertOn = "0")
{
using (Transaction acTrans = _database.TransactionManager.StartTransaction())
{
// Open the Block table record for read
BlockTable acBlkTbl = acTrans.GetObject(_database.BlockTableId, OpenMode.ForRead) as BlockTable;
// Open the Block table record Model space for write
BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
// Create a polygon mesh
PolygonMesh acPolyMesh = new PolygonMesh();
acPolyMesh.Layer = layerToInsertOn;
acPolyMesh.MSize = 12;
acPolyMesh.NSize = 2;
acPolyMesh.MakeMOpen();
acPolyMesh.MakeNOpen();
// Add the new object to the block table record and the transaction
acBlkTblRec.AppendEntity(acPolyMesh);
acTrans.AddNewlyCreatedDBObject(acPolyMesh, true);
// Before adding vertices, the polyline must be in the drawing
Point3dCollection acPts3dPMesh = new Point3dCollection();
foreach (PlaneRegion f in polyhedronToDraw.Faces)
{
foreach (Point p in f.Vertices)
{
acPts3dPMesh.Add(GeometryAdapter.ClearspanPointToAcadPoint(p));
}
}
foreach (Point3d acPt3d in acPts3dPMesh)
{
PolygonMeshVertex acPMeshVer = new PolygonMeshVertex(acPt3d);
acPolyMesh.AppendVertex(acPMeshVer);
acTrans.AddNewlyCreatedDBObject(acPMeshVer, true);
}
// Open the active viewport
ViewportTableRecord acVportTblRec = acTrans.GetObject(_editor.ActiveViewportId, OpenMode.ForWrite) as ViewportTableRecord;
// Rotate the view direction of the current viewport
acVportTblRec.ViewDirection = new Vector3d(-1, -1, 1);
_editor.UpdateTiledViewportsFromDatabase();
// Save the new objects to the database
acTrans.Commit();
return acPolyMesh.Id;
}
}
基本上,为了绘制网格,我遍历矩形的每个面,并将形成该面的每个顶点添加到网格中。我怎样才能改变这种方法,去掉对角线,只剩下基本的矩形呢