模型操作
# 1.设置模型透明
设置模型的整体透明度。
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.setWholeTransparency",
data: { opacity: 0.5 },
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.setWholeTransparency({ opacity: 0.5 });
参数说明:
opacity:0 - 1之间数字 0 全不透明, 1 全透明
# 2.恢复模型透明
恢复模型原来的透明度。
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.clearTransparencyAll",
data: null,
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.clearTransparencyAll();
# 3.设置模型颜色
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.setModelColor",
data: { r: 0, g: 0, b: 255 },
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.setModelColor({ r: 0, g: 0, b: 255 });
参数说明:
r,g,b: 取值范围 0~255
# 4.恢复模型颜色
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.resetModelColor",
data: null,
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.resetModelColor();
# 5.X轴面剖切
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.ClipXAxis",
data: {
pointx: 2.13,
pointy: 3.19,
pointz: 4.34,
clearExistingPlanes: true,
},
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.ClipXAxis({
pointx: 2.13,
pointy: 3.19,
pointz: 4.34,
clearExistingPlanes: true,
});
参数说明:
pointx: 模型坐标x
pointy: 模型坐标y
pointz: 模型坐标z
clearExistingPlanes: boolean 是否清除现有基准面
# 6.Y轴面剖切
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.ClipYAxis",
data: {
pointx: 2.13,
pointy: 3.19,
pointz: 4.34,
clearExistingPlanes: true,
},
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.ClipYAxis({
pointx: 2.13,
pointy: 3.19,
pointz: 4.34,
clearExistingPlanes: true,
});
参数说明:
pointx: 模型坐标x
pointy: 模型坐标y
pointz: 模型坐标z
clearExistingPlanes: boolean 是否清除现有基准面
# 7.Z轴面剖切
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.ClipZAxis",
data: {
pointx: 2.13,
pointy: 3.19,
pointz: 4.34,
clearExistingPlanes: true,
},
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.ClipZAxis({
pointx: 2.13,
pointy: 3.19,
pointz: 4.34,
clearExistingPlanes: true,
});
参数说明:
pointx: 模型坐标x
pointy: 模型坐标y
pointz: 模型坐标z
clearExistingPlanes: boolean 是否清除现有基准面
# 8.删除剖切
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.clearClip",
data: null,
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.clearClip();
# 9.开启包围盒
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.ProjectLocationShow",
data: null,
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.ProjectLocationShow();
# 10.关闭包围盒
iframe:
postKsjMessage(
{
commandName: "KSJModelControlApi.ProjectLocationHide",
data: null,
},
(result) => {
console.log(result);
}
);
sdk:
import { KSJModelControlApi } from "bjksj-sdk";
KSJModelControlApi.ProjectLocationHide();