当前位置: 移动技术网 > IT编程>开发语言>.net > Teigha.net实体属性注释

Teigha.net实体属性注释

2019年12月20日  | 移动技术网IT编程  | 我要评论

1987年西游记剧组齐天乐春节晚会,郭芯其微博,呼伦贝尔市火网

polyline3d:

3d polyline的类型由polytype属性存储,

它是由poly3dtype枚举定义的整数值。polytype属性是一种绘制三维折线的近似方法

polyline3d polyline = new polyline3d(poly3dtype.simplepoly, p3dc, false);

是否闭合:

polyline.closed = false;

 

polytype属性可用于设置和返回折线的类型。

使用非默认构造函数polyline3d()创建3d polyline实体时,可以指定类型

polyline.polytype = poly3dtype.quadsplinepoly;

polyline.converttopolytype(poly3dtype.quadsplinepoly);

 

converttopolytype()方法使用splinefit()方法进行转换。如果需要其他设置,请使用此方法。

将当前三维折线转换为特定类型的三维折线。

线段参数设置为每个样条拟合折线生成的线段数量。大量的线段使折线更平滑。

polyline.splinefit(poly3dtype.cubicsplinepoly, 3);

 

将当前3d折线转换为默认类型的3d折线,并使用默认的插值线段数量。

数据库对象的splinetype和splinesegs属性相应地设置默认样条类型和段数。

注意,当前polyline3d对象必须是数据库的常驻对象

polyline.splinefit();

 

polyline3d对象具有拉直(straighten())方法,

用于去除样条拟合,将样条拟合的三维折线转换为简单的三维折线:

polyline.straighten();

 

polyline3d对象包含用于在polyline中添加和插入顶点的方法。

若要向3d折线添加顶点,请使用appendvertex()方法:

该方法将新的顶点实体附加到三维折线实体的顶点列表中,并使该折线成为其所有者。

如果折线是数据库驻留符,则必须在返回appendvertex()方法后显式关闭附加的顶点实体。

polylinevertex3d vrtx = new polylinevertex3d(new point3d(0, 0, 0));

polyline.appendvertex(vrtx);

polyline.dispose();

 

要将顶点插入到3d折线,使用insertvertexat()方法:

将指定的顶点实体插入到指定顶点之后的3d折线实体中,并使折线成为其所有者。

如果折线是数据库驻留,则必须在返回insertvertexat()方法后显式关闭插入的顶点实体。

insert new vertex after the fourth vertex //在第四个顶点之后插入新顶点

polyline.insertvertexat(verticesid[3], vrtx1);

insert new vertex at the beginig of the polyline 在折线的起始点插入新的顶点

polyline.insertvertexat(objectid.null, vrtx2);

 

读取线段

foreach (objectid obj in polyline)

{

    using (dbobject dbobj = trans.getobject(obj, openmode.forread))

    {

        if (dbobj is polylinevertex3d)

        {

            polylinevertex3d poly3d = (polylinevertex3d)dbobj;

        }

    }

}

 

polyline3d对象具有只读长度属性,该属性返回以绘图单元测量的所有段长度的和。

messagebox.show(polyline.length.tostring());

 

 

 

arcs:

圆弧是由一个圆创建的,使用起始角和结束角、中心点和半径来定义。

起始角设置圆弧将从何处绘制的起始点。

结束角设置将绘制圆弧的结束点。这两个角都是用弧度(0到2 *)测量的,

并以逆向时针方计算法向量的原点。

如果起点和终点相同,则实体被画成一个圆。

 

public arc(point3d center, double radius, double startangle, double endangle);

  • 这个构造函数需要四个参数:

center —圆弧中心点的三维wcs坐标。

radius —弧的半径。

startangle —以弧度表示的弧的起始角。这个角的正方向是逆时针的。

endangle —以弧度表示的弧的结束角。这个角的正方向是逆时针的。

arc arc1 = new arc(new point3d(100, 50, 0), 50, 0, 45);

 

 

public arc(point3d center, vector3d normal, double radius, double startangle, double endangle);

this constructor requires five parameters:

center — three-dimensional wcs coordinates of the arc's center point.

normal — three-dimensional vector of the arc’s normal.

radius — radius of the arc.

startangle — start angle of the arc in radians.the positive direction for the angle is counter-clockwise.

endangle — end angle of the arc in radians.the positive direction for the angle is counter-clockwise.

arc arc2 = new arc(new point3d(100, 50, 0), new vector3d(0, 0, 1), 150, 0, 90);

 

public arc();

默认构造函数,它创建的弧的起始角和结束角为0.0,

半径为0.0,圆心为(0, 0, 0),法向量为(0, 0, 1)。

using (var trans = f1show.database.transactionmanager.starttransaction())

{

using (blocktablerecord btr = (blocktablerecord)f1show.database.currentspaceid.getobject(openmode.forwrite))

{

btr.appendentity(arc1);

btr.appendentity(arc2);

trans.addnewlycreateddbobject(arc1, true);

trans.addnewlycreateddbobject(arc2, true);

}

trans.commit();

}

圆弧的中心、半径、起始角、结束角、法线和厚度属性用于设置和获取圆弧的中心、半径、起始角和结束角、法线和厚度参数。

起始角和结束角属性定义弧的起始角和结束角。角的正方向是逆时针方向,指向法向量的原点。

arc对象还具有只读的totalangle和length属性。totalangle属性获取结束角和开始角之间的差(以弧度为单位)。length属性获取弧的长度。

 

if (helperdevice != null)

{

helperdevice.update();

}

invalidate();

}

 

ellipse:

可以使用下面的ellipse()构造函数之一创建ellipse对象。

public ellipse(point3d center, vector3d unitnormal, vector3d majoraxis, double radiusratio, double startangle, double endangle);

公共椭圆(point3d中心,vector3d单位法线,vector3d主轴,双半径比,双起始角,双结束角);

这个构造函数需要6个参数:

中心 - 中心点的三维wcs坐标。

单位法向量——法向量的三维向量。

主轴 - 指定主轴(中心点到起点)的三维向量。

半径比 - 椭圆的半径比,即小半径(小矢量的长度)与大半径(大矢量的长度)之比。半径比必须在0.000001到1.000000(小半径<大半径)之间。

起始角 - 椭圆的起始角,单位为弧度。这个角的正方向是逆时针方向,指向法向量的原点。

端角 - 椭圆的端角,单位为弧度。这个角的正方向是逆时针方向,指向法向量的原点。

 

如果起始角为0,结束角为2,则创建一个闭合椭圆,否则构造函数将生成椭圆弧。

创建一个闭合椭圆

ellipse el1 = new ellipse(new point3d(100, 50, 0), new vector3d(0, 0, 1), new vector3d(10, 0, 0), 0.7, 0.0, 6.283185);

 

创建一个椭圆弧,起始角0.0,结束角3.141592弧度

ellipse el2 = new ellipse(new point3d(100, 50, 0), new vector3d(0, 0, 1), new vector3d(10, 0, 0), 0.9, 0.0, 3.141592);

 

默认构造函数,它创建一个半径为1的圆(半径比为1的闭合椭圆),圆心为(0, 0, 0),法向量为(0, 0, 1)。

ellipse el1 = new ellipse();

 

center属性用于设置和获取椭圆的中心。创建椭圆对象后,

设置center属性来更改椭圆中心的位置。

el1.center = new point3d(10, 0, 0);

 

起始角和结束角属性

startangle和endangle属性用于设置和获取椭圆的起始角和结束角。

角的正方向是逆时针方向,指向法向量的原点。

如果将startangle设置为0,endangle设置为2,则创建一个闭合椭圆,否则椭圆将转换为椭圆弧。注意,起始角和结束角必须相差大于1e - 6。

 

el1.startangle = 0;

el1.endangle = 1.571;

(majoraxis and minoraxis)主轴和小轴的性质是用来得到代表椭圆的主轴和小轴的向量。这两个性质都是从椭圆中心点出发的

(majorradius and minorradius)大半径和小半径性质分别得到大半径和小半径。大半径是主轴矢量的长度,小半径是主轴矢量的长度。

normal 法向量性质得到椭圆平面的法向量。

半径比特性用于设置和得到小半径与大半径的比值。大半径必须大于小半径 ,

这意味着半径比必须在0到1之间。如果辐射比大于1.0或小于1e - 6

el1.radiusratio = 0.5;

 

startparam和endparam属性相应地获取椭圆的开始和结束参数。用参数定义椭圆圆弧,用矢量参数方程:

p(u) = c + a* cos(u) + b* sin(u)

c 椭圆的中心。

a 椭圆的主轴。

b - 椭圆的小轴。

 

获取指定角度的参数

要获取与指定角度对应的参数值,可以使用getparameteratangle()

public double getparameteratangle(double angle);

 

参数求角

要获得与指定参数值对应的角度,使用getangleatparameter()方法:

public double getangleatparameter(double value);

 

设置椭圆的参数

要设置椭圆的属性,还可以使用set()方法:

public void set(point3d center, vector3d unitnormal, vector3d majoraxis, double radiusratio, double startangle, double endangle);

 

具体示例:

ellipse ellipse = new ellipse();

ellipse.set(new point3d(0, 0, 0), new vector3d(0, 0, 1), new vector3d(10, 0, 0), 0.5, 0, 6.2830);

 

 

using (var trans = f1show.database.transactionmanager.starttransaction())

{

using (blocktablerecord btr = (blocktablerecord)f1show.database.currentspaceid.getobject(openmode.forwrite))

{

btr.appendentity(el1);

btr.appendentity(ellipse);

trans.addnewlycreateddbobject(ellipse, true);

}

trans.commit();

}

 

if (helperdevice != null)

{

helperdevice.update();

}

invalidate();

 

未完待续。。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网