Skip to content
On this page

mxcad API 文档 / McDbArc

Class: McDbArc

表示一个圆弧。

Example

ts
import { McDbArc, MxCpp } from "mxcad"
  // 绘制圆弧
   const arc = new McDbArc()
   arc.center = new McGePoint3d(0,0,0),
   arc.radius = 20
   arc.startAngle = Math.PI / 2
   arc.endAngle = Math.PI * 3 / 2
   arc.trueColor = new McCmColor(255, 233, 0)
   MxCpp.getCurrentMxCAD().drawEntity(arc)

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbArc(imp?)

构造函数。

Parameters

NameTypeDescription
imp?any内部对象。

Overrides

McDbCurve.constructor

Properties

imp

imp: any = 0

内部实现对象。

Inherited from

McDbCurve.imp

Accessors

center

get center(): McGePoint3d

获取圆心坐标。

Returns

McGePoint3d

set center(pt): void

设置圆心坐标。

Parameters

NameTypeDescription
ptMcGePoint3d圆心坐标。

Returns

void


colorIndex

get colorIndex(): number

得到对象颜色索引

Example

ts
import { McDbEntity, ColorIndexType } from 'mxcad'
 const ent = new McDbEntity();
 ent.colorIndex = ColorIndexType.kByblock;
 console.log(ent.colorIndex)

Returns

number

Inherited from

McDbCurve.colorIndex

set colorIndex(val): void

设置对象颜色索引

Parameters

NameTypeDescription
valnumber颜色索引(ColorIndexType)

Returns

void

Inherited from

McDbCurve.colorIndex


drawOrder

get drawOrder(): number

对象的显示顺序

Returns

number

Inherited from

McDbCurve.drawOrder

set drawOrder(order): void

对象的显示顺序

Parameters

NameTypeDescription
ordernumber顺序值

Returns

void

Inherited from

McDbCurve.drawOrder


dxf0

get dxf0(): string

获取 DXF 代码 0 的值。

Returns

string

Inherited from

McDbCurve.dxf0


endAngle

get endAngle(): number

获取结束角度。

Returns

number

set endAngle(r): void

设置结束角度。

Parameters

NameTypeDescription
rnumber角度。

Returns

void


layer

get layer(): string

得到对象图层名

Returns

string

Inherited from

McDbCurve.layer

set layer(val): void

设置对象图层名

Parameters

NameTypeDescription
valstring图层名

Returns

void

Inherited from

McDbCurve.layer


layerId

get layerId(): McObjectId

图层ID对象

Returns

McObjectId

Inherited from

McDbCurve.layerId

set layerId(id): void

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbCurve.layerId


linetype

get linetype(): string

得到对象线型名

Returns

string

Inherited from

McDbCurve.linetype

set linetype(val): void

设置对象线型名

Parameters

NameTypeDescription
valstring线型名

Returns

void

Inherited from

McDbCurve.linetype


linetypeId

get linetypeId(): McObjectId

线型ID对象

Returns

McObjectId

Inherited from

McDbCurve.linetypeId

set linetypeId(id): void

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbCurve.linetypeId


linetypeScale

get linetypeScale(): number

得到对象线型比例

Returns

number

Inherited from

McDbCurve.linetypeScale

set linetypeScale(val): void

设置对象线型比例

Parameters

NameTypeDescription
valnumber线型比例

Returns

void

Inherited from

McDbCurve.linetypeScale


lineweight

get lineweight(): number

得到对象线重

Returns

number

Inherited from

McDbCurve.lineweight

set lineweight(val): void

设置对象线重

Parameters

NameTypeDescription
valnumber线重

Returns

void

Inherited from

McDbCurve.lineweight


objectName

get objectName(): string

获取对象名称。

Returns

string

Inherited from

McDbCurve.objectName


radius

get radius(): number

获取圆半径。

Returns

number

set radius(r): void

设置圆半径。

Parameters

NameTypeDescription
rnumber圆半径。

Returns

void


startAngle

get startAngle(): number

获取开始角度。

Returns

number

set startAngle(r): void

设置开始角度。

Parameters

NameTypeDescription
rnumber角度。

Returns

void


textStyle

get textStyle(): string

得到对象文字样式

Returns

string

Inherited from

McDbCurve.textStyle

set textStyle(val): void

设置对象文字样式

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.textStyle = "st_style";

Parameters

NameTypeDescription
valstring文字样式名

Returns

void

Inherited from

McDbCurve.textStyle


textStyleId

get textStyleId(): McObjectId

文字样式ID对象

Returns

McObjectId

Inherited from

McDbCurve.textStyleId

set textStyleId(id): void

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbCurve.textStyleId


trueColor

get trueColor(): McCmColor

得到对象颜色

Example

ts
import { McDbEntity, McCmColor} from 'mxcad'
 const ent = new McDbEntity();
 ent.trueColor = new McCmColor(255, 0, 0);
 console.log(ent.trueColor)

Returns

McCmColor

Inherited from

McDbCurve.trueColor

set trueColor(val): void

设置对象颜色

Parameters

NameType
valMcCmColor

Returns

void

Inherited from

McDbCurve.trueColor


visible

get visible(): boolean

对象是否可见

Returns

boolean

Inherited from

McDbCurve.visible

set visible(val): void

设置是否可见

Parameters

NameTypeDescription
valboolean布尔值

Returns

void

Inherited from

McDbCurve.visible

Methods

IntersectWith

IntersectWith(intersectObject, exOption): McGePoint3dArray

与其他实体相交, 得到交点

Example

ts
import { McDbLine, McDb } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
const line2 = new McDbLine(new McGePoint3d(10,10,0), new McGePoint3d(11,1,0));
const ptArr = line1.IntersectWith(line2, McDb.Intersect.kExtendBoth)

Parameters

NameTypeDescription
intersectObjectMcDbEntity需要相交的是实体对象
exOptionIntersect相交的选项

Returns

McGePoint3dArray

得到所有交点

Inherited from

McDbCurve.IntersectWith


clone

clone(): null | McDbObject

克隆对象。

Returns

null | McDbObject

克隆出的对象。

Inherited from

McDbCurve.clone


computeArc

computeArc(dStartPointX, dStartPointY, dMidPointX, dMidPointY, dEndPointX, dEndPointY): boolean

3点计算圆弧

Parameters

NameType
dStartPointXnumber
dStartPointYnumber
dMidPointXnumber
dMidPointYnumber
dEndPointXnumber
dEndPointYnumber

Returns

boolean


constructor_MxCADResbuf

Protected constructor_MxCADResbuf(imp): void

Parameters

NameType
impany

Returns

void

Inherited from

McDbCurve.constructor_MxCADResbuf


createExtensionDictionary

createExtensionDictionary(): boolean

创建对象的扩展字典数据.

Returns

boolean

Inherited from

McDbCurve.createExtensionDictionary


deleteXData

deleteXData(appName): boolean

删除实体的指定 XData 类型中的点(McGePoint3d)值

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

boolean

Inherited from

McDbCurve.deleteXData


disableDisplay

disableDisplay(isDisable): void

禁用对象的自动更新显示.

Example

ts
import { McDbLine } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
line1.disableDisplay(true)

Parameters

NameTypeDescription
isDisableboolean是否禁用对象自动更新显示

Returns

void

Inherited from

McDbCurve.disableDisplay


erase

erase(): boolean

删除对象。

Returns

boolean

是否删除成功。

Inherited from

McDbCurve.erase


explode

explode(): MxCADResbuf

打碎对象,返回打后对象数据链表

Returns

MxCADResbuf

Inherited from

McDbCurve.explode


freeTempRelationObject

freeTempRelationObject(): void

释放临时关系对象

Returns

void

Inherited from

McDbCurve.freeTempRelationObject


getAllAppName

getAllAppName(): McGeStringArray

获取实体中包含的所有 XData 记录的应用程序名(AppName)

Returns

McGeStringArray

Inherited from

McDbCurve.getAllAppName


getArea

getArea(): Object

计算面积

Returns

Object

val 面积值 | ret 是否获取成功

NameType
retboolean
valnumber

Inherited from

McDbCurve.getArea


getBoundingBox

getBoundingBox(): Object

得到对象的最小外包

Example

ts
import { McDbText, McGePoint3d } from 'mxcad'
const text = new McDbText();
text.textString = "测试Test";
  text.height = 20;
  line.startPoint = new McGePoint3d(0,0,0);
const { minPt, maxPt, ret } = text.getBoundingBox()

Returns

Object

NameType
maxPtMcGePoint3d
minPtMcGePoint3d
retboolean

Inherited from

McDbCurve.getBoundingBox


getClosestPointTo

getClosestPointTo(givenPnt, isExtend): Object

得到一个点到曲线的最近点

Parameters

NameTypeDescription
givenPntMcGePoint3d参考点
isExtendboolean是否延展实体

Returns

Object

点对象及执行结果。

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCurve.getClosestPointTo


getDatabase

getDatabase(): McDbDatabase

得到对象所在的数据库

Returns

McDbDatabase

Inherited from

McDbCurve.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

获取对象的索引ID

Returns

number

Inherited from

McDbCurve.getDatabaseIndexId


getDistAtParam

getDistAtParam(param): Object

获取参数位置上的距离。

Parameters

NameTypeDescription
paramnumber参数位置。

Returns

Object

距离及执行结果。

NameType
retboolean
valnumber

Inherited from

McDbCurve.getDistAtParam


getDistAtPoint

getDistAtPoint(pt): Object

获取曲线上点的距离位置。

Parameters

NameTypeDescription
ptMcGePoint3d距离位置。

Returns

Object

点及执行结果。

NameType
retboolean
valnumber

Inherited from

McDbCurve.getDistAtPoint


getEndParam

getEndParam(): Object

获取结束参数。

Returns

Object

结束参数及执行结果。

NameType
retboolean
valnumber

Inherited from

McDbCurve.getEndParam


getEndPoint

getEndPoint(): Object

得到曲线的结束点

Returns

Object

曲线的结束点及执行结果。

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCurve.getEndPoint


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

得到对象的扩展字典数据.

Returns

McDbDictionary

Inherited from

McDbCurve.getExtensionDictionary


getFirstDeriv

getFirstDeriv(pt): Object

通过曲线上某点得到曲线的一阶导数

Parameters

NameTypeDescription
ptMcGePoint3d曲线上的点

Returns

Object

曲线一阶导数及执行结果。

NameType
retboolean
valMcGeVector3d

Inherited from

McDbCurve.getFirstDeriv


getFirstDerivFromParam

getFirstDerivFromParam(param): Object

通过曲线参数得到曲线的一阶导数

Parameters

NameTypeDescription
paramnumber曲线参数

Returns

Object

曲线一阶导数及执行结果。

NameType
retboolean
valMcGeVector3d

Inherited from

McDbCurve.getFirstDerivFromParam


getGripPoints

getGripPoints(): McGePoint3dArray

获取对象的控制点

Returns

McGePoint3dArray

Inherited from

McDbCurve.getGripPoints


getHandle

getHandle(): string

得到对象句柄

Returns

string

Inherited from

McDbCurve.getHandle


getImp

getImp(): any

获取内部实现对象。

Returns

any

内部实现对象。

Inherited from

McDbCurve.getImp


getJson

getJson(): string

获取 JSON 格式的字符串。

Returns

string

JSON 格式的字符串。

Inherited from

McDbCurve.getJson


getLength

getLength(): Object

得到曲线长度

Example

ts
import { MxCpp, MxCADResbuf, MxCADUtility, MxCADUiPrPoint} from "mxcad"

 const mxcad = MxCpp.App.getCurrentMxCAD();
   let filter = new MxCADResbuf();
   filter.AddMcDbEntityTypes("CIRCLE,ARC,LINE,LWPOLYLINE,ELLIPSE");
   let aryId = await MxCADUtility.userSelect("选择目标曲线", filter);
   if (aryId.length == 0)  return;
   aryId.forEach(async (id) => {
       let event = id.getMcDbEntity() as McDbCurve;
       let length = event.getLength().val;
       console.log(length)
   });

Returns

Object

NameType
retboolean
valnumber

Inherited from

McDbCurve.getLength


getObjectID

getObjectID(): McObjectId

获取对象 ID。

Returns

McObjectId

对象 ID。

Inherited from

McDbCurve.getObjectID


getOwnerID

getOwnerID(): number

得到对象拥用者的id

Returns

number

Inherited from

McDbCurve.getOwnerID


getParamAtDist

getParamAtDist(dist): Object

获取距离位置上的参数。

Parameters

NameTypeDescription
distnumber距离位置。

Returns

Object

参数及执行结果。

NameType
retboolean
valnumber

Inherited from

McDbCurve.getParamAtDist


getParamAtPoint

getParamAtPoint(pt): Object

得到曲线某点位置的曲线参数

Parameters

NameTypeDescription
ptMcGePoint3d曲线上的点

Returns

Object

曲线参数及执行结果。

NameType
retboolean
valnumber

Inherited from

McDbCurve.getParamAtPoint


getPointAtDist

getPointAtDist(dist): Object

获取距离位置上的点。

Parameters

NameTypeDescription
distnumber距离位置。

Returns

Object

点及执行结果。

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCurve.getPointAtDist


getPointAtParam

getPointAtParam(param): Object

得到曲线参数所在的点坐标

Parameters

NameTypeDescription
paramnumber曲线参数

Returns

Object

点对象及执行结果。

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCurve.getPointAtParam


getSamplePoints

getSamplePoints(dApproxEps): MxCADResbuf

把曲线离散成一堆点

Parameters

NameTypeDescription
dApproxEpsnumber采样间隔

Returns

MxCADResbuf

resbuf 数据

Inherited from

McDbCurve.getSamplePoints


getStartParam

getStartParam(): Object

获取起始参数。

Returns

Object

起始参数及执行结果。

NameType
retboolean
valnumber

Inherited from

McDbCurve.getStartParam


getStartPoint

getStartPoint(): Object

得到曲线的开始点

Returns

Object

曲线的开始点及执行结果。

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCurve.getStartPoint


getxData

getxData(appName?): MxCADResbuf

得到对象的扩展数据

Parameters

NameTypeDefault valueDescription
appNamestring""XData 类型

Returns

MxCADResbuf

Inherited from

McDbCurve.getxData


getxDataDouble

getxDataDouble(appName): Object

获取或设置实体的指定 XData 类型中的 double 值

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

double 值

NameType
retboolean
valnumber

Inherited from

McDbCurve.getxDataDouble


getxDataLong

getxDataLong(appName): Object

获取或设置实体的指定 XData 类型中的 long(整数)值

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

long 值

NameType
retboolean
valnumber

Inherited from

McDbCurve.getxDataLong


getxDataPoint

getxDataPoint(appName): Object

获取或设置实体的指定 XData 类型中的点对象

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

NameType
retboolean
valMcGePoint3d

Inherited from

McDbCurve.getxDataPoint


getxDataString

getxDataString(appName): Object

获取与特定实体关联的 XData 信息,并以字符串形式返回

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

val XData信息 | ret 是否返回成功

NameType
retboolean
valstring

Inherited from

McDbCurve.getxDataString


highlight

highlight(isHighlight): void

设置对象是否高亮

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.isHighlight(true);

Parameters

NameTypeDescription
isHighlightboolean是否高亮

Returns

void

Inherited from

McDbCurve.highlight


initTempObject

initTempObject(imp): void

初始化临时对象。

Parameters

NameTypeDescription
impany内部实现对象。

Returns

void

Inherited from

McDbCurve.initTempObject


isErased

isErased(): boolean

对象是否已经删除

Returns

boolean

Inherited from

McDbCurve.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

是否有扩展字典数据.

Returns

boolean

Inherited from

McDbCurve.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

Parameters

NameType
sObjectNamestring

Returns

boolean

Inherited from

McDbCurve.isKindOf


isNull

isNull(): any

Returns

any

Inherited from

McDbCurve.isNull


mirror

mirror(point1, point2): boolean

镜向对象

Parameters

NameTypeDescription
point1McGePoint3d镜像基点
point2McGePoint3d镜像点

Returns

boolean

Inherited from

McDbCurve.mirror


move

move(fromPoint, toPoint): boolean

移动对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.move(new McGePoint3d(0,0,0), new McGePoint3d(20,0,0))

Parameters

NameTypeDescription
fromPointMcGePoint3d移动开始点
toPointMcGePoint3d移动结束点

Returns

boolean

Inherited from

McDbCurve.move


moveGripPointsAt

moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any

移动对象的控制点

Parameters

NameTypeDescription
iIndexnumber索引
dXOffsetnumberX轴偏移量
dYOffsetnumberY轴偏移量
dZOffsetnumberZ轴偏移量

Returns

any

Inherited from

McDbCurve.moveGripPointsAt


offsetCurves

offsetCurves(dOffsetDist, ptOffsetRef): McDbObjectArray

得到偏移曲线

Example

ts
import { MxCADUiPrPoint, MxCpp } from 'mxcad'
   let getFristPoint = new MxCADUiPrPoint();
   let offsetDist = 10 ;
   let getEvent = new MxCADUiPrEntity();
   getEvent.setMessage('指定偏移对象');
   let event_id = await getEvent.go();
   if (!event_id) return;
   let event = (await event_id.getMcDbEntity()) as McDbCurve;
   let getoOffPt = new MxCADUiPrPoint();
   getoOffPt.setMessage('指定偏移点');
   let offPt = await getoOffPt.go();
   if (!offPt) return;
   let objArr = event.offsetCurves(offsetDist, offPt);
   if (objArr.length() === 0) return;
   objArr.forEach((obj: McDbObject) => {
       MxCpp.getCurrentCAD().drawEntity(obj as McDbEntity);
   });

Parameters

NameTypeDescription
dOffsetDistnumber偏移距离
ptOffsetRefMcGePoint3d偏移点

Returns

McDbObjectArray

偏移后的对象数组。

Inherited from

McDbCurve.offsetCurves


rotate

rotate(basePoint, dRotationAngle): boolean

旋转对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.rotate(new McGePoint3d(0,0,0), Math.PI)

Parameters

NameTypeDescription
basePointMcGePoint3d旋转基点
dRotationAnglenumber旋转角度

Returns

boolean

Inherited from

McDbCurve.rotate


scaleEntity

scaleEntity(basePoint, dScaleFactor): boolean

缩放对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.scaleEntity(new McGePoint3d(0,0,0), 0.5)

Parameters

NameTypeDescription
basePointMcGePoint3d缩放基点
dScaleFactornumber缩放因子(<1 缩小; >1 放大)

Returns

boolean

Inherited from

McDbCurve.scaleEntity


setCenter

setCenter(x, y, z?): void

设置圆心坐标。

Parameters

NameTypeDescription
xnumber圆心 x 坐标。
ynumber圆心 y 坐标。
z?number圆心 z 坐标。

Returns

void


setJson

setJson(str): boolean

设置 JSON 格式的字符串。

Parameters

NameTypeDescription
strstringJSON 格式的字符串。

Returns

boolean

是否设置成功。

Inherited from

McDbCurve.setJson


setxData

setxData(xdata): boolean

设置对象的扩展数据

Parameters

NameTypeDescription
xdataMxCADResbufresbuf 数据

Returns

boolean

Inherited from

McDbCurve.setxData


setxDataDouble

setxDataDouble(appName, val): boolean

Parameters

NameType
appNamestring
valnumber

Returns

boolean

Inherited from

McDbCurve.setxDataDouble


setxDataLong

setxDataLong(appName, val): boolean

Parameters

NameType
appNamestring
valnumber

Returns

boolean

Inherited from

McDbCurve.setxDataLong


setxDataPoint

setxDataPoint(appName, val): boolean

Parameters

NameType
appNamestring
valMcGePoint3d

Returns

boolean

Inherited from

McDbCurve.setxDataPoint


setxDataString

setxDataString(appName, val): boolean

设置与特定实体关联的 XData 信息,并以字符串形式设置

Parameters

NameTypeDescription
appNamestringXData 类型
valstringXData信息

Returns

boolean

是否设置成功

Inherited from

McDbCurve.setxDataString


splitCurves

splitCurves(pts): McDbObjectArray

打断曲线

Parameters

NameTypeDescription
ptsMcGePoint3d[]断点数组

Returns

McDbObjectArray

打断后的曲线数组。

Inherited from

McDbCurve.splitCurves


splitCurvesFromParam

splitCurvesFromParam(params): McDbObjectArray

根据曲线参数打断曲线

Parameters

NameTypeDescription
paramsnumber[]曲线参数数组

Returns

McDbObjectArray

打断后的曲线数组。

Inherited from

McDbCurve.splitCurvesFromParam


syncData

syncData(_toCpp?): boolean

同步实体的数据。这个方法可能是在修改了实体的属性或者附加了新的数据之后调用的,以确保所有的改变都被正确地保存到实体的数据库记录中。

Parameters

NameTypeDefault valueDescription
_toCppbooleantrue是否同步数据

Returns

boolean

Inherited from

McDbCurve.syncData


tempRelationObject

tempRelationObject(): number

与对象相关的临时关系数

Returns

number

Inherited from

McDbCurve.tempRelationObject


transformBy

transformBy(transformationMatrix): boolean

变换对象

Example

ts
import { McGeMatrix3d, McDbEntity, McGeVector3d} from 'mxcad'
 const ent = new McDbEntity()
   let matrix = new McGeMatrix3d();
   matrix.setToTranslation(new McGeVector3d(20,0,0));//平移
   ent.transformBy(matrix);

Parameters

NameTypeDescription
transformationMatrixMcGeMatrix3d变换矩阵

Returns

boolean

Inherited from

McDbCurve.transformBy


unErase

unErase(): boolean

反删除对象。

Returns

boolean

Inherited from

McDbCurve.unErase


updateDisplay

updateDisplay(): void

显示调用对象更新显示.

Returns

void

Inherited from

McDbCurve.updateDisplay