Skip to content
On this page

mxcad_2d API 文档 / 2d / MxCoordConvertType

Class: MxCoordConvertType

2d.MxCoordConvertType

坐标转换类型

Table of contents

Constructors

Methods

Constructors

constructor

new MxCoordConvertType()

Methods

cad2doc

cad2doc(pt): McGePoint3d

cad坐标转文档坐标

Parameters

NameTypeDescription
ptMcGePoint3d三维点的对象

Returns

McGePoint3d

三维点的对象

Example

ts
import { MxCpp, McGePoint3d } from 'mxcad';
const mxcad = MxCpp.getCurrentCAD();
let pt1DOC = mxcad.cad2doc(new McGePoint3d(20,0,0));
console.log(pt1DOC)

cad2doc1

cad2doc1(pt): Vector3

cad坐标转文档坐标

Parameters

NameTypeDescription
ptMcGePoint3d三维点的对象

Returns

Vector3

THREE.js点对象


cad2doc2

cad2doc2(x, y, z): Vector3

cad坐标转文档坐标

Parameters

NameTypeDescription
xnumberX轴坐标
ynumberY轴坐标
znumberZ轴坐标

Returns

Vector3

THREE.js点对象

Example

ts
import { MxCpp, McGePoint3d } from 'mxcad';
const mxcad = MxCpp.getCurrentCAD();
let pt = mxcad.cad2doc2(20,0,0);
console.log(pt)

doc2cad

doc2cad(pt): McGePoint3d

文档坐标转cad坐标

Parameters

NameTypeDescription
ptMcGePoint3d三维点的对象

Returns

McGePoint3d

三维点的对象

Example

ts
import { MxCpp, McGePoint3d } from 'mxcad';
const mxcad = MxCpp.getCurrentCAD();
let pt1CAD = mxcad.doc2cad1(new McGePoint3d(20,0,0));
console.log(pt1CAD)

doc2cad1

doc2cad1(pt): McGePoint3d

文档坐标转cad坐标

Parameters

NameTypeDescription
ptVector3THREE.js点对象

Returns

McGePoint3d

三维点的对象

Example

ts
import { MxCpp, McGePoint3d } from 'mxcad';
import THREE from "three"

const mxcad = MxCpp.getCurrentCAD();
let pt = mxcad.doc2cad1(new THREE.Vector3(20, 10));
console.log(pt)

doc2cad2

doc2cad2(x, y, z): McGePoint3d

cad坐标转文档坐标

Parameters

NameTypeDescription
xnumberX轴坐标
ynumberY轴坐标
znumberZ轴坐标

Returns

McGePoint3d

三维点的对象

Example

ts
import { MxCpp, McGePoint3d } from 'mxcad';
import THREE from "three"

const mxcad = MxCpp.getCurrentCAD();
let pt = mxcad.doc2cad1(20, 10, 0);
console.log(pt)