""" py3dtiles的安装: pip3 install py3dtiles 详见:https://blog.youkuaiyun.com/weixin_42193179/article/details/98958837 """ from py3dtiles import TileReader from py3dtiles import B3dm # RuntimeError: Unsupported glTF version # filename = r'D:\3dData\小学-机电合模\1\0\0.b3dm' # filename = r'D:\3dData\bim-youeryuan\1\0\0.b3dm' # filename = r'D:\3dData\bimYIYUAN\1\0\0.b3dm' filename = r'D:\360安全浏览器下载\3d-tiles-samples-master\tilesets\TilesetWithRequestVolume\building.b3dm' # 读文件。 tile = TileReader().read_file(filename) # tile是Tile类的一个实例。 print("tile:", tile) # tile: <py3dtiles.tile.Tile object at 0x000001C2467F62E8> # 提取tile header信息。 th = tile.header print("th:", th) # th: <py3dtiles.b3dm.B3dmHeader object at 0x00000299044C3748> # 魔法值 print("magic_value:", th.magic_value) # magic_value: b3dm # 整个瓦片的长度,包括头文件,单位:字节。 print("tile_byte_length:", th.tile_byte_length) # tile_byte_length: 3667588 print() # 提取glTF gltf = tile.body.glTF print("gltf:", gltf) # gltf: <py3dtiles.gltf.GlTF object at 0x000001F67B463E10> # 展示gltf头的资产字段。 print("gltf.header['asset']:", gltf.header['asset']) # gltf.header['asset']: {'generator': 'OBJ2GLTF', 'premultipliedAlpha': True, 'profile': {'api': 'WebGL', 'version': '1.0'}, 'version': '1.0'}
py3dtiles read a .b3dm file.py
最新推荐文章于 2025-06-29 09:09:09 发布
