Closed digitalportico closed 8 years ago
Please use proper code escaping.
Can you be more specific on what you are confused about? node.list
will recursively get a flat list based on all the children of a tree node. For all those nodes, after a little bit of filtering the oid's are being put in ifcOids
i need separate ifcOids array. Is there any way to get it , other than using nodes ? I mean , get all oids as array directly from model or from project ?
Sure just iterate through all objects and get their oids and put them in an array.
Something like this (untested)
var oids = [];
model.objects.forEach(function(object){
oids.push(object.oid);
});
While analyzing bimvie.ws source code , we confused on how node get object ids ?
this.internalToggleEye = function(node, mode) { var nodeList = node.list(); console.log("console: nodelist"); console.log(nodeList); var groupNode = node.findFirstParentWithAttr("groupId"); if (groupNode.groupId != -1) { var hiddenTypes = Settings.getDefaultHiddenTypes(); var ifcOids = []; nodeList.forEach(function(subNode){ if (subNode.type.startsWith("Ifc") && typeof subNode.id === "number") { var explicit = node.id == subNode.id || (node.type != null && node.type == subNode.type); if (hiddenTypes[subNode.type] == null || explicit || mode != 0) { ifcOids.push(subNode.id); } } }); console.log("console: ifcOids"); console.log(ifcOids); parent.setObjectVisibility(groupNode.groupId, ifcOids, mode); nodeList.forEach(function(n){ var explicit = node.id == n.id || (node.type != null && node.type == n.type); if (hiddenTypes[n.type] == null || explicit || mode != 0) { n.eye.attr("mode", mode); if (mode == 0) { n.eye.removeClass("eyeclosed").removeClass("eyehalfopen").addClass("eyeopen"); } else if (mode == 1) { n.eye.removeClass("eyeopen").removeClass("eyeclosed").addClass("eyehalfopen"); } else if (mode == 2) { n.eye.removeClass("eyehalfopen").removeClass("eyeopen").addClass("eyeclosed"); } } }); } };