Skip to content
On this page

mxcad_2d API 文档 / 2d / McGeBound

Class: McGeBound

2d.McGeBound

范围对象

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new McGeBound(pts?)

构造函数。

Example

ts
import { McGeBound, McGePoint3d } from "mxcad"

  const points = [new McGePoint3d(1, 2, 3), new McGePoint3d(4, 5, 6)];
  const bound = new McGeBound(points);

Parameters

NameTypeDescription
pts?McGePoint3dArray | McGePoint3d[]三维点数组

Properties

isValid

isValid: boolean

是否有效

Example

ts
import { McGeBound } from "mxcad"

 // 创建 McGeBound 实例
 const bound = new McGeBound();
 // 访问是否有效属性并设置其值
 bound.isValid = true;;

maxPoint

maxPoint: McGePoint3d

最大点

Example

ts
import { McGeBound, McGePoint3d } from "mxcad"

 // 创建 McGeBound 实例
 const bound = new McGeBound();
 // 访问最大点属性并设置其值
 bound.maxPoint = new McGePoint3d(20, 10, 0);

minPoint

minPoint: McGePoint3d

最小点

Example

ts
import { McGeBound, McGePoint3d } from "mxcad"

 // 创建 McGeBound 实例
 const bound = new McGeBound();
 // 访问最小点属性并设置其值
 bound.minPoint = new McGePoint3d(0, 0, 0);

Methods

addPoint

addPoint(pt): void

添加一个点

Example

ts
import { McGeBound, McGePoint3d } from "mxcad"
// 创建 McGeBound 实例
  const bound = new McGeBound();
  // 添加一个点到边界
  const point = new McGePoint3d(3, 4, 5);
  bound.addPoint(point);

Parameters

NameTypeDescription
ptMcGePoint3d三维点对象

Returns

void


addPoints

addPoints(pts): void

添加一组点

Example

ts
import { McGeBound } from "mxcad"

  // 创建 McGeBound 实例
  const bound = new McGeBound();

  // 创建一组点
  const points = [new McGePoint3d(1, 2, 3), new McGePoint3d(4, 5, 6), new McGePoint3d(7, 8, 9)];

  // 添加一组点到边界
  bound.addPoints(points);

Parameters

NameTypeDescription
ptsMcGePoint3dArray | McGePoint3d[]三维点对象数组

Returns

void