javascript - 将 Revit 文件添加到 html

标签 javascript html css revit

有没有可能将 Revit 文件插入 html 页面的方法?我有一个 rvt 文件,我尝试将其转换为 geojson 文件...之后我调用了它...它不起作用...可以谁帮帮我....

这是 geojson:

[
    {
        "type": "FeatureCollection",
        "crs": {
            "type": "name",
            "properties": {
                "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
            }
        },
        "features": [
            {
                "type": "Feature",
                "properties": {
                    "name": "CEO",
                    "roomno": 1,
                    "ph": 200
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.5987896482477,
                                12.983168941037594
                            ],
                            [
                                77.59896972798799,
                                12.983169878952907
                            ],
                            [
                                77.59896972798799,
                                12.983106369240323
                            ],
                            [
                                77.5990585784097,
                                12.983106485384665
                            ],
                            [
                                77.59905799603237,
                                12.982853151249317
                            ],
                            [
                                77.5987896482477,
                                12.98285279440386
                            ],
                            [
                                77.5987896482477,
                                12.983168941037594
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "MD",
                    "roomno": 2,
                    "ph": 201
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.5987896482477,
                                12.983168941037594
                            ],
                            [
                                77.59878830101773,
                                12.983479517309322
                            ],
                            [
                                77.59905944627795,
                                12.983484008075912
                            ],
                            [
                                77.59905885920351,
                                12.983228630695868
                            ],
                            [
                                77.59896972798799,
                                12.983228514488285
                            ],
                            [
                                77.59896972798799,
                                12.983169878952907
                            ],
                            [
                                77.5987896482477,
                                12.983168941037594
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Hall",
                    "roomno": 8,
                    "ph": null
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59932180408867,
                                12.983287156750118
                            ],
                            [
                                77.59950020019542,
                                12.98328612555875
                            ],
                            [
                                77.5995003304455,
                                12.98322920627767
                            ],
                            [
                                77.59976293746367,
                                12.983229548659702
                            ],
                            [
                                77.59994467341478,
                                12.983229785603577
                            ],
                            [
                                77.59994467341478,
                                12.98310764367879
                            ],
                            [
                                77.599716099465,
                                12.983107344889312
                            ],
                            [
                                77.59950060994909,
                                12.98310706320367
                            ],
                            [
                                77.59950118963468,
                                12.982853740602511
                            ],
                            [
                                77.59932180408867,
                                12.982853502057903
                            ],
                            [
                                77.59932180408867,
                                12.98310682947052
                            ],
                            [
                                77.5990585784097,
                                12.983106485384665
                            ],
                            [
                                77.59896972798799,
                                12.983106369240323
                            ],
                            [
                                77.59896972798799,
                                12.983169878952907
                            ],
                            [
                                77.59896972798799,
                                12.983228514488285
                            ],
                            [
                                77.59905885920351,
                                12.983228630695868
                            ],
                            [
                                77.59932180408867,
                                12.983228973518404
                            ],
                            [
                                77.59932180408867,
                                12.983287156750118
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "StairCase",
                    "roomno": 9,
                    "ph": null
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59950020019542,
                                12.98328612555875
                            ],
                            [
                                77.59932180408867,
                                12.983287156750118
                            ],
                            [
                                77.59932180408867,
                                12.983484008075912
                            ],
                            [
                                77.59949974737502,
                                12.983484008075912
                            ],
                            [
                                77.59950020019542,
                                12.98328612555875
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Development Area",
                    "roomno": 4,
                    "ph": 204
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59971805557235,
                                12.982854028988067
                            ],
                            [
                                77.59950118963468,
                                12.982853740602511
                            ],
                            [
                                77.59950060994909,
                                12.98310706320367
                            ],
                            [
                                77.599716099465,
                                12.983107344889312
                            ],
                            [
                                77.59971805557235,
                                12.982854028988067
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Conference",
                    "roomno": 3,
                    "ph": 203
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59994467341478,
                                12.982854330341581
                            ],
                            [
                                77.59971805557235,
                                12.982854028988067
                            ],
                            [
                                77.599716099465,
                                12.983107344889312
                            ],
                            [
                                77.59994467341478,
                                12.98310764367879
                            ],
                            [
                                77.59994467341478,
                                12.982854330341581
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Cabin 2",
                    "roomno": 6,
                    "ph": 206
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59932180408867,
                                12.982853502057903
                            ],
                            [
                                77.59905799603237,
                                12.982853151249317
                            ],
                            [
                                77.5990585784097,
                                12.983106485384665
                            ],
                            [
                                77.59932180408867,
                                12.98310682947052
                            ],
                            [
                                77.59932180408867,
                                12.982853502057903
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Refreshment",
                    "roomno": 7,
                    "ph": null
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59994467341478,
                                12.983229785603577
                            ],
                            [
                                77.59976293746367,
                                12.983229548659702
                            ],
                            [
                                77.59976064503648,
                                12.983484008075912
                            ],
                            [
                                77.59994467341478,
                                12.983484008075912
                            ],
                            [
                                77.59994467341478,
                                12.983229785603577
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Canteen",
                    "roomno": 6,
                    "ph": 206
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59976293746367,
                                12.983229548659702
                            ],
                            [
                                77.5995003304455,
                                12.98322920627767
                            ],
                            [
                                77.59949974737502,
                                12.983484008075912
                            ],
                            [
                                77.59976064503648,
                                12.983484008075912
                            ],
                            [
                                77.59976293746367,
                                12.983229548659702
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "Cabin 1",
                    "roomno": 5,
                    "ph": 205
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59932180408867,
                                12.983228973518404
                            ],
                            [
                                77.59905885920351,
                                12.983228630695868
                            ],
                            [
                                77.59905944627795,
                                12.983484008075912
                            ],
                            [
                                77.59932180408867,
                                12.983484008075912
                            ],
                            [
                                77.59932180408867,
                                12.983228973518404
                            ]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "properties": {
                    "name": "entrance",
                    "roomno": 10,
                    "ph": null
                },
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [
                                77.59950118963468,
                                12.982853740602511
                            ],
                            [
                                77.59950131349133,
                                12.982799615247522
                            ],
                            [
                                77.59932180408867,
                                12.982799615247522
                            ],
                            [
                                77.59932180408867,
                                12.982853502057903
                            ],
                            [
                                77.59950118963468,
                                12.982853740602511
                            ]
                        ]
                    ]
                }
            }
        ]
    }
]

这是我的脚本:

 var map = new L.Map('map'); 
 map.setView([12.98317,77.59941], 16,
 false); 
 map.setView([12.98317,77.59941], 16, false);
 map.setView([12.98317,77.59941], 16, false);
 map.setView([12.98317,77.59941], 16, false);

 new L.TileLayer('http://{s}.tiles.mapbox.com/v3/osmbuildings.kbpalbpk/{z}/{x}/{y}.png',
 {   attribution: 'Map tiles &copy; <a
 href="http://mapbox.com"MapBox</a',   maxZoom: 15,   maxNativeZoom:
 20 }).addTo(map);

 var osmb = new OSMBuildings(map);

 //************************************************************

 var geoJsonBlock;

 function getCenter(geoJson) {   var geometry, len = 0, lat = 0, lon =
 0;

   for (var i = 0, il = geoJson.features.length; i < il; i++) {
     geometry = geoJson.features[i].geometry.coordinates[0];
     if (geometry[0][0][0]) {
       geometry = geometry[0];
     }

     len += geometry.length-1;
     for (var j = 0, jl = geometry.length-1; j < jl; j++) {
       lat += geometry[j][1];
       lon += geometry[j][0];
     }   }

   return { lat:lat/len, lon:lon/len }; }

 function setGeoJSON() {   try {
     var geoJson = JSON.parse(geoJsonBlock.value);   } catch(e) {}  osmb.addGeoJSON('C:\Users\......\Desktop\.....\groundfloor_polygon.geojson');
 var center = getCenter(geoJson);   map.setView([center.lat,
 center.lon], 17) }

 geoJsonBlock = document.querySelector('textarea'); setGeoJSON();

最佳答案

是的,您确实可以非常轻松地将 Revit 模型添加到 HTML 页面。更好的是,您可以使用 Forge 或 A360 查看器添加它,使用户能够使用平移、缩放、旋转以及查询其数据结构和属性来导航模型。只需使用免费帐户将您的模型上传到 A360,然后使用嵌入选项创建一个 HTML 片段,您可以将其添加到现有 HTML 页面。

关于javascript - 将 Revit 文件添加到 html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42245764/

相关文章:

javascript - javascript 超出最大调用堆栈大小

javascript - 将元素的属性强制为某个值,即使它正在动画

javascript - 如何在使用滚动上下移动元素时将元素停在页脚行

html - css 代码桌面 View 和移动 View 不起作用

html - 使用 Angular2 单击更改图像

html - 如何从我的 Font Awesome 复选框中删除这个白色背景或边框?

JavaScript:由 eval() 触发的异常对象的标准字段是什么?

JavaScript 效率 - 'forEach' 具有多个 'if' 或 'if' 只允许 'forEach'

javascript - React MUI Multiple Select with Checkboxes not Check marking Initial Selected Options

javascript - 这个脚本有可能被通用化吗?