# How can i get assembly-tree attribute?

**URL:** <https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872>\
**Category:** HOOPS Visualize Web\
**Tags:** how-to\
**Created:** [September 15, 2025, 8:27am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872 "2025-09-15T08:27:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![38422985](https://avatars.discourse-cdn.com/v4/letter/3/34f0e0/32.png) [@38422985](https://forum.techsoft3d.com/u/38422985)\
**Post date:** [September 15, 2025, 8:27am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/1 "2025-09-15T08:27:33Z")

</div>

Hello，Tino：

i add some attributes to assembly-tree through the function AddAttribute or AddFaceAttribute or AddEdgeAttribute, how can i get these attribute?

_**bool `AddFaceAttribute`(NodeId bodyNodeID, uint32\_t faceIndex, const char \*attributeName, AssemblyTree::AtrributeType attributeType, const char \*attributeValue)**[](https://docs.techsoft3d.com/communicator/latest/api_ref/data_import/libsc/classSC_1_1Store_1_1AssemblyTree.html#_CPPv4N2SC5Store12AssemblyTree16AddFaceAttributeE6NodeId8uint32_tPKcN12AssemblyTree13AttributeTypeEPKc "Permalink to this definition")_

_Thanks!  
Best_

Jenson

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [September 15, 2025, 10:01am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/2 "2025-09-15T10:01:48Z")

</div>

You can call the corresponding Web Viewer functions:

- [getFaceAttributes](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/classes/Model.html#Model.getFaceAttributes)
- [getEdgeAttributes](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/classes/Model.html#Model.getEdgeAttributes)

---

<div class="post-metadata">

**Author:** ![38422985](https://avatars.discourse-cdn.com/v4/letter/3/34f0e0/32.png) [@38422985](https://forum.techsoft3d.com/u/38422985)\
**Post date:** [September 15, 2025, 12:21pm UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/3 "2025-09-15T12:21:38Z")

</div>

Hello, tino:

Firstly, i’m so soory for my title! I have modified!  
When i upload a SCS Files which i generated by Sc API from “_D:\Projects\HOOPS\_Communicator\_2025.6.1\authoring\libsc\examples\sc\_store\_cube\_sample.cpp”_, then I find the nodeId is negative！Why？

I find the attributes type is a array，so how should i get the attribute？attributes[0]? It’s error！

Thanks a bunch!  
Best

 ![wechat_2025-09-15_201551_946](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/8/8b0267c2bd157fefa42203c3d3c6f4f333d56ecd.png)

js code：

if(selectType.value === “face”)

{

```auto
    var config = new Communicator.PickConfig(Communicator.SelectionMask.Face);

    this._hwv.selectionManager.clear();

    this._hwv.view.pickFromPoint(event.getPosition(), config).then((selection) => {

            if (selection.getNodeId() != null) {

                    this._hwv.selectionManager.set(selection);                                        

                    const nodeId = selection.getNodeId();

                    console.log("nodeId:",nodeId);

                    const faceId = selection.getFaceEntity().getCadFaceIndex();

                    console.log("faceId:",faceId);

                    this._hwv.model.getFaceAttributes(nodeId,faceId).attributes.forEach(attr => {

                            console.log("femapId:", attr.getValue());

                    });                        

            }

    });

```

}

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [September 15, 2025, 1:09pm UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/4 "2025-09-15T13:09:11Z")

</div>

The function `getFaceAttributes` returns a promise so you can do a `.then` or `await`:

```auto
const faceAttributes = await this._hwv.model.getFaceAttributes(nodeId,faceId);

faceAttributes.attributes.forEach(attr => {
    console.log("femapId:", attr.getValue());
});

```

Also, when I run the sample, the node id for the cube is positive, not negative. A quick recommendation is that for each time you run the example, please delete the **old** version in _HOOPS\_Communicator\_2025.6.1\quick\_start\converted\_models\authoring\_samples\_data_.

---

<div class="post-metadata">

**Author:** ![38422985](https://avatars.discourse-cdn.com/v4/letter/3/34f0e0/32.png) [@38422985](https://forum.techsoft3d.com/u/38422985)\
**Post date:** [September 16, 2025, 6:44am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/5 "2025-09-16T06:44:20Z")

</div>

Hello,tino:

Thanks you very much! Thanks again!

Best!

Jenson

---

<div class="post-metadata">

**Author:** ![38422985](https://avatars.discourse-cdn.com/v4/letter/3/34f0e0/32.png) [@38422985](https://forum.techsoft3d.com/u/38422985)\
**Post date:** [September 16, 2025, 7:24am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/6 "2025-09-16T07:24:10Z")

</div>

[attributes.zip](https://forum.techsoft3d.com/uploads/short-url/vgit9qtwkp06MJPRfReSIRiBstR.zip) (23.2 KB)  
Hello,tino:  
Sorry for my question!  
I deleted the old version, then i get the positive nodeId,but i don’t get the faceattributes, and i test all faces, the results are null. God, why? Help me!  
**Respectfully yours**!  
Jenson

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [September 16, 2025, 1:34pm UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/7 "2025-09-16T13:34:44Z")

</div>

In your original code from an earlier post, you hard-coded the body id as 1 in the first argument:

```auto
assembly_tree.AddFaceAttribute(1, 1, "femap_id", SC::Store::AssemblyTree::AttributeType::AttributeTypeInt, "90");

```

Instead of doing that, pass the body id variable to the function:

```auto
assembly_tree.AddFaceAttribute(body_id, 1, "femap_id", SC::Store::AssemblyTree::AttributeType::AttributeTypeInt, "90");

```

---

<div class="post-metadata">

**Author:** ![38422985](https://avatars.discourse-cdn.com/v4/letter/3/34f0e0/32.png) [@38422985](https://forum.techsoft3d.com/u/38422985)\
**Post date:** [September 17, 2025, 1:41am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/8 "2025-09-17T01:41:52Z")

</div>

Hello，tino:

Sorry, I may not have described my question clearly. Actually, the SCS files in the compressed file have already been generated using the parameter **body\_id** not the parameter “1”. But the results are null.  
Best wishes!  
Jenson

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [September 17, 2025, 1:46am UTC](https://forum.techsoft3d.com/t/how-can-i-get-assembly-tree-attribute/4872/9 "2025-09-17T01:46:28Z")

</div>

Hello,

Please send me your `.cpp` file by clicking my profile and then “Message”.

Thanks,  
Tino
