Autodesk ForgeAPIメモ⑧ getProperties()
const target_dbId = 12634; viewer.model.getProperties(target_dbId, props => { props.properties.forEach(prop => { console.log(prop.attributeName); console.log(prop.displayCategory); console.log(prop.displayName + ((prop.type === 11) ? "[dbId]" : ""),); console.log(prop.displayValue,); console.log(prop.hidden); console.log(prop.precision); console.log(prop.type); console.log(prop.units); }); })
propsの中身
https://autodeskviewer.com/viewers/latest/docs/global.html#GetPropertiesResult
propの中身
https://autodesk-forge.gitee.io/viewer-docs/global.html#PropertyResult
Autodesk ForgeAPIメモ⑥ getInstanceTree()
var instanceTree = viewer.model.getData().instanceTree; // instanceTreeの第1階層のデータを取得 instanceTree.enumNodeChildren(1, function(childrenIds) { console.log("------------------------------"); console.log(childrenIds); console.log(instanceTree.getNodeName(childrenIds)); console.log(instanceTree.getNodeType(childrenIds)); console.log(instanceTree.getChildCount(childrenIds)); console.log("------------------------------"); });
実行結果
--------------childrenIds---------------- toolBarButton.js:54 ------------------------------ toolBarButton.js:55 1713 toolBarButton.js:56 Air Terminals toolBarButton.js:57 0 toolBarButton.js:58 2 toolBarButton.js:59 ------------------------------ toolBarButton.js:54 ------------------------------ toolBarButton.js:55 1748 toolBarButton.js:56 <Space Separation> toolBarButton.js:57 0 toolBarButton.js:58 12 toolBarButton.js:59 ------------------------------ toolBarButton.js:54 ------------------------------ toolBarButton.js:55 2005 toolBarButton.js:56 Mechanical Equipment toolBarButton.js:57 0 toolBarButton.js:58 7 toolBarButton.js:59 ------------------------------ toolBarButton.js:54 ------------------------------ toolBarButton.js:55 2022 toolBarButton.js:56 Ducts toolBarButton.js:57 0 toolBarButton.js:58 2 toolBarButton.js:59 ------------------------------ toolBarButton.js:54 ------------------------------ toolBarButton.js:55 2034 toolBarButton.js:56 Duct Fittings toolBarButton.js:57 0 toolBarButton.js:58 9 toolBarButton.js:59 ------------------------------ toolBarButton.js:54 ------------------------------ toolBarButton.js:55 2589 toolBarButton.js:56 Flex Ducts toolBarButton.js:57 0 toolBarButton.js:58 1 toolBarButton.js:59 ------------------------------
instanceTree.enumNodeChildren(1713, function(childrenIds) { console.log("----------------xx--------------"); console.log(instanceTree.getNodeName(childrenIds)); console.log("----------------xx--------------"); });
----------------xx-------------- toolBarButton.js:81 M_Supply Diffuser - Rectangular Face Round Neck toolBarButton.js:82 ----------------xx-------------- toolBarButton.js:80 ----------------xx-------------- toolBarButton.js:81 M_Supply Diffuser - Sidewall toolBarButton.js:82 ----------------xx--------------
Autodesk ForgeAPIメモ①
doc = NOP_VIEWER.model.getDocumentNode()
上記のAPIで描画している3Dモデルのmanifest 情報が取得できる。
manifet取得APIと同じ情報が取得できる
Model Derivative API
https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/manifest/urn-manifest-GET/
{ "guid": "8276b1d9-72e0-4421-f056-5dd2f25a0f23", "type": "geometry", "role": "3d", "name": "{3D}", "viewableID": "7355f61c-f615-4d2a-9c1f-0803955b9669-000c48b5", "phaseNames": "New Construction", "status": "success", "hasThumbnail": "true", "progress": "complete", "children": [ { "guid": "7355f61c-f615-4d2a-9c1f-0803955b9669-000c48b5", "type": "view", "role": "3d", "name": "{3D}", "status": "success", "progress": "complete", "camera": [ -150.587158203125, 252.19168090820312, 228.48350524902344, 55.39960479736328, 46.20491027832031, 22.496734619140625, 0.40824830532073975, -0.40824830532073975, 0.8164966106414795, 1.3768740892410278, 0, 1, 1 ] }, { "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6andhZWR0M3d2Z2Y5Y2FzOGZzZ3F5eG9yaXA2a2d5cXgtMjAyMjA4MjZ4eHh4L3JtZWFkdmFuY2Vkc2FtcGxlcHJvamVjdC5ydnQ/output/Resource/3D View/{3D} 805045/{3D}.svf", "role": "graphics", "mime": "application/autodesk-svf", "guid": "c94cec21-a581-d9f8-3789-a9ef9b67d6b4", "type": "resource" }, { "urn": "urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6andhZWR0M3d2Z2Y5Y2FzOGZzZ3F5eG9yaXA2a2d5cXgtMjAyMjA4MjZ4eHh4L3JtZWFkdmFuY2Vkc2FtcGxlcHJvamVjdC5ydnQ/output/Resource/3D View/{3D} 805045/{3D}1.png", "role": "thumbnail", "mime": "image/png", "guid": "98a94f3c-7143-4504-ab1f-36b16f5bfa34", "type": "resource", "resolution": [ 100, 100 ], "status": "success" },
Forge ViewerAPI Model
Model
No | API | Memo |
---|---|---|
TD | getInstanceTree() | ModelのinstancdTreeオブジェクトを取得可能 Autodesk ForgeAPIメモ⑥ getInstanceTree() - bigmac-jp blog |
TD | getFuzzyBox(options) | boundingBoxを取得 three.js box3を取得可能 |
TD | is2d() | |
TD | is3d() | |
TD | isSVF2() | |
TD | isPdf(onlyPdfSource) | |
TD | isRevitPdf() | |
TD | isLeaflet() | |
TD | isPageCoordinates() | |
TD | isSceneBuilder() | |
TD | isPageCoordinates() | |
TD | isSceneBuilder() | |
TD | getData() | 返却値にinstanceTreeがふくまれている。その他いろいろなデータが取得可能 |
TD | getDocumentNode() | |
TD | getRoot() | |
TD | getRootId() | |
TD | getUnitData(unit) | l |
TD | getUnitScale() | 距離の単位取得可能 |
TD | getUnitString() | 表示単位の取得 設定->表示単位 |
TD | getDisplayUnit() | Returns a standard string representation of the model’s display unit. モデルの標準単位の取得が可能 |
TD | getMetadata(itemName, subitemName, defaultValue) | |
TD | getDefaultCamera() | |
TD | isAEC() | |
TD | hasPageShadow() | |
TD | getUpVector() | 上方向のベクトルの取得が可能 x(0,0,1) y(0,1,0) z(0,0,1) |
TD | geomPolyCount() | ポリゴン数を取得可能 |
TD | instancePolyCount() | ポリゴン数を取得可能 |
TD | isLoadDone(checkTextures) | |
TD | isObjectTreeCreated() | |
TD | isObjectTreeCreated() | |
TD | getPropertyDb() | PropDbLoaderが取得できる。中身はinstanceTreeなどがある。worker用??? |
TD | getProperties(dbId, onSuccessCallback, onErrorCallback) | dbIDを指定してオブジェクトのPropertiesを取得可能 取得項目https://mtaryo.hatenablog.com/entry/2022/09/06/095452?_ga=2.98589595.461683717.1662352014-704825042.1600853534 |
TD | getProperties2(dbId, onSuccessCallback, onErrorCallback, options) | |
TD | getBulkProperties(dbIds, options, onSuccessCallback, onErrorCallback) | 複数のdbidをしていして、propertyを取得可能 |
TD | getBulkProperties2(dbIds, options, onSuccessCallback, onErrorCallback) | |
TD | getPropertySetAsync(dbIds, options) | 不明。。。 |
TD | getPropertySet(dbIds, onSuccessCallback, onErrorCallback, options) | |
TD | getExternalIdMapping(onSuccessCallback, onErrorCallback) | |
TD | getLayerToNodeIdMapping(onSuccessCallback, onErrorCallback) | |
TD | getObjectTree(onSuccessCallback, onErrorCallback) | |
TD | isObjectTreeLoaded() | |
TD | search(text, onSuccessCallback, onErrorCallback, attributeNames, options) | |
TD | findProperty(propertyName) | |
TD | getTopology(index) | |
TD | hasTopology() | |
TD | fetchTopology(maxSizeMB) | |
TD | hasGeometry() | |
TD | getFragmentPointer(fragId) | |
TD | clone() |
Autodesk Forge View Portデータ連携 対象
Revit上で作成した2D SheetをForge Viewer上のgetViewportsファンクションで取得するには下記の制限がある。
・Revit上で2D Sheet View Portのプロパティ:Crop View(ビューをトリミング)にチェックが入っていること
下記参照(Crop View)
View Properties | Revit 2020 | Autodesk Knowledge Network
・平面図、構造図、天井伏図の2D図面シートのみが対応。吹き出し、エリアプランなどはの対象外がるシートはサポートされていない。
・部分切断領域が存在する場合サポート対象外
下記参照
autodesk forge - Viewport Data on Revit File Exists but Could Not Be Found - Stack Overflow
Azure Appservice ローカルGitでのエラー回避
Azure app serviceでローカルGitでプログラムのデプロイを実行した場合、エラーが発生した。
下記の解決方法で対応。
Azureポータル->APP Service->構成->アプリケーション設定で下記を設定
SCM_DO_BUILD_DURING_DEPLOYMENT=FALSE
エラーを確認したところ、コミット&PUSHしたプログラムをビルドしようとしてエラーになっている感じだった。
上記の設定で自動ビルドは実行しない設定に変更。(今回はデモ環境で自動ビルドは不要のため、この対応方法で回避できた。)