[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/MxCADUiPrPointTransform
Class: MxCADUiPrPointTransform
2d.MxCADUiPrPointTransform
MxCADUiPrPointTransform is an interactive point taking class that adds coordinate system transformation capabilities to MxCADUiPrPoint.
Description
This class is suitable for interactive point taking in specific coordinate systems, such as local coordinate systems, working coordinate systems, or custom view coordinate systems. It can automatically apply matrix transformation when users select points, facilitating interactive input in the transformed space. Usage:
- New MxCADUiPrPointTransform (mat) creates a point picker with coordinate transformation;
- Pass in McGeMatrix3d for mapping;
- Call go() to obtain the user's click point;
- The retrieved points will be transformed into the target coordinate system according to the matrix convention.
Example
import { MxCpp, McGePoint3d, MxCADUiPrPointTransform, McGeMatrix3d, McGeVector3d, McDbPolyline } from "mxcad";
async function Mx_Test_Rect() {
const mxcad = MxCpp.getCurrentMxCAD();
let mat = new McGeMatrix3d;
mat.setToRotation(-mxcad.mxdraw.getViewAngle(), McGeVector3d.kZAxis, McGePoint3d.kOrigin);
const getPoint = new MxCADUiPrPointTransform(mat);
getPoint.clearLastInputPoint();
getPoint.setDisableDynInput(true);
GetPoint.setMessage ("Please select the first point");
const pt1 = await getPoint.go();
if (!pt1) return;
const getNextPt = new MxCADUiPrPointTransform(mat);
GetNextPt.setMessage ("Please select the second point");
getNextPt.setUserDraw((pt2, pWorldDraw) => {
let pl = new McDbPolyline();
pl.addVertexAt(pt1);
pl.addVertexAt(new McGePoint3d(pt1.x, pt2.y, pt1.z));
pl.addVertexAt(pt2);
pl.addVertexAt(new McGePoint3d(pt2.x, pt1.y, pt1.z));
pl.isClosed = true;
pWorldDraw.drawMcDbEntity(pl);
});
if (!await getNextPt.go()) return;
getNextPt.drawReserve();
}Hierarchy
↳
MxCADUiPrPointTransform
Table of contents
Constructors
Properties
Methods
- abort
- basePt
- clearLastInputPoint
- disableAllTrace
- drawReserve
- getCursorType
- getDetailedResult
- getDocValue
- getDynamicInputType
- getInputToucheType
- getLastInputPoint
- getResultPointOsnapMode
- getResultPointType
- 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
- setOsModeExParam
- setUseBasePt
- setUserDraw
- setUserInputControls
- userInputControls
- value
Constructors
constructor
• new MxCADUiPrPointTransform(mat)
Parameters
| Name | Type |
|---|---|
mat | McGeMatrix3d |
Overrides
Properties
mat
• mat: McGeMatrix3d = McGeMatrix3d.kIdentity
mat_three
• mat_three: Matrix4
rmat
• rmat: McGeMatrix3d = McGeMatrix3d.kIdentity
rmat_three
• rmat_three: Matrix4
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(retcad_val?): McGePoint3d
Obtain the base point for dynamic dragging
Parameters
| Name | Type | Default value |
|---|---|---|
retcad_val | boolean | false |
Returns
McGePoint3d
Overrides
clearLastInputPoint
▸ clearLastInputPoint(): void
Clear the previous input point data.
Returns
void
Inherited from
MxCADUiPrPoint.clearLastInputPoint
disableAllTrace
▸ disableAllTrace(isDisable?): void
Disable all tracking
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| IsDisable | boolean | true | Is it disabled |
Returns
void
Inherited from
MxCADUiPrPoint.disableAllTrace
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';
async function test(){
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
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";
async function test(){
const getDist = new MxCADUiPrDist();
const val = await getDist.go();
if (!val) return;
if (getDist.getDetailedResult() === DetailedResult.kCoordIn) {
Console.log ('prompt input', val)
}
}Inherited from
MxCADUiPrPoint.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)Inherited from
getDynamicInputType
▸ getDynamicInputType(): DynamicInputType
Return dynamic input type
Returns
DynamicInputType
Dynamic input display type
Inherited from
MxCADUiPrPoint.getDynamicInputType
getInputToucheType
▸ getInputToucheType(): number
Return the required Touche input type
Returns
number
Touche input type
Inherited from
MxCADUiPrPoint.getInputToucheType
getLastInputPoint
▸ getLastInputPoint(): undefined | McGePoint3d
Return to the previous input point.
Returns
undefined | McGePoint3d
Selected keywords
Inherited from
MxCADUiPrPoint.getLastInputPoint
getResultPointOsnapMode
▸ getResultPointOsnapMode(): AcquirePointOsnapMode
Return the capture type of the point obtained from the interactive point taking operation
Returns
AcquirePointOsnapMode
Inherited from
MxCADUiPrPoint.getResultPointOsnapMode
getResultPointType
▸ getResultPointType(): AcquirePointType
Return the point type obtained from the interactive point retrieval operation
Returns
AcquirePointType
Inherited from
MxCADUiPrPoint.getResultPointType
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
Overrides
isDisableDynInput
▸ isDisableDynInput(): boolean
Do you want to disable dynamic input boxes
Returns
boolean
Inherited from
MxCADUiPrPoint.isDisableDynInput
isDisableDynamicTrace
▸ isDisableDynamicTrace(): boolean
Do you want to disable dynamic tracking
Returns
boolean
Inherited from
MxCADUiPrPoint.isDisableDynamicTrace
isDisableGridTrace
▸ isDisableGridTrace(): boolean
Do you want to disable grid tracking
Returns
boolean
Inherited from
MxCADUiPrPoint.isDisableGridTrace
isDisableOrthoTrace
▸ isDisableOrthoTrace(): boolean
Do you want to disable ortho tracing
Returns
boolean
Inherited from
MxCADUiPrPoint.isDisableOrthoTrace
isDisableOsnap
▸ isDisableOsnap(): boolean
Do you want to disable capture
Returns
boolean
Inherited from
isDisablePolarAxisTrace
▸ isDisablePolarAxisTrace(): boolean
Do you want to disable polar tracking
Returns
boolean
Inherited from
MxCADUiPrPoint.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';
async function test(){
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
MxCADUiPrPoint.isKeyWordPicked
isOffsetInputPostion
▸ isOffsetInputPostion(): boolean
Whether the input point is offset for display/processing
Returns
boolean
Inherited from
MxCADUiPrPoint.isOffsetInputPostion
keyWordPicked
▸ keyWordPicked(): string
Return the keywords selected by the user
Returns
string
Selected keywords
Example
//Example of MxCADUiPrPoint class
import { MxCADUiPrPoint } from 'mxcad';
async function test(){
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
Inherited from
setBasePt
▸ setBasePt(basePt, cad_val?): void
Set the base point for dynamic dragging
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| BasePt | [McGePoint3d] (2d. McGePoint3d. md) | undefined | Base point McGePoint3d |
cad_val | boolean | false | - |
Returns
void
Overrides
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";
async function test(){
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
Inherited from
MxCADUiPrPoint.setDisableDynInput
setDisableDynamicTrace
▸ setDisableDynamicTrace(isDisable): void
Set whether to disable dynamic tracking
Parameters
| Name | Type | Description |
|---|---|---|
| IsDisable | boolean | Is it disabled |
Returns
void
Inherited from
MxCADUiPrPoint.setDisableDynamicTrace
setDisableGridTrace
▸ setDisableGridTrace(isDisable): void
Set whether to disable grid tracking
Parameters
| Name | Type | Description |
|---|---|---|
| IsDisable | boolean | Is it disabled |
Returns
void
Inherited from
MxCADUiPrPoint.setDisableGridTrace
setDisableOrthoTrace
▸ setDisableOrthoTrace(isDisable): void
Set whether to disable orthotracing
Parameters
| Name | Type | Description |
|---|---|---|
| IsDisable | boolean | Is it disabled |
Returns
void
Inherited from
MxCADUiPrPoint.setDisableOrthoTrace
setDisableOsnap
▸ setDisableOsnap(isDisable): void
Set whether to disable capture
Parameters
| Name | Type | Description |
|---|---|---|
| IsDisable | boolean | Is it disabled |
Returns
void
Inherited from
MxCADUiPrPoint.setDisableOsnap
setDisablePolarAxisTrace
▸ setDisablePolarAxisTrace(isDisable): void
Set whether to disable polar tracking
Parameters
| Name | Type | Description |
|---|---|---|
| IsDisable | boolean | Is it disabled |
Returns
void
Inherited from
MxCADUiPrPoint.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";
async function Mx_WindowZoom() {
let getPoint = new MxCADUiPrPointTransform(MxInsidePublicFuns.getMxCADViewSpinMatrix(MxCpp.getCurrentMxCAD()));
getPoint.disableAllTrace();
GetPoint.setMessage ("\ n Click to zoom area");
getPoint.setDynamicInputType(DynamicInputType.kDynTip);
let pt1 = await getPoint.go();
if (pt1 == null) return;
let mxcad = MxCpp.getCurrentMxCAD();
getPoint.setUserDraw((p1, worldDraw) => {
worldDraw.drawRect(MxCoordConvert.cad2doc1((pt1 as any)), MxCoordConvert.cad2doc1((p1 as any)));
});
let pt2 = await getPoint.go();
if (pt2 == null) return;
pt1.transformBy(getPoint.rmat);
pt2.transformBy(getPoint.rmat);
mxcad.zoomW(pt1, pt2);
}Inherited from
MxCADUiPrPoint.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, MxCpp } from "mxcad";
import { MxType } from "mxdraw";
//Draw a straight line on the touch screen of a mobile phone
async function Mx_Test_Touch_DrawLine() {
const getPoint = new MxCADUiPrPoint();
getPoint.setOffsetInputPostion(true);
GetPoint.setMessage ("\ nSpecify the first point:");
//Receive kGetBegan and press it with your touch screen finger
getPoint.setInputToucheType(MxType.InputToucheType.kGetEnd);
let pt1 = await getPoint.go();
if (!pt1) return;
GetPoint.setMessage ("\ nSpecify second point:");
getPoint.setBasePt(pt1);
console.log(getPoint.getResultPointOsnapMode());
console.log(getPoint.getResultPointType());
//Receive kGet and release the touch screen finger
getPoint.setInputToucheType(MxType.InputToucheType.kGetEnd);
let pt2 = await getPoint.go();
if (!pt2) return;
let mxcad = MxCpp.getCurrentMxCAD();
let ent = mxcad.drawLine(pt1.x, pt1.y, pt2.x, pt2.y).getMcDbEntity();
if (ent) {
ent.lineweight = 20;
}
}Inherited from
MxCADUiPrPoint.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 | undefined \ | [McGePoint3d] (2d. McGePoint3d. md) |
Returns
void
Inherited from
MxCADUiPrPoint.setLastInputPoint
setMessage
▸ setMessage(message): void
Set prompt string
Parameters
| Name | Type | Description |
|---|---|---|
message | string | prompt message |
Returns
void
Reminder message
Inherited from
setOffsetInputPostion
▸ setOffsetInputPostion(isOffset): void
Set input point traversal, commonly used for point retrieval on mobile devices
Parameters
| Name | Type |
|---|---|
isOffset | boolean |
Returns
void
Example
import { MxCADUiPrPoint } from "mxcad";
import { MxFun } from "mxdraw";
//Draw temporary annotation circles on mobile devices
async function test(){
const getPoint = new MxCADUiPrPoint();
GetPoint.setMessage ("\ nSpecify a point:");
getPoint.setOffsetInputPostion(true);
getPoint.clearLastInputPoint();
let pt1 = (await getPoint.go());
if (!pt1) return;
let mxdraw = MxFun.getCurrentDraw();
mxdraw.getTempMarkDraw().drawCircleMark(pt1.toVector3(), mxdraw.viewCoordLong2Cad(50), 0xFF0000);
mxdraw.updateDisplay();
}Inherited from
MxCADUiPrPoint.setOffsetInputPostion
setOsModeExParam
▸ setOsModeExParam(lVal): void
Set extended capture parameters during capture.
Parameters
| Name | Type | Description |
|---|---|---|
| LVal | OsModeExParam | Extended Object Snap Parameters |
Returns
void
Example
import { MxCADUiPrPoint } from "mxcad";
import { OsModeExParam } from "mxdraw";
async function Mx_Test_Rect2() {
const getPoint = new MxCADUiPrPoint();
getPoint.clearLastInputPoint();
GetPoint.setMessage ("Please select the first point");
const pt1 = await getPoint.go();
if (!pt1) return;
const getNextPt = new MxCADUiPrPoint();
GetNextPt.setMessage ("Please select the second corner");
getNextPt.setOsModeExParam(OsModeExParam.kCircleTangentOsmode);
getNextPt.setUserDraw((pt2, pWorldDraw) => {
let pl = new McDbPolyline();
pl.addVertexAt(pt1);
pl.addVertexAt(new McGePoint3d(pt1.x, pt2.y, pt1.z));
pl.addVertexAt(pt2);
pl.addVertexAt(new McGePoint3d(pt2.x, pt1.y, pt1.z));
pl.isClosed = true;
pWorldDraw.drawMcDbEntity(pl);
});
if (!await getNextPt.go()) return;
getNextPt.drawReserve();
}Inherited from
MxCADUiPrPoint.setOsModeExParam
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
Inherited from
setUserDraw
▸ setUserDraw(pDraw): void
Set dynamic drawing
Parameters
| Name | Type |
|---|---|
pDraw | (currentPoint: McGePoint3d, pWorldDraw: McEdGetPointWorldDrawObject) => void |
Returns
void
Overrides
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
MxCADUiPrPoint.setUserInputControls
userInputControls
▸ userInputControls(): number
Return to input control settings
Returns
number
Inherited from
MxCADUiPrPoint.userInputControls
value
▸ value(retcad_val?): McGePoint3d
Points that can be obtained
Parameters
| Name | Type | Default value |
|---|---|---|
retcad_val | boolean | false |
Returns
Point coordinates
