Skip to content
On this page

mxcad_2d API 文档 / 2d / MxCADUiPrPoint

Class: MxCADUiPrPoint

2d.MxCADUiPrPoint

UI交互取点 (鼠标点击画布)

Example

ts
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint()
  const point = await getPoint.go()
  console.log(point)

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new MxCADUiPrPoint()

Overrides

MxCADUiPrBase.constructor

Properties

imp

Protected imp: any

内部实现对象

Inherited from

MxCADUiPrBase.imp


mxobj

Protected mxobj: MxDrawObject

MxDraw 实例对象

Inherited from

MxCADUiPrBase.mxobj

Methods

abort

abort(cause?): void

停止当前动态拖动

Parameters

NameTypeDefault value
causeDetailedResultDetailedResult.kCodeAbort

Returns

void

void

Inherited from

MxCADUiPrBase.abort


basePt

basePt(): McGePoint3d

得到动态拖动的基点

Returns

McGePoint3d

基点 THREE.THREE.Vector3


cad2doc1

Protected cad2doc1(pt): Vector3

cad坐标转文档坐标

Parameters

NameTypeDescription
ptMcGePoint3d三维点对象

Returns

Vector3

THREE.js点对象

Inherited from

MxCADUiPrBase.cad2doc1


cad2doc2

Protected cad2doc2(x, y, z): Vector3

cad坐标转文档坐标

Parameters

NameTypeDescription
xnumberX轴值
ynumberY轴值
znumberZ轴值

Returns

Vector3

THREE.js点对象

Inherited from

MxCADUiPrBase.cad2doc2


clearLastInputPoint

clearLastInputPoint(): void

清除上一次的输入点数据。

Returns

void

选择的关键字

Inherited from

MxCADUiPrBase.clearLastInputPoint


disableAllTrace

disableAllTrace(isDisable?): void

禁用所有跟踪

Parameters

NameTypeDefault value
isDisablebooleantrue

Returns

void

Inherited from

MxCADUiPrBase.disableAllTrace


doc2cad1

Protected doc2cad1(pt): McGePoint3d

文档坐标转cad坐标

Parameters

NameTypeDescription
ptVector3THREE.js坐标

Returns

McGePoint3d

三维点对象

Inherited from

MxCADUiPrBase.doc2cad1


doc2cad2

Protected doc2cad2(x, y, z): McGePoint3d

文档坐标转cad坐标

Parameters

NameTypeDescription
xnumberX轴值
ynumberY轴值
znumberZ轴值

Returns

McGePoint3d

三维点对象

Inherited from

MxCADUiPrBase.doc2cad2


drawReserve

drawReserve(callAddEntity?): void

把动态绘制的对象,保留到图上。

Parameters

NameTypeDescription
callAddEntity?(ent: Object3D) => void回调参数ent 类型:THREE.THREE.Object3D

Returns

void

点对象 DWG图纸坐标

Inherited from

MxCADUiPrBase.drawReserve


getCursorType

getCursorType(): MxCursorType

返回光标类型

Returns

MxCursorType

Inherited from

MxCADUiPrBase.getCursorType


getDetailedResult

getDetailedResult(): DetailedResult

返回交互操作退出的详细原因

Example

ts
import { MxCADUiPrDist, DetailedResult } from 'mxcad';

   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


getDocValue

getDocValue(): McGePoint3d

得到 Three.js 坐标.

Returns

McGePoint3d

点对象 MdGePoint3d


getDynamicInputType

getDynamicInputType(): DynamicInputType

返回动态输入类型

Returns

DynamicInputType

动态输入显示类型

Inherited from

MxCADUiPrBase.getDynamicInputType


getInputToucheType

getInputToucheType(): number

返回需要的Touche输入类型

Returns

number

Inherited from

MxCADUiPrBase.getInputToucheType


getStatus

getStatus(): MrxDbgUiPrBaseReturn

获取操作状态

Returns

MrxDbgUiPrBaseReturn

Inherited from

MxCADUiPrBase.getStatus


go

go(): Promise<null | McGePoint3d>

运行go方法, 将返回用户交互的Promise任务

Description

当鼠标点击画布后 Promise完成, 得到其点击的坐标点 其他交互操作方式将返回null 如按下Esc取消键或在交互中输入对应的关键词

Returns

Promise<null | McGePoint3d>


isDisableDynInput

isDisableDynInput(): boolean

是否禁用动态输入框

Returns

boolean

Inherited from

MxCADUiPrBase.isDisableDynInput


isDisableDynamicTrace

isDisableDynamicTrace(): boolean

是否禁用动态跟踪

Returns

boolean

Inherited from

MxCADUiPrBase.isDisableDynamicTrace


isDisableGridTrace

isDisableGridTrace(): boolean

是否禁用格网追踪

Returns

boolean

Inherited from

MxCADUiPrBase.isDisableGridTrace


isDisableOrthoTrace

isDisableOrthoTrace(): boolean

是否禁用正射追踪

Returns

boolean

Inherited from

MxCADUiPrBase.isDisableOrthoTrace


isDisableOsnap

isDisableOsnap(): boolean

是否禁用捕捉

Returns

boolean

Inherited from

MxCADUiPrBase.isDisableOsnap


isDisablePolarAxisTrace

isDisablePolarAxisTrace(): boolean

是否禁用极轴跟踪

Returns

boolean

Inherited from

MxCADUiPrBase.isDisablePolarAxisTrace


isKeyWordPicked

isKeyWordPicked(matchKeyWord): boolean

测试某一个关键字是否被用户选择

Example

ts
//以 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

NameTypeDescription
matchKeyWordstring要检测的关键字

Returns

boolean

true为真

Inherited from

MxCADUiPrBase.isKeyWordPicked


isOffsetInputPostion

isOffsetInputPostion(): boolean

是否输入点遍移一个距离

Returns

boolean

Inherited from

MxCADUiPrBase.isOffsetInputPostion


keyWordPicked

keyWordPicked(): string

返回用户选择的关键字

Example

ts
//以 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

MxCADUiPrBase.keyWordPicked


keyWords

keyWords(): string

返回关键字列表

Returns

string

关键词列表

Inherited from

MxCADUiPrBase.keyWords


message

message(): string

提示字符串

Returns

string

提示消息

Inherited from

MxCADUiPrBase.message


setBasePt

setBasePt(basePt): void

设置动态拖动的基点

Parameters

NameTypeDescription
basePtMcGePoint3d基点 THREE.THREE.Vector3

Returns

void

点对象 DWG图纸坐标


setCursorType

setCursorType(type): void

设置光标类型

Parameters

NameTypeDescription
typeMxCursorType鼠标样式类型

Returns

void

Inherited from

MxCADUiPrBase.setCursorType


setDisableDynInput

setDisableDynInput(isDisable): void

设置是否禁用动态输入框

Parameters

NameType
isDisableboolean

Returns

void

Inherited from

MxCADUiPrBase.setDisableDynInput


setDisableDynamicTrace

setDisableDynamicTrace(isDisable): void

设置是否禁用动态跟踪

Parameters

NameTypeDescription
isDisableboolean是否禁用

Returns

void

Inherited from

MxCADUiPrBase.setDisableDynamicTrace


setDisableGridTrace

setDisableGridTrace(isDisable): void

设置是否禁用格网追踪

Parameters

NameTypeDescription
isDisableboolean是否禁用

Returns

void

Inherited from

MxCADUiPrBase.setDisableGridTrace


setDisableOrthoTrace

setDisableOrthoTrace(isDisable): void

设置是否禁用正射追踪

Parameters

NameTypeDescription
isDisableboolean是否禁用

Returns

void

Inherited from

MxCADUiPrBase.setDisableOrthoTrace


setDisableOsnap

setDisableOsnap(isDisable): void

设置是否禁用捕捉

Parameters

NameType
isDisableboolean

Returns

void

Inherited from

MxCADUiPrBase.setDisableOsnap


setDisablePolarAxisTrace

setDisablePolarAxisTrace(isDisable): void

设置是否禁用极轴跟踪

Parameters

NameTypeDescription
isDisableboolean是否禁用

Returns

void

Inherited from

MxCADUiPrBase.setDisablePolarAxisTrace


setDynamicInputType

setDynamicInputType(type): void

设置动态输入类型

Parameters

NameTypeDescription
typeDynamicInputType动态输入显示类型

Returns

void

Inherited from

MxCADUiPrBase.setDynamicInputType


setInputToucheType

setInputToucheType(toucheType): void

设置需要的Touche输入类型,默认值是 MxType.InputToucheType.kGetBegan

Parameters

NameType
toucheTypenumber

Returns

void

Inherited from

MxCADUiPrBase.setInputToucheType


setKeyWords

setKeyWords(keyWordList): void

设置关键字列表

Example

ts
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad'
   const getPoint = new MxCADUiPrPoint();
   getPoint.setKeyWords("[选项1(A)/选项2(B)]")

Parameters

NameTypeDescription
keyWordListstring关键词列表

Returns

void

void

Inherited from

MxCADUiPrBase.setKeyWords


setLastInputPoint

setLastInputPoint(pt): void

设置上一次的输入点。

Parameters

NameTypeDescription
ptMcGePoint3d点对象

Returns

void

选择的关键字

Inherited from

MxCADUiPrBase.setLastInputPoint


setMessage

setMessage(message): void

设置提示字符串

Example

ts
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad'
   const getPoint = new MxCADUiPrPoint();
   getPoint.setMessage("\n提示消息")

Parameters

NameTypeDescription
messagestring提示消息

Returns

void

提示消息

Inherited from

MxCADUiPrBase.setMessage


setOffsetInputPostion

setOffsetInputPostion(isOffset): void

设置输入点遍移一个距离

Parameters

NameType
isOffsetboolean

Returns

void

Inherited from

MxCADUiPrBase.setOffsetInputPostion


setUseBasePt

setUseBasePt(useIt): void

设置动态拖动的基点用于动态绘制。

Parameters

NameTypeDescription
useItboolean是否设置,setBasePt会自设置true.

Returns

void

void


setUserDraw

setUserDraw(pDraw): void

设置交互过程的动态绘制调用对象

Example

ts
//以 MxCADUiPrPoint 类示例
import { MxCADUiPrPoint } from 'mxcad';

  const getPoint = new MxCADUiPrPoint();
  getPoint.setUserDraw((pt,pw)=>{
    console.log(pt, pw)
  })
  const pt = await getPoint.go();

Parameters

NameTypeDescription
pDraw(currentPoint: McGePoint3d, pWorldDraw: McEdGetPointWorldDrawObject) => voidMcEdGetPointWorldDrawObject | 动态绘制调用对象

Returns

void

void

Inherited from

MxCADUiPrBase.setUserDraw


setUserInputControls

setUserInputControls(contros): void

设置输入控制设置,UserInputControls

Parameters

NameType
controsnumber

Returns

void

Inherited from

MxCADUiPrBase.setUserInputControls


userInputControls

userInputControls(): number

返回输入控制设置,UserInputControls

Returns

number

Inherited from

MxCADUiPrBase.userInputControls


value

value(): McGePoint3d

得以获取的点

Returns

McGePoint3d

点坐标