# Shapes 3D Library: can't get stroke function to work for any shapes

**URL:** <https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531>\
**Category:** Libraries\
**Tags:** homework\
**Created:** [May 30, 2018, 10:40am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531 "2018-05-30T10:40:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_ther](https://avatars.discourse-cdn.com/v4/letter/_/898d66/32.png) [@\_ther](https://discourse.processing.org/u/_ther)\
**Post date:** [May 30, 2018, 10:40am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/1 "2018-05-30T10:40:18Z")

</div>

according to [Shapes 3D Box - Stroke Documentation](http://www.lagers.org.uk/s3d4p/ref/classshapes3d_1_1_box.html#a8eb8224d91f364dc95e06f9d4f7680ea) i am attempting to add stroke to my box correctly, any of the other functions that I try are working (e.g. the .fill()) but not stroke. i want to be able to have no fill but still have the wireframe of the object showing on screen. Any help?

```auto
Box test = new Box(this, 300);
test.stroke(255);
test.strokeWeight(10);
test.fill(color(255,0,0));
test.draw();

```

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [May 30, 2018, 11:57am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/2 "2018-05-30T11:57:03Z")

</div>

You must set the draw mode e.g.

```auto
// Show surfaces and edges
test.drawMode(Shape3D.SOLID | Shape3D.WIRE);

```

You can also use `Shape3D.TEXTURE` if you are using images as textures.

---

<div class="post-metadata">

**Author:** ![\_ther](https://avatars.discourse-cdn.com/v4/letter/_/898d66/32.png) [@\_ther](https://discourse.processing.org/u/_ther)\
**Post date:** [June 1, 2018, 2:11am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/3 "2018-06-01T02:11:10Z")

</div>

**Thank you!!!** time to finish my assignment 🙂

---

<div class="post-metadata">

**Author:** ![\_ther](https://avatars.discourse-cdn.com/v4/letter/_/898d66/32.png) [@\_ther](https://discourse.processing.org/u/_ther)\
**Post date:** [June 1, 2018, 6:04am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/4 "2018-06-01T06:04:59Z")

</div>

would you happen to know how i can get the color of an object? in the simplest form,

i.e.

```auto
//something like this?
color c = test.shape;

```

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [June 1, 2018, 11:08am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/5 "2018-06-01T11:08:58Z")

</div>

`color c = text.fill();`

This will work with all shapes **_except_** Box because a box can have 6 different colour (one for each face) so it wouldn’t know which one to return.

---

<div class="post-metadata">

**Author:** ![\_ther](https://avatars.discourse-cdn.com/v4/letter/_/898d66/32.png) [@\_ther](https://discourse.processing.org/u/_ther)\
**Post date:** [June 1, 2018, 5:56am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/6 "2018-06-01T05:56:35Z")

</div>

```auto
Box test = new Box(this, 300);
test.stroke(255);
test.drawMode(Shape3D.SOLID);
test.draw();

// this is where I'm stuck
color c = test.getColor();

```

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [June 1, 2018, 11:14am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/7 "2018-06-01T11:14:22Z")

</div>

You have already asked this question so go **[here](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/5)** to see my answer.

---

<div class="post-metadata">

**Author:** ![\_ther](https://avatars.discourse-cdn.com/v4/letter/_/898d66/32.png) [@\_ther](https://discourse.processing.org/u/_ther)\
**Post date:** [June 5, 2018, 2:09am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/8 "2018-06-05T02:09:17Z")

</div>

One more question!  
How can I get the type of an object?  
i.e…

```auto
if (testObject.type == Box){
  //do something
} else if (testObject.type == Cone){
  //do something different
}

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 5, 2018, 10:49am UTC](https://discourse.processing.org/t/shapes-3d-library-cant-get-stroke-function-to-work-for-any-shapes/531/9 "2018-06-05T10:49:51Z")

</div>

You may try out the operator `instanceof`: 🤔  
`if (testObject instanceof Box) { }`
