mxcad_2d API 文档 / 2d / McDbRotatedDimension
Class: McDbRotatedDimension
2d.McDbRotatedDimension
旋转标注尺寸类。
Example
//旋转标注
import { McDbRotatedDimension, MxCpp } from "mxcad"
const rDimension = new McDbRotatedDimension() // 构造旋转标注对象
rDimension.xLine1Point = new McGePoint3d(-1800, -800) // 设置对象第一条线的端点
rDimension.xLine2Point = new McGePoint3d(1800, -800) // 设置对象第二条线的端点
rDimension.dimLinePoint = new McGePoint3d(-800, -500) // 设置对象标注线的端点
rDimension.textAttachment = McDb.AttachmentPoint.kTopLeft // 设置对象文本对齐方式
rDimension.textRotation = 0.6 // 设置对象文字旋转角度
rDimension.trueColor = new McCmColor(200, 255, 0) // 设置对象颜色
rDimension.oblique = 0 // 设置对象倾斜角度
rDimension.rotation = 0 // 设置对象旋转角度
rDimension.dimensionText = "标注文本" // 设置对象文本内容
MxCpp.getCurrentMxCAD().drawEntity(rDimension);//绘制旋转标注对象Hierarchy
↳
McDbRotatedDimension
Table of contents
Constructors
Properties
Accessors
- colorIndex
- dimLinePoint
- dimensionStyle
- dimensionText
- drawOrder
- dxf0
- elevation
- horizontalRotation
- layer
- layerId
- linetype
- linetypeId
- linetypeScale
- lineweight
- objectName
- oblique
- rotation
- textAttachment
- textPosition
- textRotation
- textStyle
- textStyleId
- trueColor
- visible
- xLine1Point
- xLine2Point
Methods
- GetAllText
- IntersectWith
- assertObjectModification
- clone
- createExtensionDictionary
- deleteXData
- disableDisplay
- erase
- explode
- freeTempRelationObject
- getAllAppName
- getArea
- getBoundingBox
- getDatabase
- getDatabaseIndexId
- getDimVarDouble
- getDimVarInt
- getDimVarObjectId
- getDimVarString
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getObjectID
- getOwnerID
- getxData
- getxDataDouble
- getxDataLong
- getxDataPoint
- getxDataString
- highlight
- initTempObject
- isErased
- isHaveExtensionDictionary
- isKindOf
- isNull
- isUsingDefaultTextPosition
- mirror
- move
- moveGripPointsAt
- recomputeDimBlock
- rotate
- scaleEntity
- setDimVarDouble
- setDimVarInt
- setDimVarObjectId
- setDimVarString
- setJson
- setxData
- setxDataDouble
- setxDataLong
- setxDataPoint
- setxDataString
- syncData
- tempRelationObject
- transformBy
- unErase
- updateDisplay
- useDefaultTextPosition
- useSetTextPosition
Constructors
constructor
• new McDbRotatedDimension(imp?)
构造函数
Example
import { McDbRotatedDimension } from "mxcad";
const rDimension = new McDbRotatedDimension();Parameters
| Name | Type | Description |
|---|---|---|
imp? | any | 内部实现对象 |
Overrides
Properties
imp
• imp: any = 0
内部实现对象。
Inherited from
Accessors
colorIndex
• get colorIndex(): number
得到对象颜色索引
Example
import { McDbEntity, ColorIndexType } from 'mxcad'
const ent = new McDbEntity();
ent.colorIndex = ColorIndexType.kByblock;
console.log(ent.colorIndex)Returns
number
Inherited from
McDbDimension.colorIndex
• set colorIndex(val): void
设置对象颜色索引
Parameters
| Name | Type | Description |
|---|---|---|
val | number | 颜色索引(ColorIndexType) |
Returns
void
Inherited from
McDbDimension.colorIndex
dimLinePoint
• get dimLinePoint(): McGePoint3d
获取标注线的端点
Returns
标注线的端点
• set dimLinePoint(pt): void
设置标注线的端点
Parameters
| Name | Type | Description |
|---|---|---|
pt | McGePoint3d | 标注线的端点 |
Returns
void
dimensionStyle
• get dimensionStyle(): McObjectId
设置标注样式id
Example
import { MxCpp } from "mxcad";
//设置 dim 为有效标注实体
const dimStyleId = MxCpp.getCurrentMxCAD().addDimStyle("MyDimStyle2", "41,0.18,141,0.09,40,200", "77,1,271,3", "", "");
dim.dimensionStyle = dimStyleId;
console.log("标注样式id:", dim.dimensionStyle)Returns
Inherited from
McDbDimension.dimensionStyle
• set dimensionStyle(val): void
Parameters
| Name | Type |
|---|---|
val | McObjectId |
Returns
void
Inherited from
McDbDimension.dimensionStyle
dimensionText
• get dimensionText(): string
获取或设置标注文本
Example
//设置 dim 为有效标注实体
dim.dimensionText = "测试文本";
console.log("标注文本:", dim.dimensionText)// 测试文本Returns
string
Inherited from
McDbDimension.dimensionText
• set dimensionText(val): void
Parameters
| Name | Type |
|---|---|
val | string |
Returns
void
Inherited from
McDbDimension.dimensionText
drawOrder
• get drawOrder(): number
对象的显示顺序
Example
// 假设ent为有效实例对象
const order = ent.drawOrder();Returns
number
Inherited from
McDbDimension.drawOrder
• set drawOrder(order): void
对象的显示顺序
Example
import { MxCpp, MxCADSelectionSet } from "mxcad";
let ss = new MxCADSelectionSet();
if (!await ss.userSelect("\n选择对象")) return;
//得到当前图上对象的最大,小最显示顺序.
let minmaxOrder = MxCpp.getCurrentDatabase().currentSpace.getMinMaxDrawOrder();
// 把对象放到最上面。
let lOrder = minmaxOrder.maxDrawOrder + 1;
ss.forEach((id) => {
let ent = id.getMcDbEntity();
if (ent) {
ent.drawOrder = lOrder;
}
})Parameters
| Name | Type | Description |
|---|---|---|
order | number | 顺序值 |
Returns
void
Inherited from
McDbDimension.drawOrder
dxf0
• get dxf0(): string
得到对象的DXF组码的类型名,这个和AutoCAD中的DXF组码是一样。 比如直线的类型名为:McDbLine,DXF0组码值: LINE,DXF0组码值可以用来构造集时的类型过滤。
Returns
string
Inherited from
McDbDimension.dxf0
elevation
• get elevation(): number
获取或设置高度
Example
//设置 dim 为有效标注实体
dim.elevation = 10;
console.log("获取高度:", dim.elevation)Returns
number
Inherited from
McDbDimension.elevation
• set elevation(val): void
Parameters
| Name | Type |
|---|---|
val | number |
Returns
void
Inherited from
McDbDimension.elevation
horizontalRotation
• get horizontalRotation(): number
获取或设置水平旋转角度
Example
//设置 dim 为有效标注实体
dim.horizontalRotation = Math.PI/4
console.log("水平旋转角度:", dim.horizontalRotation)// 45Returns
number
水平旋转角度
Inherited from
McDbDimension.horizontalRotation
• set horizontalRotation(val): void
Parameters
| Name | Type |
|---|---|
val | number |
Returns
void
Inherited from
McDbDimension.horizontalRotation
layer
• get layer(): string
得到对象图层名
Returns
string
Inherited from
McDbDimension.layer
• set layer(val): void
设置对象图层名
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity();
ent.layer = "newLayerName";
console.log(ent.layer)Parameters
| Name | Type | Description |
|---|---|---|
val | string | 图层名 |
Returns
void
Inherited from
McDbDimension.layer
layerId
• get layerId(): McObjectId
获取图层ID对象
Example
// 假设ent为有效实例对象
const layerId = ent.layerId;Returns
Inherited from
McDbDimension.layerId
• set layerId(id): void
设置图层Id对象
Example
// 假设ent为有效实例对象
const mxcad = MxCpp.getCurrentMxCAD();
const layerId = mxcad.addLayer("测试图层")
ent.layerId = layerId;Parameters
| Name | Type |
|---|---|
id | McObjectId |
Returns
void
Inherited from
McDbDimension.layerId
linetype
• get linetype(): string
得到对象线型名
Returns
string
Inherited from
McDbDimension.linetype
• set linetype(val): void
设置对象线型名
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetype = "MyLineType";
console.log(ent.linetype)Parameters
| Name | Type | Description |
|---|---|---|
val | string | 线型名 |
Returns
void
Inherited from
McDbDimension.linetype
linetypeId
• get linetypeId(): McObjectId
获取实体对象线型ID
Example
// 假设ent为有效实例对象
const linetypeId = ent.linetypeId;Returns
Inherited from
McDbDimension.linetypeId
• set linetypeId(id): void
设置实体对象线型ID
Example
// 假设ent为有效实例对象
const mxcad = MxCpp.getCurrentMxCAD();
const lineId = mxcad.addLinetypeEx("TestMyLine", '25,-5');
ent.linetypeId = lineId;Parameters
| Name | Type |
|---|---|
id | McObjectId |
Returns
void
Inherited from
McDbDimension.linetypeId
linetypeScale
• get linetypeScale(): number
得到对象线型比例
Returns
number
Inherited from
McDbDimension.linetypeScale
• set linetypeScale(val): void
设置对象线型比例
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetypeScale = 0.8;
console.log(ent.linetypeScale)Parameters
| Name | Type | Description |
|---|---|---|
val | number | 线型比例 |
Returns
void
Inherited from
McDbDimension.linetypeScale
lineweight
• get lineweight(): number
得到对象线重
Returns
number
Inherited from
McDbDimension.lineweight
• set lineweight(val): void
设置对象线重
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.lineweight = 20;
console.log(ent.lineweight)Parameters
| Name | Type | Description |
|---|---|---|
val | number | 线重 |
Returns
void
Inherited from
McDbDimension.lineweight
objectName
• get objectName(): string
获取对象名称。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.objectName);Returns
string
返回对象名
Inherited from
McDbDimension.objectName
oblique
• get oblique(): number
获取倾斜角度
Returns
number
倾斜角度
• set oblique(val): void
设置倾斜角度
Parameters
| Name | Type | Description |
|---|---|---|
val | number | 倾斜角度 |
Returns
void
rotation
• get rotation(): number
获取旋转角度
Returns
number
旋转角度
• set rotation(val): void
设置旋转角度
Parameters
| Name | Type | Description |
|---|---|---|
val | number | 旋转角度 |
Returns
void
textAttachment
• get textAttachment(): AttachmentPoint
获取或设置文本附着点
Example
import { McDb } from "mxcad";
//设置 dim 为有效标注实体
dim.textAttachment = McDb.AttachmentPoin.kMiddleCenter//设置中心点对齐
console.log("文本附着点:", dim.textAttachment)// 5Returns
文本附着点
Inherited from
McDbDimension.textAttachment
• set textAttachment(val): void
Parameters
| Name | Type |
|---|---|
val | AttachmentPoint |
Returns
void
Inherited from
McDbDimension.textAttachment
textPosition
• get textPosition(): McGePoint3d
获取文本位置
Example
//设置 dim 为有效标注实体
const position = dim.textPosition;
console.log(position);Returns
文本位置
Inherited from
McDbDimension.textPosition
• set textPosition(pt): void
设置文本位置
Example
//设置 dim 为有效标注实体
dim.textPosition = new McGePoint3(0,0,0);Parameters
| Name | Type | Description |
|---|---|---|
pt | McGePoint3d | 文本位置 |
Returns
void
Inherited from
McDbDimension.textPosition
textRotation
• get textRotation(): number
获取或设置文本旋转角度
Example
//设置 dim 为有效标注实体
dim.textRotation = Math.PI/4;
console.log("旋转角度:", dim.textRotation)Returns
number
Inherited from
McDbDimension.textRotation
• set textRotation(val): void
Parameters
| Name | Type |
|---|---|
val | number |
Returns
void
Inherited from
McDbDimension.textRotation
textStyle
• get textStyle(): string
得到对象文字样式
Returns
string
Inherited from
McDbDimension.textStyle
• set textStyle(val): void
设置对象文字样式
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.textStyle = "st_style";Parameters
| Name | Type | Description |
|---|---|---|
val | string | 文字样式名 |
Returns
void
Inherited from
McDbDimension.textStyle
textStyleId
• get textStyleId(): McObjectId
获取实体文字样式
Example
// 假设ent为有效实例对象
const textStyleId = ent.textStyleId;Returns
Inherited from
McDbDimension.textStyleId
• set textStyleId(id): void
设置实体的文字样式
Example
// 假设ent为有效实例对象
const mxcad = MxCpp.getCurrentMxCAD();
const textStyleId = mxcad.addTextStyle("MyLineTypeTextStyle", "txt.shx", "hztxt.shx", 1);
ent.textStyleId = textStyleId;Parameters
| Name | Type |
|---|---|
id | McObjectId |
Returns
void
Inherited from
McDbDimension.textStyleId
trueColor
• get trueColor(): McCmColor
得到对象颜色
Example
import { McDbEntity, McCmColor} from 'mxcad'
const ent = new McDbEntity();
ent.trueColor = new McCmColor(255, 0, 0);
console.log(ent.trueColor)Returns
Inherited from
McDbDimension.trueColor
• set trueColor(val): void
设置对象颜色
Parameters
| Name | Type |
|---|---|
val | McCmColor |
Returns
void
Inherited from
McDbDimension.trueColor
visible
• get visible(): boolean
对象是否可见
Returns
boolean
Inherited from
McDbDimension.visible
• set visible(val): void
设置是否可见
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.visible = true;
console.log(ent.visible)Parameters
| Name | Type | Description |
|---|---|---|
val | boolean | 布尔值 |
Returns
void
Inherited from
McDbDimension.visible
xLine1Point
• get xLine1Point(): McGePoint3d
获取第一条线的端点
Example
Returns
第一条线的端点
• set xLine1Point(pt): void
设置第一条线的端点
Parameters
| Name | Type | Description |
|---|---|---|
pt | McGePoint3d | 第一条线的端点 |
Returns
void
xLine2Point
• get xLine2Point(): McGePoint3d
获取第二条线的端点
Returns
第二条线的端点
• set xLine2Point(pt): void
设置第二条线的端点
Parameters
| Name | Type | Description |
|---|---|---|
pt | McGePoint3d | 第二条线的端点 |
Returns
void
Methods
GetAllText
▸ GetAllText(): McGeStringArray
得到标注对象中的所有文字内容
Example
//遍历dim中的所有文字
//设置 dim 为有效标注实体
let txts = dim.GetAllText();
txts.forEach((val, index) => {
console.log(val)
});Returns
Inherited from
IntersectWith
▸ IntersectWith(intersectObject, exOption): McGePoint3dArray
与其他实体相交, 得到交点
Example
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
| Name | Type | Description |
|---|---|---|
intersectObject | McDbEntity | 需要相交的是实体对象 |
exOption | Intersect | 相交的选项 |
Returns
得到所有交点
Inherited from
assertObjectModification
▸ assertObjectModification(autoUndo?): number
设置对象被改变的状态,可自动触发更新显示函数,更新显示。 比如块表记录更新了,需要通知块引用更新显示,可以调用该函数。
Example
//假设obj为一个数据库对象
obj.assertObjectModification()Parameters
| Name | Type | Default value |
|---|---|---|
autoUndo | boolean | false |
Returns
number
Inherited from
McDbDimension.assertObjectModification
clone
▸ clone(): null | McDbObject
克隆对象。
Example
//假设obj为一个数据库对象
const obj_clone = obj.clone();Returns
null | McDbObject
克隆出的对象。
Inherited from
createExtensionDictionary
▸ createExtensionDictionary(): boolean
创建对象的扩展字典数据.
Example
//假设obj为一个数据库对象
const res = obj.createExtensionDictionary();Returns
boolean
Inherited from
McDbDimension.createExtensionDictionary
deleteXData
▸ deleteXData(appName): boolean
删除实体指定应用程序名称相关的数据
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.deleteXData("DataName");
if(res){
//删除成功
}else
//删除失败
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
Returns
boolean
Inherited from
disableDisplay
▸ disableDisplay(isDisable): void
禁用对象的自动更新显示.
Example
import { McDbLine } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
line1.disableDisplay(true)Parameters
| Name | Type | Description |
|---|---|---|
isDisable | boolean | 是否禁用对象自动更新显示 |
Returns
void
Inherited from
erase
▸ erase(): boolean
删除对象。
Example
//假设obj为一个数据库对象
const res = obj.erase();
console.log(res);Returns
boolean
是否删除成功。
Inherited from
explode
▸ explode(): MxCADResbuf
打碎对象,返回打后对象数据链表
Example
import { McDbEntity, MxCADResbuf } from "mxcad";
// 获取目标对象
let getEnt = new MxCADUiPrEntity();
getEnt.setMessage("选择打碎对象:");
let id = await getEnt.go();
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
// 打碎对象
let retExplode: MxCADResbuf = ent.explode();Returns
resbuf 数据
Inherited from
freeTempRelationObject
▸ freeTempRelationObject(): void
释放临时关系对象
Example
//假设obj为一个数据库对象
obj.freeTempRelationObject();Returns
void
Inherited from
McDbDimension.freeTempRelationObject
getAllAppName
▸ getAllAppName(): McGeStringArray
获取实体中包含的所有 XData 记录的应用程序名(AppName)
Example
// 假设ent为有效实例对象
const appNames = ent.getAllAppName();
console.log(appNames);Returns
Inherited from
getArea
▸ getArea(): Object
计算面积
Example
import { McGePoint3d, McDbCircle } from "mxcad"
const center = new McGePoint3d(0,0,0);
const circle = new McDbCircle(center, 20);
const area = circle.getArea();
console.log("圆面积:", area)Returns
Object
val 面积值 | ret 是否获取成功
| Name | Type |
|---|---|
ret | boolean |
val | number |
Inherited from
getBoundingBox
▸ getBoundingBox(): Object
得到对象的最小外包
Example
import { McDbText, McGePoint3d } from 'mxcad'
const text = new McDbText();
text.textString = "测试Test";
text.height = 20;
text.position = text.alignmentPoint = new McGePoint3d(0,0,0);
const { minPt, maxPt, ret } = text.getBoundingBox()Returns
Object
| Name | Type |
|---|---|
maxPt | McGePoint3d |
minPt | McGePoint3d |
ret | boolean |
Inherited from
getDatabase
▸ getDatabase(): McDbDatabase
得到对象所在的数据库
Example
//假设obj为一个数据库对象
const data = obj.getDatabase();Returns
返回数据库
Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
获取对象的索引ID
Example
//假设obj为一个数据库对象
const id = obj.getDatabaseIndexId();Returns
number
Inherited from
McDbDimension.getDatabaseIndexId
getDimVarDouble
▸ getDimVarDouble(iType): number
获取标注变量浮点数值
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
Returns
number
标注变量浮点数值
Inherited from
getDimVarInt
▸ getDimVarInt(iType): number
获取标注变量整数值
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
Returns
number
标注变量整数值
Inherited from
getDimVarObjectId
▸ getDimVarObjectId(iType): McObjectId
获取标注变量对象 ID
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
Returns
标注变量对象 ID
Inherited from
McDbDimension.getDimVarObjectId
getDimVarString
▸ getDimVarString(iType): string
获取标注变量字符串值
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
Returns
string
标注变量字符串值
Inherited from
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
得到对象的扩展字典数据.
Example
//假设obj为一个数据库对象
const id = obj.getOwnerID();Returns
扩展字典数据
Inherited from
McDbDimension.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
获取对象的控制点
Example
//假设obj为一个数据库对象
const ptArr = obj.getGripPoints();Returns
Inherited from
getHandle
▸ getHandle(): string
得到对象句柄
Example
//假设obj为一个数据库对象
const handle = obj.getHandle();Returns
string
返回对象句柄
Inherited from
getImp
▸ getImp(): any
获取内部实现对象。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let imp = obj.getImp();Returns
any
内部实现对象。
Inherited from
getJson
▸ getJson(): string
获取 JSON 格式的字符串。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const json = obj.getJson()Returns
string
JSON 格式的字符串。
Inherited from
getObjectID
▸ getObjectID(): McObjectId
获取对象 ID。
Example
import { McDbObject } from "mxcad";
const obj = new McDbObject();
const id = obj.getObjectID();Returns
对象 ID。
Inherited from
getOwnerID
▸ getOwnerID(): number
得到对象拥用者的id
Example
//假设obj为一个数据库对象
const id = obj.getOwnerID();Returns
number
Inherited from
getxData
▸ getxData(appName?): MxCADResbuf
得到对象的扩展数据
Example
// 假设ent为有效实例对象
const xData = ent.getXData();Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
appName | string | "" | 扩展数据名 |
Returns
Inherited from
getxDataDouble
▸ getxDataDouble(appName): Object
获取实体的指定 XData 类型中的 double 值
Example
// 假设ent为有效实例对象
let data = ent.getxDataDouble("DataName");
if(data.ret){
console.log(data.val)
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
Returns
Object
double 值
| Name | Type |
|---|---|
ret | boolean |
val | number |
Inherited from
getxDataLong
▸ getxDataLong(appName): Object
获取实体的指定 XData 类型中的 long(整数)值
Example
// 假设ent为有效实例对象
let data = ent.getxDataLong("DataName");
if(data.ret){
console.log(data.val)
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
Returns
Object
long 值
| Name | Type |
|---|---|
ret | boolean |
val | number |
Inherited from
getxDataPoint
▸ getxDataPoint(appName): Object
获取实体的指定 XData 类型中的点对象
Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
Returns
Object
获取结果及三维点对象
| Name | Type |
|---|---|
ret | boolean |
val | McGePoint3d |
Inherited from
getxDataString
▸ getxDataString(appName): Object
获取与特定实体关联的 XData 信息,并以字符串形式返回
Example
// 假设ent为有效实例对象
let data = ent.getxDataString("DataName");
if(data.ret){
console.log(data.val)
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
Returns
Object
val XData信息 | ret 是否返回成功
| Name | Type |
|---|---|
ret | boolean |
val | string |
Inherited from
highlight
▸ highlight(isHighlight): void
设置对象是否高亮
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.highlight(true);Parameters
| Name | Type | Description |
|---|---|---|
isHighlight | boolean | 是否高亮 |
Returns
void
Inherited from
initTempObject
▸ initTempObject(imp): void
初始化临时对象。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
obj.initTempObject()Parameters
| Name | Type | Description |
|---|---|---|
imp | any | 内部实现对象。 |
Returns
void
Inherited from
isErased
▸ isErased(): boolean
对象是否已经删除
Example
//假设obj为一个数据库对象
const res = obj.isErased();
console.log(res);Returns
boolean
Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
是否有扩展字典数据.
Example
//假设obj为一个数据库对象
const res = obj.isHaveExtensionDictionary();Returns
boolean
Inherited from
McDbDimension.isHaveExtensionDictionary
isKindOf
▸ isKindOf(sObjectName): boolean
判断对象类型
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); // 输出: true 或 falseParameters
| Name | Type | Description |
|---|---|---|
sObjectName | string | 类型名 |
Returns
boolean
返回对象是否是目标类型
Inherited from
isNull
▸ isNull(): any
判断是否为空对象
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.isNull()); // 输出: true 或 falseReturns
any
Inherited from
isUsingDefaultTextPosition
▸ isUsingDefaultTextPosition(): boolean
是否使用默认文本位置
Example
//设置 dim 为有效标注实体
const isUsing = dim.isUsingDefaultTextPosition;
if(isUsing){
//使用默认文本位置
}else{
//未使用默认文本位置
}Returns
boolean
是否使用默认文本位置
Inherited from
McDbDimension.isUsingDefaultTextPosition
mirror
▸ mirror(point1, point2): boolean
镜向对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.mirror(new McGePoint3d(0,0,0), new McGePoint3d(20,10,0))Parameters
| Name | Type | Description |
|---|---|---|
point1 | McGePoint3d | 镜像基点 |
point2 | McGePoint3d | - |
Returns
boolean
Inherited from
move
▸ move(fromPoint, toPoint): boolean
移动对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.move(new McGePoint3d(0,0,0), new McGePoint3d(20,0,0))Parameters
| Name | Type | Description |
|---|---|---|
fromPoint | McGePoint3d | 移动开始点 |
toPoint | McGePoint3d | 移动结束点 |
Returns
boolean
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any
移动对象的控制点
Example
//假设obj为一个数据库对象
obj.moveGripPointsAt(1,10,10,10);Parameters
| Name | Type | Description |
|---|---|---|
iIndex | number | 索引 |
dXOffset | number | X轴偏移量 |
dYOffset | number | Y轴偏移量 |
dZOffset | number | Z轴偏移量 |
Returns
any
Inherited from
McDbDimension.moveGripPointsAt
recomputeDimBlock
▸ recomputeDimBlock(): void
重新计算标注块
Example
//设置 dim 为有效标注实体
dim.recomputeDimBlock()Returns
void
Inherited from
McDbDimension.recomputeDimBlock
rotate
▸ rotate(basePoint, dRotationAngle): boolean
旋转对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.rotate(new McGePoint3d(0,0,0), Math.PI)Parameters
| Name | Type | Description |
|---|---|---|
basePoint | McGePoint3d | 旋转基点 |
dRotationAngle | number | 旋转角度 |
Returns
boolean
Inherited from
scaleEntity
▸ scaleEntity(basePoint, dScaleFactor): boolean
缩放对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.scaleEntity(new McGePoint3d(0,0,0), 0.5)Parameters
| Name | Type | Description |
|---|---|---|
basePoint | McGePoint3d | 缩放基点 |
dScaleFactor | number | 缩放因子(<1 缩小; >1 放大) |
Returns
boolean
Inherited from
setDimVarDouble
▸ setDimVarDouble(iType, val): void
设置标注变量浮点数值
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
val | number | 标注变量浮点数值 |
Returns
void
Inherited from
setDimVarInt
▸ setDimVarInt(iType, val): void
设置标注变量整数值
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
val | number | 标注变量整数值 |
Returns
void
Inherited from
setDimVarObjectId
▸ setDimVarObjectId(iType, val): void
设置标注变量对象 ID
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
val | McObjectId | 标注变量对象 ID |
Returns
void
Inherited from
McDbDimension.setDimVarObjectId
setDimVarString
▸ setDimVarString(iType, val): void
设置标注变量字符串值
Parameters
| Name | Type | Description |
|---|---|---|
iType | number | 标注变量类型 |
val | string | 标注变量字符串值 |
Returns
void
Inherited from
setJson
▸ setJson(str): boolean
设置 JSON 格式的字符串。
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const res = obj.setJson('{"key": "value"}');
console.log(res)Parameters
| Name | Type | Description |
|---|---|---|
str | string | JSON 格式的字符串。 |
Returns
boolean
是否设置成功。
Inherited from
setxData
▸ setxData(xdata): boolean
设置对象的扩展数据
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
//设置扩展数据
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
ent.setxData(new MxCADResbuf([{type:DxfCode.kExDataName,val:"DataName"},{type:DxfCode.kString,val:"yyyyy"}]));Parameters
| Name | Type | Description |
|---|---|---|
xdata | MxCADResbuf | 扩展数据链表 |
Returns
boolean
Inherited from
setxDataDouble
▸ setxDataDouble(appName, val): boolean
设置实体的指定 XData 类型中的 double 值
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataDouble("DataName", 0);
if(res){
//设置成功
}else{
//设置失败
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
val | number | double 值 |
Returns
boolean
布尔值
Inherited from
setxDataLong
▸ setxDataLong(appName, val): boolean
设置实体的指定 XData 类型中的 long(整数)值
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataLong("DataName", 123456);
if(res){
//设置成功
}else{
//设置失败
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
val | number | long 值 |
Returns
boolean
long 值
Inherited from
setxDataPoint
▸ setxDataPoint(appName, val): boolean
设置实体的指定 XData 类型中的点对象
Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
val | McGePoint3d | 点对象 |
Returns
boolean
获取结果及三维点对象
Inherited from
setxDataString
▸ setxDataString(appName, val): boolean
设置与特定实体关联的 XData 信息,并以字符串形式设置
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataString("DataName", "xxxxx");
if(res){
//设置成功
}else{
//设置失败
}Parameters
| Name | Type | Description |
|---|---|---|
appName | string | 扩展数据名称 |
val | string | 字符串值 |
Returns
boolean
是否设置成功
Inherited from
syncData
▸ syncData(_toCpp?): boolean
同步实体的数据。这个方法可能是在修改了实体的属性或者附加了新的数据之后调用的,以确保所有的改变都被正确地保存到实体的数据库记录中。
Example
// 假设ent为有效实例对象
const res = ent.syncData(true);
if(res){
//同步成功
}else{
//同步失败
}Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
_toCpp | boolean | true | 是否同步数据 |
Returns
boolean
Inherited from
tempRelationObject
▸ tempRelationObject(): number
与对象相关的临时关系数
Returns
number
Inherited from
McDbDimension.tempRelationObject
transformBy
▸ transformBy(transformationMatrix): boolean
变换对象
Example
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
| Name | Type | Description |
|---|---|---|
transformationMatrix | McGeMatrix3d | 变换矩阵 |
Returns
boolean
Inherited from
unErase
▸ unErase(): boolean
反删除对象。
Example
//假设obj为一个数据库对象
const res = obj.unErase();
console.log(res);Returns
boolean
Inherited from
updateDisplay
▸ updateDisplay(): void
显示调用对象更新显示.
Example
// 假设ent为有效实例对象
ent.updateDisplay()Returns
void
Inherited from
useDefaultTextPosition
▸ useDefaultTextPosition(): void
使用默认文本位
Example
//设置 dim 为有效标注实体
dim.useDefaultTextPosition();Returns
void
Inherited from
McDbDimension.useDefaultTextPosition
useSetTextPosition
▸ useSetTextPosition(): void
使用设置的文本位置
Example
//设置 dim 为有效标注实体
dim.useSetTextPosition();Returns
void