0.2.40 • Published 4 months ago

@xtctwins/tctwins-bimx-engine v0.2.40

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

@xtctwins/tctwins-bimx-engine

xtc 三维文件查看器

安装相关依赖

UI element-plus

https://www.npmjs.com/package/element-plus

npm i element-plus

事件总线 mitt

https://www.npmjs.com/package/mitt

npm i mitt

状态管理 pinia

https://www.npmjs.com/package/pinia

npm i pinia

文件获取 ali-oss

https://www.npmjs.com/package/ali-oss

npm i ali-oss

安装依赖

// 安装依赖
npm i @xtctwins/tctwins-bimx-engine
// 引入样式
import "@xtctwins/tctwins-bimx-engine/dist/style.css";

Example

<template>
	<!-- 一个模型 -->
	<!-- :model-buffer 和 :file-path 选一个使用即可-->
	<!-- :model-buffer 是直接传入模型buffer数据-->
	<!-- :file-path 是传入文件下载路径-->
	<BIMXViewer
		v-if="initialzed"
		:load-meta="true"
		:file-path="filePath"
		:nav-cube-size="120"
		:background-color="'#d0d0d0'"
		@emit-handler="EmitHandler" />

	<!-- 集成模型 -->
	<!-- 请使用-->
	<!--:file-paths="filePaths"-->
	<!--:multi-model="true"-->
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { BIMXViewer } from "@xtctwins/tctwins-bimx-engine";
import type { EventContent } from "@xtctwins/tctwins-bimx-engine";
import "@xtctwins/tctwins-bimx-engine/dist/style.css";

const initialzed = ref(false);
const filePath = ref(`https://bimkk-oss-test.oss-cn-beijing.aliyuncs.com/test/1公寓幕墙.xtc`);
const filePaths = [
	"https://bimkk-oss-test.oss-cn-beijing.aliyuncs.com/tests/models/multiModel/model2/20250205170745913287.xtc",
	"https://bimkk-oss-test.oss-cn-beijing.aliyuncs.com/tests/models/multiModel/model2/20250205170736552499.xtc",
	"https://bimkk-oss-test.oss-cn-beijing.aliyuncs.com/tests/models/multiModel/model2/20250205170731500203.xtc"
];
const modelBuffer = ref<ArrayBuffer>();

onMounted(() => {
	//如果选择直接传入模型modelBuffer,请在获取到buffer后再初始化BIMXViewer
	// getModel(() => {
	// 	initialzed.value = true;
	// });

	//如果使用filePath或者filePaths则直接初始化BIMXViewer即可
	initialzed.value = true;
});

//监听引擎传出的事件
const EmitHandler = (content: EventContent) => {
	console.log(content);
};

//xtc模型数据
const getModel = (callback: () => void) => {
	// 自行填写获取模型文件的内容
	// ...
	// modelBuffer.value = ...
	callback();
};
</script>

<style>
#app {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	width: 100%;
	height: 100%;
}
</style>

其他参数解释

基础设置

是否载入构件属性信息(xts文件), 如果要载入,在模型xtc文件相同路径下必须有同名xts文件

:load-meta="true"

是否显示导航盒

:showNavCube="true"

导航盒尺寸

:nav-cube-size="120"

背景颜色

:background-color="#d0d0d0"

功能

添加需要的即可

inspector

inspector - 构建属性面板开启 (需要开启loadMeta)

reseta

reseta - 重置模型视角

事件

//监听引擎传出的事件
const EmitHandler = (content: EventContent) => {
	console.log(content);
};
//事件内容
type EventContent = {
	isTool: boolean;
	event_target: ComponentName | "BimXViewer" | "ToolBar";
	event_name: string;
	content: {};
};

事件内容包括:

"pickedEntity" - 点击构件
"pickedNothing" - 点击空白处
...
0.2.40

4 months ago

0.2.39

4 months ago

0.2.38

4 months ago

0.2.37

4 months ago

0.2.36

4 months ago

0.2.35

4 months ago

0.2.34

4 months ago

0.2.30

4 months ago

0.2.33

4 months ago

0.2.32

4 months ago

0.2.31

4 months ago

0.2.29

4 months ago

0.2.28

5 months ago

0.2.27

6 months ago

0.2.26

6 months ago

0.2.25

6 months ago

0.2.24

6 months ago

0.2.23

6 months ago

0.2.22

6 months ago

0.2.21

6 months ago

0.2.20

6 months ago

0.2.19

6 months ago

0.2.18

6 months ago

0.2.17

6 months ago

0.2.16

6 months ago

0.2.15

6 months ago

0.2.14

6 months ago

0.2.13

6 months ago

0.2.12

6 months ago

0.2.11

7 months ago

0.2.10

7 months ago

0.2.1

7 months ago

0.2.7

7 months ago

0.2.6

7 months ago

0.2.9

7 months ago

0.2.8

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.5

7 months ago

0.2.4

7 months ago

0.1.90

7 months ago

0.1.91

7 months ago

0.1.89

7 months ago

0.2.0

7 months ago

0.1.88

8 months ago

0.1.85

8 months ago

0.1.86

8 months ago

0.1.87

8 months ago

0.1.80

8 months ago

0.1.81

8 months ago

0.1.82

8 months ago

0.1.83

8 months ago

0.1.84

8 months ago

0.1.78

8 months ago

0.1.79

8 months ago

0.1.74

8 months ago

0.1.75

8 months ago

0.1.76

8 months ago

0.1.77

8 months ago

0.1.70

8 months ago

0.1.71

8 months ago

0.1.72

8 months ago

0.1.73

8 months ago

0.1.64

8 months ago

0.1.65

8 months ago

0.1.66

8 months ago

0.1.67

8 months ago

0.1.68

8 months ago

0.1.69

8 months ago

0.1.63

9 months ago

0.1.61

9 months ago

0.1.62

9 months ago

0.1.60

9 months ago

0.1.59

9 months ago

0.1.58

9 months ago

0.1.52

10 months ago

0.1.53

10 months ago

0.1.54

9 months ago

0.1.55

9 months ago

0.1.56

9 months ago

0.1.57

9 months ago

0.1.50

10 months ago

0.1.51

10 months ago

0.1.49

10 months ago

0.1.44

10 months ago

0.1.45

10 months ago

0.1.46

10 months ago

0.1.47

10 months ago

0.1.48

10 months ago

0.1.30

11 months ago

0.1.31

11 months ago

0.1.32

10 months ago

0.1.33

10 months ago

0.1.34

10 months ago

0.1.35

10 months ago

0.1.36

10 months ago

0.1.37

10 months ago

0.1.29

11 months ago

0.1.41

10 months ago

0.1.42

10 months ago

0.1.43

10 months ago

0.1.40

10 months ago

0.1.38

10 months ago

0.1.39

10 months ago

0.1.27

11 months ago

0.1.28

11 months ago

0.1.26

11 months ago

0.1.22

11 months ago

0.1.23

11 months ago

0.1.24

11 months ago

0.1.25

11 months ago

0.1.21

11 months ago

0.1.20

11 months ago

0.1.18

11 months ago

0.1.19

11 months ago

0.1.12

11 months ago

0.1.13

11 months ago

0.1.14

11 months ago

0.1.15

11 months ago

0.1.16

11 months ago

0.1.17

11 months ago

0.1.11

11 months ago

0.1.10

12 months ago

0.1.9

12 months ago

0.1.8

12 months ago

0.1.7

12 months ago

0.1.6

12 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago