[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/MxCADUiPrPoint
Class: MxCADUiPrPoint
2d.MxCADUiPrPoint
UI interaction point selection (mouse click on canvas)
Example
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
GetPoint.setMessage ("Please set the first point")
const point = await getPoint.go()
console.log(point)
Hierarchy
↳
MxCADUiPrPoint
Table of contents
Constructors
Methods
- abort
- basePt
- clearLastInputPoint
- disableAllTrace
- drawReserve
- getCursorType
- getDetailedResult
- getDocValue
- getDynamicInputType
- getInputToucheType
- getStatus
- go
- isDisableDynInput
- isDisableDynamicTrace
- isDisableGridTrace
- isDisableOrthoTrace
- isDisableOsnap
- isDisablePolarAxisTrace
- isKeyWordPicked
- isOffsetInputPostion
- keyWordPicked
- keyWords
- message
- setBasePt
- setCursorType
- setDisableDynInput
- setDisableDynamicTrace
- setDisableGridTrace
- setDisableOrthoTrace
- setDisableOsnap
- setDisablePolarAxisTrace
- setDynamicInputType
- setInputToucheType
- setKeyWords
- setLastInputPoint
- setMessage
- setOffsetInputPostion
- setUseBasePt
- setUserDraw
- setUserInputControls
- userInputControls
- value
Constructors
constructor
• new MxCADUiPrPoint()
Constructor function
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
Overrides
Methods
abort
▸ abort(cause?
): void
Stop the current dynamic drag
Parameters
Name | Type | Default value |
---|---|---|
cause | DetailedResult | DetailedResult.kCodeAbort |
Returns
void
void
Inherited from
basePt
▸ basePt(): McGePoint3d
Obtain the base point for dynamic dragging
Returns
McGePoint3d
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
getPoint.setBasePt(new McGePoint3d(0,0,0));
await getPoint.go();
console.log(getPoint.basePt())//(0,0,0)
clearLastInputPoint
▸ clearLastInputPoint(): void
Clear the previous input point data.
Returns
void
Example
//Taking the MxCADUiPrPoint class as an example, the same applies to other classes in the MxCADUiPr * series
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.clearLastInputPoint();
Inherited from
MxCADUiPrBase.clearLastInputPoint
disableAllTrace
▸ disableAllTrace(isDisable?
): void
Disable all tracking
Parameters
Name | Type | Default value | Description |
---|---|---|---|
IsDisable | boolean | true | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.disableAllTrace(true);
Inherited from
drawReserve
▸ drawReserve(callAddEntity?
): void
Keep the dynamically drawn objects on the graph.
Parameters
Name | Type | Description |
---|---|---|
callAddEntity? | (ent : Objecti3D )=>void | callback parameter ent type: THREE.THREE.Object3D |
Returns
void
Example
//Example of MxCADUiPrPoint class
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()
Inherited from
getCursorType
▸ getCursorType(): MxCursorType
Return cursor type
Returns
MxCursorType
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.getCursorType())
Inherited from
getDetailedResult
▸ getDetailedResult(): DetailedResult
Return detailed reasons for interactive operation exit
Returns
DetailedResult
The return value type of the current interactive operation
Example
//Example of MxCADUiPrList class
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 ('prompt input', val)
}
Inherited from
MxCADUiPrBase.getDetailedResult
getDocValue
▸ getDocValue(): McGePoint3d
Obtain document coordinates
Returns
Point Object MdGePoint3d
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
await getPoint.go();
const pt = getPoint.getDocValue();
console.log(pt)
getDynamicInputType
▸ getDynamicInputType(): DynamicInputType
Return dynamic input type
Returns
DynamicInputType
Dynamic input display type
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.getDynamicInputType())
Inherited from
MxCADUiPrBase.getDynamicInputType
getInputToucheType
▸ getInputToucheType(): number
Return the required Touche input type
Returns
number
Touche input type
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
const toucheType = getPoint.getInputToucheType();
console.log(toucheType)
Inherited from
MxCADUiPrBase.getInputToucheType
getStatus
▸ getStatus(): MrxDbgUiPrBaseReturn
Get operation status
Returns
MrxDbgUiPrBaseReturn
Operation status value
Example
//Example of MxCADUiPrList class
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) {
//Empty input
}
Inherited from
go
▸ go(): Promise
<null
| McGePoint3d
>
Run the go method to return the Promise task for user interaction
Returns
Promise
<null
| McGePoint3d
>
Return a promise object containing the coordinate points obtained by the user clicking on the page
Description
When the mouse clicks on the canvas, the Promise is completed and the coordinates of the clicked point are obtained Other interaction methods will return null, such as pressing the Esc cancel key or entering the corresponding keyword in the interaction
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
const pt = await getPoint.go();
console.log(pt)
isDisableDynInput
▸ isDisableDynInput(): boolean
Do you want to disable dynamic input boxes
Returns
boolean
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableDynInput())
Inherited from
MxCADUiPrBase.isDisableDynInput
isDisableDynamicTrace
▸ isDisableDynamicTrace(): boolean
Do you want to disable dynamic tracking
Returns
boolean
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableDynamicTrace())
Inherited from
MxCADUiPrBase.isDisableDynamicTrace
isDisableGridTrace
▸ isDisableGridTrace(): boolean
Do you want to disable grid tracking
Returns
boolean
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableGridTrace())
Inherited from
MxCADUiPrBase.isDisableGridTrace
isDisableOrthoTrace
▸ isDisableOrthoTrace(): boolean
Do you want to disable ortho tracing
Returns
boolean
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableOrthoTrace())
Inherited from
MxCADUiPrBase.isDisableOrthoTrace
isDisableOsnap
▸ isDisableOsnap(): boolean
Do you want to disable capture
Returns
boolean
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisableOsnap())
Inherited from
isDisablePolarAxisTrace
▸ isDisablePolarAxisTrace(): boolean
Do you want to disable polar tracking
Returns
boolean
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
console.log(getPoint.isDisablePolarAxisTrace())
Inherited from
MxCADUiPrBase.isDisablePolarAxisTrace
isKeyWordPicked
▸ isKeyWordPicked(matchKeyWord
): boolean
Test whether a certain keyword is selected by the user
Parameters
Name | Type | Description |
---|---|---|
MatchKeyWord | string | Keywords to be detected |
Returns
boolean
True is true
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
GetPoint. setKeyWords ("[Option 1 (A)/Option 2 (B)]");
const pt = await getPoint.go();
if(getPoint.isKeyWordPicked('A')){
Console.log (Option 1)
}else if(getPoint.isKeyWordPicked('B')){
Console.log (Option 2)
}
Inherited from
isOffsetInputPostion
▸ isOffsetInputPostion(): boolean
Do you want to input a point to move a distance
Returns
boolean
Inherited from
MxCADUiPrBase.isOffsetInputPostion
keyWordPicked
▸ keyWordPicked(): string
Return the keywords selected by the user
Returns
string
Selected keywords
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
GetPoint. setKeyWords ("[Option 1 (A)/Option 2 (B)]");
const pt = await getPoint.go();
const key = getPoint.keyWordPicked();
console.log(key)
Inherited from
keyWords
▸ keyWords(): string
Return keyword list
Returns
string
Keyword List
Example
//Taking the MxCADUiPrPoint class as an example, the same applies to other classes in the MxCADUiPr * series
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
GetPoint. setKeyWords ("[Option 1 (A)/Option 2 (B)]");
const keyList = getPoint.keyWords();
Console.log ("Keyword List", keyList)//Keyword List [Option 1 (A)/Option 2 (B)]
Inherited from
message
▸ message(): string
Prompt string
Returns
string
Reminder message
Example
//Taking the MxCADUiPrPoint class as an example, the same applies to other classes in the MxCADUiPr * series
import { MxCADUiPrPoint , McGePoint3d} from 'mxcad'
const getPoint = new MxCADUiPrPoint();
GetPoint.setMessage ("Test Message");
console.log(getPoint.message());// Test information
Inherited from
setBasePt
▸ setBasePt(basePt
): void
Set the base point for dynamic dragging
Parameters
Name | Type | Description |
---|---|---|
BasePt | [McGePoint3d] (2d. McGePoint3d. md) | Base point McGePoint3d |
Returns
void
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
getPoint.setBasePt(new McGePoint3d(0,0,0));
setCursorType
▸ setCursorType(type
): void
Set cursor type
Parameters
Name | Type | Description |
---|---|---|
Type | MxCursorType | Mouse Style Type |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
import { MxCursorType } from "mxdraw";
const getPoint = new MxCADUiPrPoint()
GetPoint.setMessage ("Specify text starting point: ")
getPoint.setCursorType(MxCursorType.kCross);
const pt = await getPoint.go();
Inherited from
setDisableDynInput
▸ setDisableDynInput(isDisable
): void
Set whether to disable dynamic input boxes
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableDynInput(true);
Inherited from
MxCADUiPrBase.setDisableDynInput
setDisableDynamicTrace
▸ setDisableDynamicTrace(isDisable
): void
Set whether to disable dynamic tracking
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableDynamicTrace(true);
Inherited from
MxCADUiPrBase.setDisableDynamicTrace
setDisableGridTrace
▸ setDisableGridTrace(isDisable
): void
Set whether to disable grid tracking
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableGridTrace(true);
Inherited from
MxCADUiPrBase.setDisableGridTrace
setDisableOrthoTrace
▸ setDisableOrthoTrace(isDisable
): void
Set whether to disable orthotracing
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableOrthoTrace(true);
Inherited from
MxCADUiPrBase.setDisableOrthoTrace
setDisableOsnap
▸ setDisableOsnap(isDisable
): void
Set whether to disable capture
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisableOsnap(true);
Inherited from
setDisablePolarAxisTrace
▸ setDisablePolarAxisTrace(isDisable
): void
Set whether to disable polar tracking
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Is it disabled |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint()
getPoint.setDisablePolarAxisTrace(true);
Inherited from
MxCADUiPrBase.setDisablePolarAxisTrace
setDynamicInputType
▸ setDynamicInputType(type
): void
Set dynamic input type
Parameters
Name | Type | Description |
---|---|---|
Type | DynamicInputType | Dynamic Input Display Type |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
import { DynamicInputType } from "mxdraw";
const getPoint = new MxCADUiPrPoint()
getPoint.setDynamicInputType(DynamicInputType.kXYCoordInput);
Inherited from
MxCADUiPrBase.setDynamicInputType
setInputToucheType
▸ setInputToucheType(toucheType
): void
Set the required Touche input type, default value is MxType InputToucheType.kGetBegan
Parameters
Name | Type | Description |
---|---|---|
ToucheType | Number | ToucheType Type |
Returns
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
getPoint.setInputToucheType(MxType.InputToucheType.kGetEnd);
Inherited from
MxCADUiPrBase.setInputToucheType
setKeyWords
▸ setKeyWords(keyWordList
): void
Set keyword list
Parameters
Name | Type | Description |
---|---|---|
KeyWordList | string | Keyword List |
Returns
void
void
Example
//Taking the MxCADUiPrPoint class as an example, the same applies to other classes in the MxCADUiPr * series
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
GetPoint. setKeyWords ("[Option 1 (A)/Option 2 (B)]")
Inherited from
setLastInputPoint
▸ setLastInputPoint(pt
): void
Set the previous input point.
Parameters
Name | Type | Description |
---|---|---|
Pt | McGePoint3d (2d. McGePoint3d. md) | Point Object |
Returns
void
Example
//Taking the MxCADUiPrPoint class as an example, the same applies to other classes in the MxCADUiPr * series
import { MxCADUiPrPoint , McGePoint3d} from 'mxcad'
const getPoint = new MxCADUiPrPoint();
getPoint.setLastInputPoint(new McGePoint3d(0,0,0));
Inherited from
MxCADUiPrBase.setLastInputPoint
setMessage
▸ setMessage(message
): void
Set prompt string
Parameters
Name | Type | Description |
---|---|---|
message | string | prompt message |
Returns
void
Reminder message
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad'
const getPoint = new MxCADUiPrPoint();
GetPoint.setMessage ("prompt message")
Inherited from
setOffsetInputPostion
▸ setOffsetInputPostion(isOffset
): void
Set the input point to move a distance
Parameters
Name | Type |
---|---|
isOffset | boolean |
Returns
void
Inherited from
MxCADUiPrBase.setOffsetInputPostion
setUseBasePt
▸ setUseBasePt(useIt
): void
Set the base point for dynamic dragging for dynamic drawing.
Parameters
Name | Type | Description |
---|---|---|
UseIt | boolean | Whether to set, setBasePt will automatically set true |
Returns
void
void
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
getPoint.setUseBasePt(true);
setUserDraw
▸ setUserDraw(pDraw
): void
Set the dynamic drawing calling object for the interaction process
Parameters
Name | Type | Description |
---|---|---|
PDraw | (CurrentPoint: [McGePoint3d] (2d. McGePoint3d. md), pWorldDraw: McEdGetPointWorldDrawObject)=>void | McEdGetPointWorldDrawObject \ |
Returns
void
void
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
const getPoint = new MxCADUiPrPoint();
getPoint.setUserDraw((pt,pw)=>{
console.log(pt, pw)
})
const pt = await getPoint.go();
Inherited from
setUserInputControls
▸ setUserInputControls(contros
): void
Set input control settings
Parameters
Name | Type |
---|---|
contros | number |
Returns
void
Example
//Example of MxCADUiPrInt class
import { MxCADUiPrInt } from 'mxcad';
import { UserInputControls } from "mxdraw"
let getInt = new MxCADUiPrInt();
GetInt.setMessage ("Enter integer: ");
getInt.setUserInputControls(UserInputControls.kNoZeroResponseAccepted);
let iRowNum = await getInt.go();
if (iRowNum == null) return;
Inherited from
MxCADUiPrBase.setUserInputControls
userInputControls
▸ userInputControls(): number
Return to input control settings
Returns
number
Example
//Example of MxCADUiPrInt class
import { MxCADUiPrInt } from 'mxcad';
let getInt = new MxCADUiPrInt();
console.log(getInt.userInputControls())
Inherited from
MxCADUiPrBase.userInputControls
value
▸ value(): McGePoint3d
Points that can be obtained
Returns
Point coordinates
Example
import { MxCADUiPrPoint } from "mxcad"
const getPoint = new MxCADUiPrPoint();
await getPoint.go();
const pt = getPoint.value();
console.log(pt)