mxcad_2d API 文档 / 2d / MxCADUiPrInt
Class: MxCADUiPrInt
2d.MxCADUiPrInt
UI交互 根据用户输入得到整型数字
Example
import { MxCADUiPrInt } from 'mxcad'
const getInt = new MxCADUiPrInt()
getInt.setMessage("提示用户输入数字:")
const intVal = await getInt.go()
console.log(intVal)
Hierarchy
↳
MxCADUiPrInt
Table of contents
Constructors
Methods
- abort
- clearLastInputPoint
- disableAllTrace
- drawReserve
- getCursorType
- getDetailedResult
- getDynamicInputType
- getInputToucheType
- getStatus
- go
- isDisableDynInput
- isDisableDynamicTrace
- isDisableGridTrace
- isDisableOrthoTrace
- isDisableOsnap
- isDisablePolarAxisTrace
- isKeyWordPicked
- isOffsetInputPostion
- keyWordPicked
- keyWords
- message
- setCursorType
- setDisableDynInput
- setDisableDynamicTrace
- setDisableGridTrace
- setDisableOrthoTrace
- setDisableOsnap
- setDisablePolarAxisTrace
- setDynamicInputType
- setInputToucheType
- setKeyWords
- setLastInputPoint
- setMessage
- setOffsetInputPostion
- setUserDraw
- setUserInputControls
- userInputControls
- value
Constructors
constructor
• new MxCADUiPrInt()
构造函数
Example
import { MxCADUiPrInt } from 'mxcad';
const getInt = new MxCADUiPrInt();
Overrides
Methods
abort
▸ abort(cause?
): void
停止当前动态拖动
Parameters
Name | Type | Default value |
---|---|---|
cause | DetailedResult | DetailedResult.kCodeAbort |
Returns
void
void
Inherited from
clearLastInputPoint
▸ clearLastInputPoint(): void
清除上一次的输入点数据。
Example
//以 MxCADUiPrPoint 类示例, 其他MxCADUiPr* 系列的类同理
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.clearLastInputPoint();
Returns
void
Inherited from
MxCADUiPrBase.clearLastInputPoint
disableAllTrace
▸ disableAllTrace(isDisable?
): void
禁用所有跟踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.disableAllTrace(true);
Parameters
Name | Type | Default value | Description |
---|---|---|---|
isDisable | boolean | true | 是否禁用 |
Returns
void
Inherited from
drawReserve
▸ drawReserve(callAddEntity?
): void
把动态绘制的对象,保留到图上。
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
const basePt = new McGePoint3d(0, 0, 0);
getPoint.setBasePt(basePt);
getPoint.setUserDraw((pt,pw)=>{
const line = new McDbLine(basePt, pt);
pw.drawMcDbEntity(line)
})
const val = await getPoint.go();
if (!val) return;
getPoint.drawReserve()
Parameters
Name | Type | Description |
---|---|---|
callAddEntity? | (ent : Object3D ) => void | 回调参数ent 类型:THREE.THREE.Object3D |
Returns
void
Inherited from
getCursorType
▸ getCursorType(): MxCursorType
返回光标类型
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.getCursorType())
Returns
MxCursorType
Inherited from
getDetailedResult
▸ getDetailedResult(): DetailedResult
返回交互操作退出的详细原因
Example
//以 MxCADUiPrDist 类示例
import { MxCADUiPrDist } from 'mxcad';
import { DetailedResult } from "mxdraw";
const getDist = new MxCADUiPrDist();
const val = await getDist.go();
if (!val) return;
if (getDist.getDetailedResult() === DetailedResult.kCoordIn) {
console.log('提示输入', val)
}
Returns
DetailedResult
当前交互操作返回值类型
Inherited from
MxCADUiPrBase.getDetailedResult
getDynamicInputType
▸ getDynamicInputType(): DynamicInputType
返回动态输入类型
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.getDynamicInputType())
Returns
DynamicInputType
动态输入显示类型
Inherited from
MxCADUiPrBase.getDynamicInputType
getInputToucheType
▸ getInputToucheType(): number
返回需要的Touche输入类型
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
const toucheType = getPoint.getInputToucheType();
console.log(toucheType)
Returns
number
Touche输入类型
Inherited from
MxCADUiPrBase.getInputToucheType
getStatus
▸ getStatus(): MrxDbgUiPrBaseReturn
获取操作状态
Example
//以 MxCADUiPrDist 类示例
import { MxCADUiPrDist } from 'mxcad';
import { MrxDbgUiPrBaseReturn } from "mxdraw";
const getDist = new MxCADUiPrDist();
const val = await getDist.go();
if (!val) return;
if(getPoint.getStatus() === MrxDbgUiPrBaseReturn.kNone) {
// 空输入
}
Returns
MrxDbgUiPrBaseReturn
操作状态值
Inherited from
go
▸ go(): Promise
<null
| number
>
开始动态拖动
Example
import { MxCADUiPrInt } from 'mxcad'
const getInt = new MxCADUiPrInt();
const int = await getInt.go();
Returns
Promise
<null
| number
>
返回一个promise对象,包含了用户输入的整数
isDisableDynInput
▸ isDisableDynInput(): boolean
是否禁用动态输入框
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableDynInput())
Returns
boolean
Inherited from
MxCADUiPrBase.isDisableDynInput
isDisableDynamicTrace
▸ isDisableDynamicTrace(): boolean
是否禁用动态跟踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableDynamicTrace())
Returns
boolean
Inherited from
MxCADUiPrBase.isDisableDynamicTrace
isDisableGridTrace
▸ isDisableGridTrace(): boolean
是否禁用格网追踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableGridTrace())
Returns
boolean
Inherited from
MxCADUiPrBase.isDisableGridTrace
isDisableOrthoTrace
▸ isDisableOrthoTrace(): boolean
是否禁用正射追踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableOrthoTrace())
Returns
boolean
Inherited from
MxCADUiPrBase.isDisableOrthoTrace
isDisableOsnap
▸ isDisableOsnap(): boolean
是否禁用捕捉
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableOsnap())
Returns
boolean
Inherited from
isDisablePolarAxisTrace
▸ isDisablePolarAxisTrace(): boolean
是否禁用极轴跟踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisablePolarAxisTrace())
Returns
boolean
Inherited from
MxCADUiPrBase.isDisablePolarAxisTrace
isKeyWordPicked
▸ isKeyWordPicked(matchKeyWord
): boolean
测试某一个关键字是否被用户选择
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
getPoint.setKeyWords("[选项1(A)/选项2(B)]");
const pt = await getPoint.go();
if(getPoint.isKeyWordPicked('A')){
console.log('选项1')
}else if(getPoint.isKeyWordPicked('B')){
console.log('选项2')
}
Parameters
Name | Type | Description |
---|---|---|
matchKeyWord | string | 要检测的关键字 |
Returns
boolean
true为真
Inherited from
isOffsetInputPostion
▸ isOffsetInputPostion(): boolean
是否输入点遍移一个距离
Returns
boolean
Inherited from
MxCADUiPrBase.isOffsetInputPostion
keyWordPicked
▸ keyWordPicked(): string
返回用户选择的关键字
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
getPoint.setKeyWords("[选项1(A)/选项2(B)]");
const pt = await getPoint.go();
const key = getPoint.keyWordPicked();
console.log(key)
Returns
string
选择的关键字
Inherited from
keyWords
▸ keyWords(): string
返回关键字列表
Example
//以 MxCADUiPrPoint 类示例,其他MxCADUiPr* 系列的类同理
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.setKeyWords("[选项1(A)/选项2(B)]");
const keyList = getPoint.keyWords();
console.log("关键词列表", keyList)// 关键词列表 [选项1(A)/选项2(B)]
Returns
string
关键词列表
Inherited from
message
▸ message(): string
提示字符串
Example
//以 MxCADUiPrPoint 类示例, 其他MxCADUiPr* 系列的类同理
import { MxCADUiPrPoint , McGePoint3d} from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.setMessage("测试信息");
console.log(getPoint.message());//测试信息
Returns
string
提示消息
Inherited from
setCursorType
▸ setCursorType(type
): void
设置光标类型
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
import { MxCursorType } from "mxdraw";
const getPoint = new MxCADUiPrPoint()
getPoint.setMessage("指定文字起点:")
getPoint.setCursorType(MxCursorType.kCross);
const pt = await getPoint.go();
Parameters
Name | Type | Description |
---|---|---|
type | MxCursorType | 鼠标样式类型 |
Returns
void
Inherited from
setDisableDynInput
▸ setDisableDynInput(isDisable
): void
设置是否禁用动态输入框
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableDynInput(true);
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用 |
Returns
void
Inherited from
MxCADUiPrBase.setDisableDynInput
setDisableDynamicTrace
▸ setDisableDynamicTrace(isDisable
): void
设置是否禁用动态跟踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableDynamicTrace(true);
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用 |
Returns
void
Inherited from
MxCADUiPrBase.setDisableDynamicTrace
setDisableGridTrace
▸ setDisableGridTrace(isDisable
): void
设置是否禁用格网追踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableGridTrace(true);
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用 |
Returns
void
Inherited from
MxCADUiPrBase.setDisableGridTrace
setDisableOrthoTrace
▸ setDisableOrthoTrace(isDisable
): void
设置是否禁用正射追踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableOrthoTrace(true);
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用 |
Returns
void
Inherited from
MxCADUiPrBase.setDisableOrthoTrace
setDisableOsnap
▸ setDisableOsnap(isDisable
): void
设置是否禁用捕捉
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableOsnap(true);
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用 |
Returns
void
Inherited from
setDisablePolarAxisTrace
▸ setDisablePolarAxisTrace(isDisable
): void
设置是否禁用极轴跟踪
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisablePolarAxisTrace(true);
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用 |
Returns
void
Inherited from
MxCADUiPrBase.setDisablePolarAxisTrace
setDynamicInputType
▸ setDynamicInputType(type
): void
设置动态输入类型
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
import { DynamicInputType } from "mxdraw";
const getPoint = new MxCADUiPrPoint()
getPoint.setDynamicInputType(DynamicInputType.kXYCoordInput);
Parameters
Name | Type | Description |
---|---|---|
type | DynamicInputType | 动态输入显示类型 |
Returns
void
Inherited from
MxCADUiPrBase.setDynamicInputType
setInputToucheType
▸ setInputToucheType(toucheType
): void
设置需要的Touche输入类型,默认值是 MxType.InputToucheType.kGetBegan
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
getPoint.setInputToucheType(MxType.InputToucheType.kGetEnd);
Parameters
Name | Type | Description |
---|---|---|
toucheType | number | toucheType类型 |
Returns
void
Inherited from
MxCADUiPrBase.setInputToucheType
setKeyWords
▸ setKeyWords(keyWordList
): void
设置关键字列表
Example
//以 MxCADUiPrPoint 类示例, 其他MxCADUiPr* 系列的类同理
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.setKeyWords("[选项1(A)/选项2(B)]")
Parameters
Name | Type | Description |
---|---|---|
keyWordList | string | 关键词列表 |
Returns
void
void
Inherited from
setLastInputPoint
▸ setLastInputPoint(pt
): void
设置上一次的输入点。
Example
//以 MxCADUiPrPoint 类示例, 其他MxCADUiPr* 系列的类同理
import { MxCADUiPrPoint , McGePoint3d} from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.setLastInputPoint(new McGePoint3d(0,0,0));
Parameters
Name | Type | Description |
---|---|---|
pt | McGePoint3d | 点对象 |
Returns
void
Inherited from
MxCADUiPrBase.setLastInputPoint
setMessage
▸ setMessage(message
): void
设置提示字符串
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.setMessage("\n提示消息")
Parameters
Name | Type | Description |
---|---|---|
message | string | 提示消息 |
Returns
void
提示消息
Inherited from
setOffsetInputPostion
▸ setOffsetInputPostion(isOffset
): void
设置输入点遍移一个距离
Parameters
Name | Type |
---|---|
isOffset | boolean |
Returns
void
Inherited from
MxCADUiPrBase.setOffsetInputPostion
setUserDraw
▸ setUserDraw(pDraw
): void
设置交互过程的动态绘制调用对象
Example
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
getPoint.setUserDraw((pt,pw)=>{
console.log(pt, pw)
})
const pt = await getPoint.go();
Parameters
Name | Type | Description |
---|---|---|
pDraw | (currentPoint : McGePoint3d , pWorldDraw : McEdGetPointWorldDrawObject ) => void | McEdGetPointWorldDrawObject | 动态绘制调用对象 |
Returns
void
void
Inherited from
setUserInputControls
▸ setUserInputControls(contros
): void
设置输入控制设置
Example
// 以 MxCADUiPrInt 类示例
import { MxCADUiPrInt } from 'mxcad';
import { UserInputControls } from "mxdraw"
let getInt = new MxCADUiPrInt();
getInt.setMessage("输入整数:");
getInt.setUserInputControls(UserInputControls.kNoZeroResponseAccepted);
let iRowNum = await getInt.go();
if (iRowNum == null) return;
Parameters
Name | Type |
---|---|
contros | number |
Returns
void
Inherited from
MxCADUiPrBase.setUserInputControls
userInputControls
▸ userInputControls(): number
返回输入控制设置
Example
// 以 MxCADUiPrInt 类示例
import { MxCADUiPrInt } from 'mxcad';
let getInt = new MxCADUiPrInt();
console.log(getInt.userInputControls())
Returns
number
Inherited from
MxCADUiPrBase.userInputControls
value
▸ value(): number
得以获取的整数
Example
import { MxCADUiPrInt } from 'mxcad';
const getInt = new MxCADUiPrInt();
const val = await getInt.go();
if(!val) return;
const int = getInt.value();
Returns
number