关键词:
/**
* Gets properties for multiple object IDs.
* @param number[] ids List of object IDs.
* @returns Promise<object[]> Promise that is resolved with an array of properties.
*/
async function getAllProps(ids)
let props = await Promise.all(ids.map(id => getProps(id)))
return props;
/**
* Gets properties for specific object ID.
* @param number id Object ID.
* @returns Promise<object> Promise that is resolved with object properties.
*/
function getProps(id)
return new Promise(function(resolve, reject)
NOP_VIEWER.getProperties(id, resolve, reject);
);
const tree = NOP_VIEWER.model.getInstanceTree().nodeAccess.dbIdToIndex
const dbObjects = await getAllProps(Object.values(tree).slice(1))
const dictionary = ;
dbObjects.forEach((value) =>
propTypeName = value.properties.find( prop =>
return (prop.displayName === 'Type Name');
)
propTypeArea = value.properties.find( prop =>
return (prop.displayName === 'Area')
)
if(propTypeName && propTypeArea )
dictionary[propTypeName.displayValue] =
dbId: value.dbId,
area: propTypeArea.displayValue
)
// check the result by calling dictionary in the console.
csharp代码片段(代码片段)
查看详情
javascript代码片段(代码片段)
查看详情
textvisualbasic代码片段(代码片段)
查看详情
sqloracle代码片段(代码片段)
查看详情
swift代码片段(代码片段)
查看详情
java代码片段【安卓】(代码片段)
查看详情
shbash的代码片段(代码片段)
查看详情
markdownphpexcelnotes和代码片段(代码片段)
查看详情
javaandroid的代码片段(代码片段)
查看详情
javascriptjs-常用代码片段(代码片段)
查看详情
常用代码片段(代码片段)
单例模式privatestaticHttpUtilinstance;publicstaticsynchronizedHttpUtilgetInstance()if(instance==null)instance=newHttpUtil();returninstance; 查看详情
常用代码片段(代码片段)
单例模式privatestaticHttpUtilinstance;publicstaticsynchronizedHttpUtilgetInstance()if(instance==null)instance=newHttpUtil();returninstance; 查看详情
text代码片段很有用(代码片段)
查看详情
vbscript我的代码片段(代码片段)
查看详情
java代码片段【java】(代码片段)
查看详情
rr有用的代码片段(代码片段)
查看详情
常见的代码片段(代码片段)
$(id).select2(placeholder:"--请选择--",allowClear:true,data:list); 查看详情
text代码片段【snl】(代码片段)
查看详情