• 大小: 1.42MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-15
  • 语言: C#
  • 标签: 等高线  AutoCAD  C#  

资源简介

等高线追踪 基于TIN绘制等高线直接利用原始观测数据,避免了DTM内插的精度损失,因而等高线精度 较高;对高程注记点附近的较短封闭等高线也能绘制;绘制的等高线分布在采样区域内而 并不要求采样区域有规则四边形边界。而同一高程的等高线只穿过一个三角形最多一次, 因而程序设计也较简单。但是,由于TIN的存贮结构不同,等高线的具体跟踪算法跟踪也有 所不同。 基于三角形搜索的等高线绘制算法如下: 对于记录了三角形表的TIN,按记录的三角形顺序搜索。其基本过程如下: 1)对给定的等高线高程h,与所有网点高程zi(i=1,2,?,n),进行比较,若zi=h ,则将zi加上(或减)一个微小正数ε> 0(如ε=10-4),以使程序设计简单而又不影响 等高线的精度。 2)设立三角形标志数组,其初始值为零,每一元素与一个三角形对应,凡处理过的三角形 将标志置为1,以后不再处理,直至等高线高程改变。 3)按顺序判断每一个三角形的三边中的两条边是否有等高线穿过。若三角形一边的两端点 为P1(x1,y1,z1),P2(x2,y2,z2)则 (z1-h)(z2-h)0表明该边无等高线点。 直至搜索到等高线与网边的第一个交点,称该点为搜索起点,也是当前三角形的等高线进 入边、线性内插该点的平面坐标(x,y):

资源截图

代码片段和文件信息

using System ;
using Autodesk.AutoCAD.Runtime ;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Colors;

[assembly: CommandClass(typeof(AcDbLib.Init))]
namespace AcDbLib
{
public class AcDb
{
public AcDb()
{

     }
public static objectId CreateNewlayer(string layerName)          //new layer
{
objectId layerId;
Database db=HostApplicationServices.WorkingDatabase;
Transaction trans=db.TransactionManager.StartTransaction();
layerTable lt=(layerTable)trans.Getobject(db.layerTableIdOpenMode.ForWrite);
if(!lt.Has(layerName))
{
layerTableRecord ltr=new layerTableRecord();
ltr.Name=layerName;
ltr.Color = Color.FromColorIndex(ColorMethod.ByAci 2);
layerId=lt.Add(ltr);
trans.AddNewlyCreatedDBobject(ltrtrue);
}
else
{
layerId=lt[layerName];
}
db.Clayer=layerId;
trans.Commit();
trans.Dispose();
return layerId;
}

public static objectId CreateBlock(string blockName)   //带属性的块
{
    
Database db=HostApplicationServices.WorkingDatabase;
Transaction trans=db.TransactionManager.StartTransaction();
//Editor ed=Application.DocumentManager.MdiActiveDocument.Editor;
BlockTable bt=(BlockTable)trans.Getobject(db.BlockTableIdOpenMode.ForWrite);
objectId blockId;
if(!bt.Has(blockName))
{
BlockTableRecord btr=new BlockTableRecord();
btr.Name=blockName;
Point3d basePoint=new Point3d(000);
btr.Origin=basePoint;
//Circle circle=new Circle(basePointVector3d.ZAxis1);
//circle.Color=Color.FromColorIndex(ColorMethod.ByAci1);
//     Point3dCollection pointArray=new Point3dCollection();
// Point3d pos1=new Point3d(-200);
// pointArray.Add(pos1);
// Point3d pos2=new Point3d(200);
// pointArray.Add(pos2);
// Point3d pos3=new Point3d(02.50);
// pointArray.Add(pos3);
// Polyline2d pLine=new Polyline2d(Poly2dType.SimplePolypointArray0.0true00null);
DBPoint pnt= new DBPoint(basePoint);
pnt.Color=Color.FromColorIndex(ColorMethod.ByAci1);
btr.AppendEntity(pnt);

//属性加入
AttributeDefinition Attr=new AttributeDefinition(basePoint“abc““tag““input“db.Textstyle);
Point3d attPoint=new Point3d(basePoint.X+1*1000.0/Init.blcbasePoint.YbasePoint.Z);
Attr.Position=attPoint;
Attr.Prompt=“pointName“;
//Attr.HorizontalMode=Autodesk.AutoCAD.DatabaseServices.TextHorizontalMode.TextAlign;
Attr.Color=Color.FromColorIndex(ColorMethod.ByAci1);
Attr.Height=1*1000.0/Init.blc;
btr.AppendEntity(Attr);
AttributeDefinition Attr1=(AttributeDefinition)Attr.Clone(); //对第1个属性克隆
Point3d attPoint1=new Point3d(basePoint.X+1*1000.0/Init.blcbasePoint.Y-Attr.HeightbasePoint.Z);
Attr1.Position=attPoint1;
Attr1.Prompt=“gaocheng“;
At

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       8834  2006-04-13 09:28  等高线追踪\measure\abc.text

     文件       1977  2006-04-11 17:39  等高线追踪\measure\acad.err

     文件       7164  2006-04-11 10:11  等高线追踪\measure\AcDbLib.cs

     文件       3417  2006-04-03 14:30  等高线追踪\measure\AssemblyInfo.cs

     文件       7164  2006-04-11 10:11  等高线追踪\measure\Backup\AcDbLib.cs

     文件       3417  2006-04-03 14:30  等高线追踪\measure\Backup\AssemblyInfo.cs

     文件       3088  2006-04-13 09:26  等高线追踪\measure\Backup\EqualLine.cs

     文件       3737  2006-04-13 09:02  等高线追踪\measure\Backup\ExtPoint.cs

     文件       5373  2006-04-12 15:53  等高线追踪\measure\Backup\measure.csproj

     文件       1866  2006-04-13 09:53  等高线追踪\measure\Backup\measure.csproj.user

     文件        910  2006-04-03 14:30  等高线追踪\measure\Backup\measure.sln

    ..A..H.     10240  2006-04-13 09:53  等高线追踪\measure\Backup\measure.suo

     文件      17131  2006-04-13 08:55  等高线追踪\measure\Backup\TINandDEM.cs

     文件       2263  2006-04-05 10:17  等高线追踪\measure\Backup\UserControl1.cs

     文件       5322  2006-04-05 10:17  等高线追踪\measure\Backup\UserControl1.resx

     文件          0  2006-04-05 09:22  等高线追踪\measure\bin\abc.text

     文件    3903488  2007-02-12 04:59  等高线追踪\measure\bin\Debug\AcDbMgd.dll

     文件    1036288  2007-02-12 05:01  等高线追踪\measure\bin\Debug\AcMgd.dll

     文件      68640  2013-09-27 11:29  等高线追踪\measure\bin\Debug\Drawing1.dwg

     文件      32768  2013-09-27 11:28  等高线追踪\measure\bin\Debug\measure.dll

     文件      48640  2013-09-27 11:28  等高线追踪\measure\bin\Debug\measure.pdb

     文件       3088  2006-04-13 09:26  等高线追踪\measure\EqualLine.cs

     文件       3737  2006-04-13 09:02  等高线追踪\measure\ExtPoint.cs

     文件       6583  2013-09-27 11:27  等高线追踪\measure\measure.csproj

     文件       2543  2013-09-27 11:28  等高线追踪\measure\measure.csproj.user

     文件        898  2013-09-27 11:23  等高线追踪\measure\measure.sln

    ..A..H.     15360  2013-09-27 11:29  等高线追踪\measure\measure.suo

     文件     742458  2013-09-27 11:27  等高线追踪\measure\measureDXCore.Solution\AssemblyCache\d3ff2683557646bddbd380ddf7d1fb7.cache

     文件    2627301  2013-09-27 11:26  等高线追踪\measure\measureDXCore.Solution\AssemblyCache\dd55ab6d8e8eeda691a98e1980bce2a0.cache

     文件        818  2013-09-27 11:27  等高线追踪\measure\obj\Debug\measure.csproj.FileListAbsolute.txt

............此处省略30个文件信息

评论

共有 条评论