# How to use the api ConeElement or CylinderElement to create some cone or cylinder esc?

**URL:** <https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917>\
**Category:** HOOPS Visualize Web\
**Tags:** how-to\
**Created:** [September 25, 2025, 3:51am UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917 "2025-09-25T03:51:37Z")\
**Posts on this page:** 7\
**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 25, 2025, 3:51am UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/1 "2025-09-25T03:51:37Z")

</div>

hello, teacher:

There are some class: coneelement or cylinderelement, i want to create some geometry in the webviewer model, how to do this ?  
the example “_gemomety\_inserting_” desribed how to create mesh, but it is created some triangle.

> **[Geometry — HOOPS Communicator Documentation](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/geometry/introduction.html)**

Can i directly create a cone or cylinder or cube using the api not the triangle?

thanks

---

<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 25, 2025, 11:19am UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/2 "2025-09-25T11:19:11Z")

</div>

Please see [generateConeCylinderMeshData](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/index.html#generateconecylindermeshdata) and [generateSphereMeshData](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/index.html#generatespheremeshdata).

Once the mesh is created, you can apply a [scale and translation matrix](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/classes/Matrix.html#matrix) to control the desired size and position.

---

<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 26, 2025, 12:31am UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/3 "2025-09-26T00:31:22Z")

</div>

Hello, tino

what’s Util? How to excute the [generateConeCylinderMeshData](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/index.html#generateconecylindermeshdata) to create a ConeCylinder?  
Ande, are there other api, for example : Cube or Cuboid etc.

can you give me any examples?

Thanks a lot!

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 26, 2025, 11:01am UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/4 "2025-09-26T11:01:23Z")

</div>

Below is an example of generating a cylinder, a cone and a combination of the two:

```auto
await hwv.model.clear();

let cylinderMeshData = Communicator.Util.generateConeCylinderMeshData(2, 24, 5, 0, 0, 0);
let cylinderMeshId = await hwv.model.createMesh(cylinderMeshData);

let meshInstanceData = new Communicator.MeshInstanceData(cylinderMeshId);
meshInstanceData.setFaceColor(Communicator.Color.green());
let nodeCyclinder = hwv.model.createNode(hwv.model.getAbsoluteRootNode(), "node cylinder");
let cylinderMeshNode = await hwv.model.createMeshInstance(meshInstanceData, nodeCyclinder);

let coneMeshData = Communicator.Util.generateConeCylinderMeshData(0, 24, 0, 3, 5, 0);
let coneMeshId = await hwv.model.createMesh(coneMeshData);

meshInstanceData = new Communicator.MeshInstanceData(coneMeshId);
meshInstanceData.setFaceColor(Communicator.Color.red());
let nodeCone = hwv.model.createNode(hwv.model.getAbsoluteRootNode(), "node cone");
let coneMeshNode = await hwv.model.createMeshInstance(meshInstanceData, nodeCone);
let matrix = new Communicator.Matrix();
matrix.setTranslationComponent(10, 0, 0);
await hwv.model.setNodeMatrix(coneMeshNode, matrix);

let coneCylinderMeshData = Communicator.Util.generateConeCylinderMeshData(2, 24, 5, 3, 5, 0);
let coneCyclinderMeshId = await hwv.model.createMesh(coneCylinderMeshData);

meshInstanceData = new Communicator.MeshInstanceData(coneCyclinderMeshId);
meshInstanceData.setFaceColor(Communicator.Color.blue());
let nodeConeCyclinder = hwv.model.createNode(hwv.model.getAbsoluteRootNode(), "node cone cylinder");
let coneCylinderMeshNode = await hwv.model.createMeshInstance(meshInstanceData, nodeConeCyclinder);
matrix.setTranslationComponent(20, 0, 0);
await hwv.model.setNodeMatrix(coneCylinderMeshNode, matrix);

await hwv.view.fitWorld();

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/a/a3da226cdc0dc9906121fb2ddfa9f77ad68eabc5.png)

For creating cubes, please see this example in our docs:

> **[Meshes — HOOPS Communicator Documentation](https://docs.techsoft3d.com/communicator/latest/prog_guide/viewing/geometry/meshes.html#create-meshdata)**

---

<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 26, 2025, 1:14pm UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/5 "2025-09-26T13:14:59Z")

</div>

hello tino

Thank you very much!

Additionally, I would like to discuss with you whether it is possible to achieve this: by extruding the surface, a rectangular plane can be extruded into a cuboid along the normal direction, and modifications can also be made through dragging, just like in some common 3D software.

I believe this is going to be a really fun thing!

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 26, 2025, 1:46pm UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/6 "2025-09-26T13:46:49Z")

</div>

Communicator is primarily a 3D viewer and visualization SDK for engineering and CAD-centric models. As such, it is not really a modelling application.

---

<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 26, 2025, 2:02pm UTC](https://forum.techsoft3d.com/t/how-to-use-the-api-coneelement-or-cylinderelement-to-create-some-cone-or-cylinder-esc/4917/7 "2025-09-26T14:02:55Z")

</div>

OK. Thank you very much for your help! Let me have a deeper understanding of the “communicator” concept.  
Welcome to China for an exploration trip!
