# How to make a cuboid tube between two points

**URL:** <https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555>\
**Category:** Community\
**Tags:** segmentation\
**Created:** [January 16, 2021, 3:17pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555 "2021-01-16T15:17:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)\
**Post date:** [January 16, 2021, 3:17pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555/1 "2021-01-16T15:17:05Z")

</div>

When I use Segment Editor, I can make a tube through Draw tube, but what should I do if I need to make a cuboid tube between two points?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 16, 2021, 3:40pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555/2 "2021-01-16T15:40:00Z")

</div>

Can you draw a sketch of what exactly you would like to achieve?

---

<div class="post-metadata">

**Author:** ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)\
**Post date:** [January 16, 2021, 3:45pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555/3 "2021-01-16T15:45:59Z")

</div>

![u=1840670376,809413264&fm=11&gp=0](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/4/f/4fef8f2849c09602436d5f5581ab553feddfe9cd.jpeg) Like this tube，I need a cuboid,replace it

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 16, 2021, 3:59pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555/4 "2021-01-16T15:59:12Z")

</div>

There are many options how to achieve this. For example, using Markups to model module:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/0/e0c2e6f0bb3d0a6439b338e89b531f6d92f1e3ab.jpeg)

Would you prefer to draw a segmentation or just display a tool trajectory?

I’m just curious, Why do you need rectangular cross-section? All the drills, catheters, etc. have circular cross section.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [January 16, 2021, 4:24pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555/7 "2021-01-16T16:24:27Z")

</div>

All the tools for creating such tool guides fully automatically (using a small Python scripted module) is already available in Slicer.

To create a model, probably the easiest is to create the stick first, for example by running this command:

```python
slicer.modules.createmodels.logic().CreateCube(20,30,120)

```

then apply a transform to position it, and import it into the segmentation.

You can find examples for most operations in the [script repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository).

---

<div class="post-metadata">

**Author:** ![slicer365](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/slicer365/32/67549_2.png) [@slicer365](https://discourse.slicer.org/u/slicer365)\
**Post date:** [January 16, 2021, 4:28pm UTC](https://discourse.slicer.org/t/how-to-make-a-cuboid-tube-between-two-points/15555/8 "2021-01-16T16:28:18Z")

</div>

Thank you very much ,you have helped me solve the problem. 😊
