Viewer3D

Glodon.Bimface.Viewer. Viewer3D

Glodon.Bimface.Viewer.Viewer3D

Constructor

new Glodon.Bimface.Viewer.Viewer3D(option)

操作三维模型

Parameters:
Name Type Description
option Glodon.Bimface.Viewer.Viewer3DConfig

配置

Methods

activateAllComponents()

恢复所有构件处于激活状态

addBlinkComponentsById(objectIds)

根据构件ID在强调状态集合中继续添加构件

Parameters:
Name Type Description
objectIds Array

多个构件ID的数组

addPlane(min, max, url, callback)

在模型中插入图片

Parameters:
Name Type Description
min Glodon.Web.Geometry.Point3d

插入图片的起始点

max Glodon.Web.Geometry.Point3d

插入图片的结束点

url String

插入图片的路径

callback function

图片插入成功后的回调函数

addSelectedComponentsById(ids)

根据构件ID在选中集合中继续添加构件

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

addSelectedComponentsByObjectData(conditions)

See:

根据筛选条件在选中集合中继续添加构件

Parameters:
Name Type Description
conditions Array

多个筛选条件的数组,如[{familyType: xxx}, {category: xxx}]

addSkyBox(url)

添加外部天空盒

Parameters:
Name Type Description
url String

天空盒图片路径 '{"front": "front.jpg", "back":"back.jpg", "left":"left.jpg", "right":"right.jpg", "top":"top.jpg", "buttom":"bottom.jpg"}'

associateRoomByModelId(roomId, modelId)

根据模型ID将房间与模型相关联

Parameters:
Name Type Description
roomId String

房间ID

modelId String

模型ID

bringAxisGridsToFront(isEnabled)

使得轴网浮在最上层

Parameters:
Name Type Description
isEnabled Boolean

是否将轴网提到最上层

clearAllBlinkComponents()

取消所有构件的强调状态

clearAllRooms()

清除所有房间

clearBlinkComponentsById(objectIds)

根据构件ID从强调状态集合中取消构件的强调状态

Parameters:
Name Type Description
objectIds Array

多个构件ID的数组

clearFloorExplosion()

清空楼层爆炸效果

clearIsolation()

取消构件隔离

clearModelIsolation()

取消所有模型的隔离效果

clearOverrideColorComponents()

恢复全部构件的原来颜色

clearPlane()

清除模型中插入的图片

clearRoomsById(objectIds)

清除指定ID的房间

Parameters:
Name Type Description
objectIds Array

房间的ID集合,如[“x1”, “x2”]

clearRotationCenter()

清除设定的旋转中心

clearSelectedComponents()

清除构件选中状态

createBoundary(outerRing, innerRing)

通过一系列边界点创建房间边界并返回房间边界Boundary对象

Parameters:
Name Type Description
outerRing Array

房间外边界,格式为[[x1,y1,z1], [x2.y2,z2], ...],首尾不可重复

innerRing Array

房间内边界,格式为[[x1,y1,z1], [x2.y2,z2], ...],首尾不可重复

Returns:
Type Description
Object

房间边界Boundary对象

createRoom(boundary, height, id, faceColoropt, frameColoropt)

创建房间

Parameters:
Name Type Attributes Description
boundary Object

房间边界信息,可通过createBoundary()获得

height Number

房间高度

id String

房间ID,可自定义ID

faceColor Glodon.Web.Graphics.Color <optional>

房间颜色

frameColor Glodon.Web.Graphics.Color <optional>

房间线框颜色

createRoomByAxisGrids(fileId, gridIds, elevations, id, faceColor, frameColor)

根据轴网和标高创建房间

Parameters:
Name Type Description
fileId String

文件ID,如果是单文件,可不填;如果是集成模型,则为必填项

gridIds Array

轴线ID,用以获取房间边界

elevations Array

底标高,顶标高,用以获取标高和高度

id String

房间ID,可自定义ID

faceColor Glodon.Web.Graphics.Color

房间颜色,可不填

frameColor Glodon.Web.Graphics.Color

房间线框颜色,可不填

createRoomByOffset(boundary, offset, id, faceColoropt, frameColoropt)

根据高度偏移创建房间

Parameters:
Name Type Attributes Description
boundary Object

房间边界信息,可通过createBoundary()获得

offset Array

以房间标高为准的底部及顶部偏移量,格式为[bottom, top]

id String

房间ID,可自定义ID

faceColor Glodon.Web.Graphics.Color <optional>

房间颜色

frameColor Glodon.Web.Graphics.Color <optional>

房间线框颜色

createSnapshotAsync(backgroundColor, callback)

创建模型快照

Parameters:
Name Type Description
backgroundColor Glodon.Web.Graphics.Color

快照背景颜色

callback function

快照回调函数

deactivateComponentsById(ids)

根据构件ID将构件设置为未激活状态

Parameters:
Name Type Description
ids Array

构件的ID集合,如[“123”, “456”]

deactivateComponentsByObjectData(conditions)

See:

根据筛选条件将构件设置为未激活状态

Parameters:
Name Type Description
conditions Array

筛选条件,从getObjectDataById(objectId)获取

destroy()

销毁模型

enableAxisGridsHover(isEnabled)

是否启用轴网的Hover效果

Parameters:
Name Type Description
isEnabled Boolean

是否启用

enableBlinkComponents(enable)

启用或者禁用构件强调

Parameters:
Name Type Description
enable Boolean

是否启用

enableDamping(enable)

是否开启阻尼效果

Parameters:
Name Type Description
enable boolean

是否开启模型平移、缩放、旋转的阻尼效果

enableFogEffect(isEnabled)

是否开启雾天效果

Parameters:
Name Type Description
isEnabled Boolean

是否开启雪天效果,true为开启,false为关闭

enableFullScreen(isEnabled)

设置是否开启全屏模式

Parameters:
Name Type Description
isEnabled Boolean

是否开启全屏模式

enableGlowEffect(isEnabled)

是否开启发光效果

Parameters:
Name Type Description
isEnabled Boolean

是否开启发光效果,true为开启,false为关闭

enableGlowEffect(isEnabled)

是否开启发光效果

Parameters:
Name Type Description
isEnabled Boolean

是否开启发光效果,true为开启,false为关闭

enableGravity(isEnabled)

是否开启重力漫游

Parameters:
Name Type Description
isEnabled Boolean

开启或关闭重力漫游

enableHitDetection(isEnabled)

是否开启漫游碰撞

Parameters:
Name Type Description
isEnabled Boolean

开启或关闭漫游碰撞

enableHover(isEnabled)

设置鼠标悬停效果

Parameters:
Name Type Description
isEnabled Boolean

开启或关闭鼠标悬停效果

enableMouseMovePick(enable)

设置鼠标滑动拾取坐标

Parameters:
Name Type Description
enable Boolean

开启或关闭鼠标滑动拾取坐标

enableOrbit(isEnabled)

是否允许模型旋转

Parameters:
Name Type Description
isEnabled Boolean

是否允许场景旋转,默认为true

enableScale(isEnabled)

设置是否允许场景缩放

Parameters:
Name Type Description
isEnabled Boolean

是否允许场景缩放,默认为true

enableShortcutKey(isEnabled)

是否开启快捷键

Parameters:
Name Type Description
isEnabled Boolean

是否开启快捷键

enableSnap(enable)

开启/关闭对象捕捉

Parameters:
Name Type Description
enable Boolean

开启或关闭鼠标捕捉效果,必填

enableSnowEffect(isEnabled)

是否开启雪天效果

Parameters:
Name Type Description
isEnabled Boolean

是否开启雪天效果,true为开启,false为关闭

enableSSAOEffect(isEnabled)

是否开启SSAO效果

Parameters:
Name Type Description
isEnabled Boolean

是否开启SSAO效果,true为开启,false为关闭

enableTranslate(isEnabled)

设置是否允许场景平移

Parameters:
Name Type Description
isEnabled Boolean

是否允许场景平移,默认为true

exitWalk()

退出漫游模式

get3DViewStates(callback)

获取模型三维视图的状态,用于切换三维视图

Parameters:
Name Type Description
callback function

获取模型三维视图状态的回调函数

getAllModels()

获取所有模型信息

Returns:
Type Description
Array

各模型信息,包括模型ID和模型名称

getAreaProperty(id, callback)

获取面积属性

Parameters:
Name Type Description
id String

要获取属性的面积ID

callback function

获取属性回调函数

getAreas(callback)

获取空间

Parameters:
Name Type Description
callback function

获取空间回调函数

getAxisGridsIntersection(fileId, floorId, axisNumber)

求多个轴线的交点

Parameters:
Name Type Description
fileId String

文件ID,如果是单文件,可不填;如果是集成模型,则为必填项

floorId String

楼层ID,如果是集成模型,则为单模型文件中的楼层ID(不是集成模型聚合后的楼层ID)

axisNumber Array

相交轴线的轴号数组,例如["9", "A-R", "A-S"]

Returns:
Type Description
Array

相交轴线的轴号及交点信息

getBackgroundColor()

获取背景颜色

Returns:
Type Description
Glodon.Web.Graphics.Color

获取背景颜色

getBlinkComponents()

获取强调状态集合中的构件ID数组

Returns:
Type Description
Array

构件ID数组

getBoundingBoxById(id)

根据构件、外部构件、房间ID获取其包围盒信息

Parameters:
Name Type Description
id String

构件、外部构件或房间ID

Returns:
Type Description
Object

包围盒对象

getCameraAnimation()

获取模型动画状态

Returns:
Type Description
Boolean

开启或者关闭

getCameraStatus()

获取当前相机位置信息,用于保存后恢复相机视点

Returns:
Type Description
Object

相机位置信息

getCategoryVisibility(success, failure)

获取图元类别的可见性

Parameters:
Name Type Description
success function

加载成功之后的回调函数

failure function

加载失败之后的回调函数

getCollisionByCondition()

获取碰撞检测的构件类型

getComponentOverriddenProperty(elementId, success, failure)

获取修改后的构件属性

Parameters:
Name Type Description
elementId String

要获取属性的构件ID

success function

获取属性成功的回调函数

failure function

获取属性失败的回调函数

getComponentProperty(elementId, success, failure)

获取构件属性

Parameters:
Name Type Description
elementId String

要获取属性的构件ID

success function

获取属性成功的回调函数

failure function

获取属性失败的回调函数

getComponentsByClientCoordinates(clientCoordinates)

根据屏幕点获取所有的构件ID列表

Parameters:
Name Type Description
clientCoordinates Object

屏幕坐标点

Returns:
Type Description
Array

构件ID列表

getComponentsByRaycaster(startPoint, direction, condition)

射线检测

Parameters:
Name Type Description
startPoint Object

射线检测起始点,如:{x:50,y:200,z:300}

direction Object

射线方向向量,如:{x:10,y:25,z:5}

condition Array

射线检测筛选条件,从getObjectDataById(objectId)获取

Returns:
Type Description
Array

按照碰撞顺序返回各构件信息:构件ID、射线与构件相交点、射线起点至相交点的距离,相交点处法向量,单位统一为毫米。如:[{”id”:”compontId1”,”position”:{x:600,y:360,z:200},”distance”:299.36,”normal”:{x:0.6,y:0.8,z:0}},{”id”:”compontId2”,”position”:{x:630,y:400,z:210},”distance”:320,”normal”:{x:1,y:0.9,z:0.5}}]

getComponentsBySetId(id, callback)

根据集合ID获取集合中所有构件的ID

Parameters:
Name Type Description
id String

集合ID

callback function

获取集合中所有构件ID数组的回调函数

getComponentStatus(id)

获取构件显示状态 如显示隐藏、半透明、隔离、变色

Parameters:
Name Type Description
id String

构件ID

Returns:
Type Description
Object

构件显示状态

getCurrentAxisGridsState()

获取当前轴网的状态

Returns:
Type Description
Object

当前轴网状态

getCurrentRangeofCamera()

获取相机最大活动范围

Returns:
Type Description
Number

相机最大活动范围参数

getCurrentState()

获取当前模型的浏览状态,用于保存后恢复模型状态

Returns:
Type Description
Object

模型浏览状态

getCustomHomeview()

获取用户Home视图

Returns:
Type Description
Object

用户Home视图

getDefaultHomeview()

获取默认Home视图

Returns:
Type Description
Object

默认Home视图

getDrawingListbyId(fileId, componentId, callback)

根据文件ID和构件ID获取图纸列表

Parameters:
Name Type Description
fileId String

集成模型或单模型的文件ID

componentId String

构件ID

callback function

获取图纸列表成功后的回调函数

getDrawingsheets(callback)

获取模型的图纸列表

Parameters:
Name Type Description
callback function

获取模型的图纸列表的回调函数

getExplosionExtent()

获取爆炸效果离散系数

Returns:
Type Description
Number

爆炸系数,取值范围[0, 3]

getExposureShift()

获取曝光强度

Returns:
Type Description
Number

获取曝光强度

getFamilyTypes(callback)

获取族文件类型

Parameters:
Name Type Description
callback function

回调函数

Returns:
Type Description
Array

针对Rfa文件

getFiles(callback)

获取集成模型的文件列表

Parameters:
Name Type Description
callback function

获取集成模型的文件列表的回调函数

getFloorBoundingBoxById(floorId, callback)

根据楼层ID获取楼层包围盒

Parameters:
Name Type Description
floorId String

楼层ID

callback function

回调函数

getFloorExplosionDirection()

获取楼层爆炸离散方向

Returns:
Type Description
Object

爆炸方向

getFloorExplosionExtent()

获取楼层爆炸离散系数

Returns:
Type Description
Number

爆炸系数,取值范围[0, 30]

getFloorExplosionList()

获取参与楼层爆炸的楼层ID列表

Returns:
Type Description
Array

floorIds 参与楼层爆炸的楼层ID列表

getFloors(callback)

获取单模型、集成模型楼层列表

Parameters:
Name Type Description
callback function

获取楼层回调函数

getFloorsbyFileId(fileId, callback)

在集成模型中根据文件ID获取单模型的楼层信息

Parameters:
Name Type Description
fileId String

参与集成的单文件ID

callback function

回调函数

Returns:
Type Description
Object

楼层列表

getFogEffectOpts()

获取雾天效果

Returns:
Type Description
Object

opt 雾景特效参数

getGridBubblesColor()

获取轴网轴号的颜色

Returns:
Type Description
Glodon.Web.Graphics.Color

颜色

getGridLinesColor()

获取轴网轴线的颜色

Returns:
Type Description
Glodon.Web.Graphics.Color

颜色

getInformation()

获取模型基本信息,如构件数、三角面、定点数

Returns:
Type Description
Object

模型基本信息

getIsolatedComponentColor()

获取隔离构件的颜色

Returns:
Type Description
Glodon.Web.Graphics.Color

颜色

getLightingMode()

获取当前光照模式

Returns:
Type Description
String

光照模式:‘IBL’,基于图像模式;‘Phong’普通模式

getLineSelectRange()

获取模型线拾取范围

Returns:
Type Description
Number

模型线的拾取范围值

getLinkGraph(callback)

获取集成模型的文件链接关系

Parameters:
Name Type Description
callback function

获取集成模型文件链接关系的回调函数

getMapInfo(callback)

获取模型的小地图信息

Parameters:
Name Type Description
callback function

获取模型的小地图信息的回调函数

getMaterialProperty(elementId, callback)

获取材质属性

Parameters:
Name Type Description
elementId String

要获取属性的材质ID

callback function

获取属性回调函数

getMepSystem(fileId, callback)

获取拓扑信息

Parameters:
Name Type Description
fileId function

获取拓扑信息

callback function

获取拓扑信息

getMinimumComponentDistanceById(componentId1, componentId2)

获取两个构件的最小距离

Parameters:
Name Type Description
componentId1 String

构件ID

componentId2 String

构件ID

Returns:
Type Description
Object

计算结果对象,包括两个构件的最小距离与拥有最小距离的两个点

getMinimumFPS()

获取模型渲染帧率

Returns:
Type Description
Number

模型渲染帧率

getModel(modelId)

获取模型对象

Parameters:
Name Type Description
modelId String

模型ID,不传则返回默认模型对象

Returns:
Type Description
Glodon.Bimface.Model.BimModel

指定模型对象

getModelBoundaryPoints(modelId)

获取当前模型的边界点对象

Parameters:
Name Type Description
modelId String

指定模型的ModelID

Returns:
Type Description
Array

描述模型边界点的数组

getModelSet(callback)

获取模型组属性

Parameters:
Name Type Description
callback function

获取属性回调函数

getModelTransformation(modelId)

获取指定模型的坐标变换状态

Parameters:
Name Type Description
modelId String

指定模型的ModelID

Returns:
Type Description
Array

描述模型坐标变换的对象

getModelTree(callback)

获取模型构件目录结构树

Parameters:
Name Type Description
callback function

获取目录树回调函数

getNearestAxisGrids(point3d, fileId, callback)

最近轴网交点的轴线信息及偏移值

Parameters:
Name Type Description
point3d Object

点对象

fileId String

单模型文件ID

callback function

回调函数

Returns:
Type Description
Array

返回最近轴网交点的轴线信息及偏移值

getNestedComponents(callback)

获取嵌套构件信息

Parameters:
Name Type Description
callback function

获取嵌套构件方法的回调函数

getObjectDataById(objectId)

根据构件ID获取ObjectData,用于作为筛选条件

Parameters:
Name Type Description
objectId String

构件ID

Returns:
Type Description
Object

筛选条件ObjectData

getOutlinerInfo(callback)

获取SKP文件模型层次关系

Parameters:
Name Type Description
callback function

回调函数

getProjectInfo(callback)

获取项目参数信息

Parameters:
Name Type Description
callback function

回调函数

getRoomColorById(roomId)

根据房间ID获取房间颜色

Parameters:
Name Type Description
roomId String

房间的ID

Returns:
Type Description
Glodon.Web.Graphics.Color

房间的颜色

getRoomFrameColorById(roomId)

根据房间ID获取房间线框颜色

Parameters:
Name Type Description
roomId String

房间的ID

Returns:
Type Description
Glodon.Web.Graphics.Color

房间的线框颜色

getRoomProperty(roomId, callback)

获取房间属性

Parameters:
Name Type Description
roomId String

要获取属性的房间ID

callback function

获取属性回调函数

getScheduleById(id, callback)

根据明细表ID获取明细表内容

Parameters:
Name Type Description
id String

明细表ID

callback function

明细表内容

getScheduleList(callback)

获取明细表列表

Parameters:
Name Type Description
callback function

获取目录树回调函数 注:模型转换时加参数"exportSchedule":"true"

getSelectedComponents()

获取选中集合中的构件ID数组

Returns:
Type Description
Array

构件ID列表

getSetByComponentId(componentId, callback)

根据构件ID获取所属集合的信息

Parameters:
Name Type Description
componentId String

构件ID

callback function

获取集合信息的回调函数,集合信息格式示例{id: "1234", name: "parent", type: "group", elements: ['1','2','3','4',...]}

getSnowEffectOpts()

获取雪天效果

Returns:
Type Description
Object

opt 雾景特效参数

getViewHouseIsLoaded()

获取ViewHouse是否被加载

Returns:
Type Description
Boolean

ViewHouse是否被加载

getWireframeColor()

获取线框颜色

Returns:
Type Description
Glodon.Web.Graphics.Color

线框颜色

hideAllComponents()

隐藏模型全部构件

hideAllRooms()

隐藏所有房间

hideComponentsById(ids)

根据构件ID隐藏构件

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

hideComponentsByObjectData(conditions)

See:

根据筛选条件隐藏构件

Parameters:
Name Type Description
conditions Array

隐藏构件的条件集合,从getObjectDataById(objectId)获取

hideRoomsById(roomIds)

根据房间ID隐藏房间

Parameters:
Name Type Description
roomIds Array

房间的ID集合,如[“x1”, “x2”]

hideView(viewToken)

隐藏模型

Parameters:
Name Type Description
viewToken String

模型浏览凭证

hideViewHouse()

隐藏ViewHouse

isEnableBorderLine()

是否开启了线框

Returns:
Type Description
Boolean

是否开启了线框

isEnableHover()

是否开启了鼠标滑动拾取坐标

Returns:
Type Description
Boolean

是否开启了鼠标滑动拾取坐标

isEnableHover()

是否开启了鼠标的Hover效果

Returns:
Type Description
Boolean

是否开启了鼠标的Hover效果

isEnableOrbit(是否允许场景旋转)

是否开启场景旋转

Parameters:
Name Type Description
是否允许场景旋转 Boolean

isEnableScale(是否允许场景缩放)

是否开启场景缩放

Parameters:
Name Type Description
是否允许场景缩放 Boolean

isEnableToggleContextMenuDisplay()

是否开启了右键菜单

Returns:
Type Description
Boolean

是否开启了右键菜单

isEnableTranslate(是否允许场景平移)

获取是否开启场景平移

Parameters:
Name Type Description
是否允许场景平移 Boolean

isolateComponentsById(ids, state)

根据构件ID隔离构件,其他全部隐藏或半透明

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

state Glodon.Bimface.Viewer.IsolateOption

被隔离构件显示状态,如Glodon.Bimface.Viewer.IsolateOption.MakeOthersTranslucent

isolateComponentsByObjectData(conditions, state)

See:

根据筛选条件隔离构件,其他全部隐藏或半透明

Parameters:
Name Type Description
conditions Array

模型隔离条件,从getObjectDataById(objectId)获取

state Glodon.Bimface.Viewer.IsolateOption

被隔离构件显示状态,如Glodon.Bimface.Viewer.IsolateOption.MakeOthersTranslucent

isolateModel(modelIds, state)

隔离模型的全部构件,其他模型的全部构件隐藏或半透明

Parameters:
Name Type Description
modelIds Array

模型ID的数组

state Glodon.Bimface.Viewer.IsolateOption

被隔离构件显示状态,如Glodon.Bimface.Viewer.IsolateOption.MakeOthersTranslucent

loadModel(option)

添加自定义模型ID三维模型

Parameters:
Name Type Description
option Object

加载模型的参数对象

Properties
Name Type Description
viewToken String

模型浏览凭证

modelId String

模型ID,默认为文件ID

lockAxis(axis, range)

锁定相机绕轴旋转范围,range不填则为禁止绕该轴旋转

Parameters:
Name Type Description
axis Glodon.Bimface.Viewer.AxisOption

Z轴向 Glodon.Bimface.Viewer.AxisOption.Z

range Array

相机沿轴转动时可变化的范围,如[Math.PI / 6, Math.PI / 3]

opaqueAllComponents()

取消所有构件半透明

opaqueComponentsById(ids)

根据构件ID取消构件半透明

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

opaqueComponentsByObjectData(conditions)

See:

根据筛选条件取消构件半透明

Parameters:
Name Type Description
conditions Array

取消半透明构件的条件集合,从getObjectDataById(objectId)获取

overrideComponentsColorById(ids, color)

按构件ID给构件着色

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

color Glodon.Web.Graphics.Color

着色颜色

overrideComponentsColorByObjectData(conditions, color)

See:

根据筛选条件给构件着色

Parameters:
Name Type Description
conditions Array

着色条件,从getObjectDataById(objectId)获取

color Glodon.Web.Graphics.Color

颜色

overrideComponentsFrameColorById(ids, color)

根据构件ID给构件线框着色

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

color Glodon.Web.Graphics.Color

线框颜色

overrideComponentsFrameColorByObjectData(conditions, color)

See:

根据筛选条件给构件线框着色

Parameters:
Name Type Description
conditions Array

着色条件,从getObjectDataById(objectId)获取

color Glodon.Web.Graphics.Color

线框颜色

overrideComponentsOpacityById(ids, opacity)

按构件ID设置构件透明度

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

opacity Number

透明度,取值范围[0, 1],默认值为1

overrideComponentsOpacityByObjectData(conditions, opacity)

See:

根据筛选条件给构件设置透明度

Parameters:
Name Type Description
conditions Array

设置透明度条件,从getObjectDataById(objectId)获取

opacity Number

透明度,取值范围[0, 1],默认值为1

recordCustomHomeview()

保存当前视图为用户Home视图

removeAllAxisGrids()

隐藏模型中所有的轴网

removeAxisGridsByElevation(fileId, elevation)

按文件ID和给定高度移除轴网

Parameters:
Name Type Description
fileId String

文件ID,如果是单文件,可不填;如果是集成模型,则为必填项

elevation Number

高度

removeAxisGridsByFloor(fileId, levelName, callback)

按文件ID和楼层ID移除轴网

Parameters:
Name Type Description
fileId String

文件ID,如果是单模型文件,可不填;如果是集成模型,则为必填项

levelName String

楼层ID,如果是集成模型,则为单模型文件中的楼层ID(不是集成模型聚合后的楼层ID)

callback function

回调函数

removeGlowEffectById(ids)

根据ID移除发光效果

Parameters:
Name Type Description
ids Array

Object Ids.

removeModel(modelId)

卸载模型

Parameters:
Name Type Description
modelId String

模型ID

removeSelectedId(id)

根据构件ID从选中集合中移除

Parameters:
Name Type Description
id Array

多个构件ID的数组,如[“x1”, “x2”]

removeView(viewToken)

通过ViewToken卸载模型

Parameters:
Name Type Description
viewToken String

模型浏览凭证

render()

模型渲染,当修改了模型构件的状态,必须手动调用render(),场景才会显示效果,如果同时需要调用多个函数,强烈建议在最后调用一次render()

resize(width, height)

设置场景显示大小

Parameters:
Name Type Description
width Number

设置宽度

height Number

设置高度

restoreAllDefault()

恢复所有默认显示,包括着色、选择、隔离、半透明、空间等

restoreComponentsColorById(ids)

根据构件ID恢复构件的原来颜色

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

restoreComponentsColorByObjectData(conditions)

See:

根据筛选条件恢复构件的原来颜色

Parameters:
Name Type Description
conditions Array

着色条件,从getObjectDataById(objectId)获取

restoreComponentsFrameColorById(ids)

根据构件ID清除构件线框着色

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

restoreComponentsFrameColorByObjectData(conditions)

See:

根据筛选条件清除构件线框着色

Parameters:
Name Type Description
conditions Array

着色条件,从getObjectDataById(objectId)获取

restoreDefault()

恢复默认显示(不含着色),包括选择、隔离、半透明、空间等

restoreIsolatedComponentColor()

恢复隔离状态下其他构件的颜色

restoreWireframeColor()

恢复线框默认颜色

setAxisGridsState(轴网状态)

设置当前轴网的状态

Parameters:
Name Type Description
轴网状态 Object

setBackgroundColor(color1, color2)

设置场景背景颜色

Parameters:
Name Type Description
color1 Glodon.Web.Graphics.Color

设置背景颜色

color2 Glodon.Web.Graphics.Color

设置背景颜色,可不填(color2存在时即是由上而下的线性渐变背景颜色)

setBlinkColor(color)

设置强调状态的构件颜色

Parameters:
Name Type Description
color Glodon.Web.Graphics.Color

强调颜色,当参数为空时,恢复为默认颜色

setBlinkComponentsById(objectIds)

根据构件ID设置多个构件为强调状态集合

Parameters:
Name Type Description
objectIds Array

多个构件ID的数组

setBlinkIntervalTime(time)

设置强调状态颜色变化的间隔时间

Parameters:
Name Type Description
time Number

间隔时间(毫秒),参数为空时恢复为默认,参数 time <= 0 时无效

setBorderLineEnabled(isEnabled)

是否渲染轮廓线

Parameters:
Name Type Description
isEnabled Boolean

是否渲染轮廓线

setCameraAnimation(isEnabled)

设置模型动画,目前仅支持setCameraStatus()、setState()、 setView()三种API

Parameters:
Name Type Description
isEnabled Boolean

开启或关闭模型动画

setCameraStatus(camera, callback)

根据相机位置信息恢复视点

Parameters:
Name Type Description
camera Object

相机状态,getCameraStatus()返回的对象

callback function

相机还原之后回调函数,可不写

setCameraType(cameraType, fov)

设置相机类型

Parameters:
Name Type Description
cameraType String

相机类型,"OrthographicCamera" 正交相机,"PerspectiveCamera" 远景相机

fov Number

相机视野,正交相机不填,相机视锥体垂直视角,从下到上的观察角度,仅在远景相机中使用,取值范围为[10, 180]

setCollisionByCondition(condition)

See:

设置碰撞检测的构件类型

Parameters:
Name Type Description
condition Array

碰撞检测的条件,仅限categoryId、family、familyType三者

setComponentsOpacity(ids, state)

根据构件ID设置构件半透明,或取消构件半透明

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

state Glodon.Bimface.Viewer.OpacityOption

半透明,或取消半透明,如Glodon.Bimface.Viewer.OpacityOption.Translucent

setDampingFactor(factor)

设置平移阻尼效果参数

Parameters:
Name Type Description
factor number

阻尼效果参数,取值范围[1,10],数值越大,阻尼效果越明显。默认值10。

setExplosionExtent(extent)

设置爆炸效果离散系数

Parameters:
Name Type Description
extent Number

爆炸系数,取值范围[0, 3]

setExposureShift(number)

设置曝光强度

Parameters:
Name Type Description
number Number

曝光强度,取值范围[-1, 1]

setFloorExplosion(extent, floorIds, direction)

设置楼层爆炸效果

Parameters:
Name Type Description
extent Number

楼层爆炸离散系数,范围为[0, 30]

floorIds Array

参与楼层爆炸的楼层ID列表,默认全部楼层参与,floorIds=[]时所有楼层不参与楼层爆炸

direction Object

楼层爆炸的方向,缺省值为{x: 0, y: 0, z: 1}

setFlySpeedRate(rate)

设置漫游倍速

Parameters:
Name Type Description
rate Number

倍速,取值范围[0, 25]

setFogEffectOpts(opt)

设置雾天效果

Parameters:
Name Type Description
opt Object

雾景特效参数

Properties
Name Type Description
darkness Number

阴天,天空暗度;0~1;默认0.1;

lightAttenuation Number

光线衰减指数,取值为0~1,值越小则场景雾化程度越慢;

fogColor Object

雾的颜色;默认白色;支持Glodon.Web.Graphics.Color对象

visualDistance Number

最远可视范围;默认50000;单位:毫米

setGlowEffectById(ids, opt)

根据ID列表设置构件、房间、外部构件的发光效果

Parameters:
Name Type Description
ids Array

构件、房间、外部构件ID列表

opt Object

发光效果参数

Properties
Name Type Description
type String

发光效果类型,“body”为整体发光,“outline”为轮廓线发光,默认为“body”

color Glodon.Web.Graphics.Color

发光效果颜色

intensity Number

发光强度,取值范围[0,1],默认值为0.3

spread Number

扩散程度,取值范围[1,5],默认值为3

setGridBubblesColor(color)

设置轴网轴号的颜色

Parameters:
Name Type Description
color Glodon.Web.Graphics.Color

颜色

setGridLinesColor(color)

设置轴网轴线的颜色

Parameters:
Name Type Description
color Glodon.Web.Graphics.Color

颜色

setIsolatedComponentColor(color)

设置被隔离构件的颜色

Parameters:
Name Type Description
color Glodon.Web.Graphics.Color

颜色

setLineSelectRange(distance)

设置模型线的拾取范围

Parameters:
Name Type Description
distance Number

模型线的拾取范围,默认值为30,单位为毫米

setMaximalRangeofCamera(far)

限制相机最大活动范围

Parameters:
Name Type Description
far Number

相机与模型最远距离参数,范围(0, ∞),默认值为2

setMinimumFPS(fps)

设置模型渲染帧率

Parameters:
Name Type Description
fps Number

设置模型渲染帧率,取值范围[4, 60]

setModelRotationZ(modelId, basePoint, rotation)

设置模型绕Z轴旋转

Parameters:
Name Type Description
modelId String

模型文件/集成ID

basePoint Object

模型旋转的基点

rotation Number

模型旋转的弧度值

setModelScale(modelId, basePoint, scale)

设置模型缩放

Parameters:
Name Type Description
modelId String

模型文件/集成ID

basePoint Object

模型缩放的基点

scale Number

模型缩放系数

setModelTransformation(modelId, modelTransformation)

设置指定模型的坐标变换状态

Parameters:
Name Type Description
modelId String

指定模型的ModelID

modelTransformation Array

描述模型坐标变换的对象

setModelTranslation(modelId, translation)

设置模型平移

Parameters:
Name Type Description
modelId String

模型文件/集成ID

translation Object

模型平移的距离

setNavigationMode(navigationMode, options)

设置导航模式

Parameters:
Name Type Description
navigationMode Glodon.Bimface.Viewer.NavigationMode3D

设置导航模式,如Glodon.Bimface.Viewer.NavigationMode3D.Walk

options Object

配置参数

Properties
Name Type Description
position Object

导航模式为ThirdPerson和ThirdPersonRun时为必填项,第三人称漫游构件载入时,包围盒底部中心点世界坐标位置

setOrbitButton(orbitButton)

设置鼠标旋转习惯(左键旋转 / 右键旋转)

Parameters:
Name Type Description
orbitButton Glodon.Bimface.Viewer.OrbitButton

设置左右鼠标,进行模型旋转,如Glodon.Bimface.Viewer.OrbitButton.Left

setRoomsColorById(roomIds, color)

根据房间的ID修改房间颜色

Parameters:
Name Type Description
roomIds Array

房间的ID集合,如[“x1”, “x2”]

color Glodon.Web.Graphics.Color

房间的颜色

setRoomsFrameColorById(roomIds, color)

根据房间ID修改房间线框颜色

Parameters:
Name Type Description
roomIds Array

房间的ID集合

color Glodon.Web.Graphics.Color

房间的线框颜色

setRotationCenter(point)

设置模型旋转中心

Parameters:
Name Type Description
point Glodon.Web.Geometry.Point3d

模型旋转中心,缺省值为场景中心

setSelectedComponentsById(ids)

根据构件ID设置多个构件为选中集合

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

setSelectedComponentsByObjectData(conditions)

See:

根据筛选条件设置多个构件为选中集合

Parameters:
Name Type Description
conditions Array

多个筛选条件的数组,如[{familyType: xxx}, {category: xxx}]

setShellVisibility(viewToken, visible)

设置外壳是否可见

Parameters:
Name Type Description
viewToken String

模型浏览凭证

visible boolean

可见性,壳数据与模型本身可见性为互斥状态,壳可见,则模型本身不可见,反之亦然

setSnapMode(snapMode)

设置对象捕捉模式

Parameters:
Name Type Description
snapMode Glodon.Bimface.Viewer.SnapMode

捕捉模式

setSnowEffectOpts(opt)

设置雪天效果

Parameters:
Name Type Description
opt Object

雪景特效参数

Properties
Name Type Description
darkness Number

阴天,天空暗度;0~1;默认0.5;

density Number

雪的密度;0:雪停;1:小雪;2:中雪;3:大雪;默认中雪;

thickness Number

雪的厚度,0~1;默认0.8;

setState(state, callback)

还原状态

Parameters:
Name Type Description
state Object

场景状态,通过getCurrentState(),get3DViewStates(callback)等方法获取的状态

callback function

场景还原之后回调函数,可不写

setView(view, callback)

设置模型标准视角

Parameters:
Name Type Description
view Glodon.Bimface.Viewer.ViewOption

设置模型视角,如Glodon.Bimface.Viewer.ViewOption.Home

callback function

视角还原之后回调函数,可不写

setWireframeColor(color)

设置线框颜色

Parameters:
Name Type Description
color Glodon.Web.Graphics.Color

线框颜色

showAllAxisGrids()

显示所有轴网

showAllComponents(progressCallback, finishCallback)

显示模型全部构件

Parameters:
Name Type Description
progressCallback function

加载进度回调函数,可不写

finishCallback function

加载完成回调函数,可不写

showAllRooms()

显示所有房间

showAxisGridsByElevation(fileId, elevation, callback)

按文件ID和高度显示轴网

Parameters:
Name Type Description
fileId String

文件ID,如果是单文件,可不填;如果是集成模型,则为必填项

elevation String

高度

callback function

回调函数

showAxisGridsByFloor(fileId, floorId, callback)

按文件ID和楼层ID显示轴网

Parameters:
Name Type Description
fileId String

文件ID,如果是单文件,可不填;如果是集成模型,则为必填项

floorId String

楼层ID,如果是集成模型,则为单模型文件中的楼层ID(不是集成模型聚合后的楼层ID)

callback function

回调函数

showComponentsById(ids)

根据构件ID显示构件

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

showComponentsByObjectData(conditions)

See:

根据筛选条件显示构件

Parameters:
Name Type Description
conditions Array

显示构件的条件集合,从getObjectDataById(objectId)获取

showExclusiveComponentsByObjectData(conditions, progressCallback, finishCallback)

See:

根据筛选条件显示构件,其余全部隐藏

Parameters:
Name Type Description
conditions Array

只显示符合条件的构件,从getObjectDataById(objectId)获取

progressCallback function

加载进度回调函数,可不写

finishCallback function

加载完成回调函数,可不写

showFamilyTypeById(id)

切换族类型

Parameters:
Name Type Description
id String

根据族类型ID显示族文件 针对Rfa文件

showRoomsById(roomIds)

根据房间ID显示房间

Parameters:
Name Type Description
roomIds Array

房间的ID集合,如[“x1”, “x2”]

showView(viewToken)

显示模型

Parameters:
Name Type Description
viewToken String

模型浏览凭证

showViewHouse()

显示ViewHouse

splitComponentByPlane(id, plane)

根据平面拆分构件

Parameters:
Name Type Description
id String

被拆分的构件ID

plane Object

拆分用的平面对象,如{point, normal}

Returns:
Type Description
Array

构件被拆分后的mesh对象列表

startAutoRotate(speed, point)

开始自动旋转模型

Parameters:
Name Type Description
speed Number

速率,正负表示方向,数值表示速度

point Object

旋转中心,{x:,y:,z:},缺省为场景中心

stopAutoRotate()

停止自动旋转模型

toggleContextMenuDisplay(isEnabled)

切换右键菜单响应

Parameters:
Name Type Description
isEnabled Boolean

开启或关闭右键菜单响应

transparentAllComponents()

所有构件半透明

transparentComponentsById(ids)

根据构件ID设置构件为半透明

Parameters:
Name Type Description
ids Array

多个构件ID的数组,如[“x1”, “x2”]

transparentComponentsByObjectData(conditions)

See:

根据筛选条件设置构件为半透明

Parameters:
Name Type Description
conditions Array

半透明构件的条件集合,从getObjectDataById(objectId)获取

unlockAxis(axis)

允许绕轴旋转

Parameters:
Name Type Description
axis Glodon.Bimface.Viewer.AxisOption

Z轴向 Glodon.Bimface.Viewer.AxisOption.Z

updateSceneBoundingBox()

更新场景包围盒

zoomIn()

模型放大

zoomOut()

模型缩小

zoomToBoundingBox(boundingBox, callback, margin, duration)

缩放到指定的BoundingBox

Parameters:
Name Type Description
boundingBox Object

获取的构件的BoundingBox

callback function

缩放完成时的回调函数,可不写

margin Number

包围盒缩放比例, 默认值为0.5, margin > 0 模型缩小(包围盒变大),margin < 0 模型放大(包围盒变小)

duration Number

动画持续时间,单位为毫秒, 默认值为1000

zoomToSelectedComponents(margin, callback, duration)

缩放到加入选中集合的构件

Parameters:
Name Type Description
margin Number

包围盒缩放比例, 缺省值: 1, margin > 0 模型缩小(包围盒变大),margin < 0 模型放大(包围盒变小)

callback function

缩放完成时的回调函数,可不写

duration Number

动画持续时间,单位为毫秒, 默认值为1000