How do I draw a box with holes?
Clash Royale CLAN TAG#URR8PPP
up vote
7
down vote
favorite
1
How do I draw a box with six cylindrical holes, one at the center of each face?
The code for the box:
pts = -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5;
pts3 = ScalingTransform[6, 6, 6][pts];
pts4 = ScalingTransform[7, 7, 7][pts];
hex = 2, 3, 4, 1, 1, 4, 8, 5, 4, 3, 7, 8, 3, 2, 6, 7, 2, 1,
5, 6, 5, 8, 7, 6;
box = BoundaryMeshRegion[Join[pts3, pts4], Polygon[hex],
Polygon[hex + 8], MeshCellStyle -> Opacity[0.2]]
graphics
add a comment |Â
up vote
7
down vote
favorite
1
How do I draw a box with six cylindrical holes, one at the center of each face?
The code for the box:
pts = -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5;
pts3 = ScalingTransform[6, 6, 6][pts];
pts4 = ScalingTransform[7, 7, 7][pts];
hex = 2, 3, 4, 1, 1, 4, 8, 5, 4, 3, 7, 8, 3, 2, 6, 7, 2, 1,
5, 6, 5, 8, 7, 6;
box = BoundaryMeshRegion[Join[pts3, pts4], Polygon[hex],
Polygon[hex + 8], MeshCellStyle -> Opacity[0.2]]
graphics
add a comment |Â
up vote
7
down vote
favorite
1
up vote
7
down vote
favorite
1
1
How do I draw a box with six cylindrical holes, one at the center of each face?
The code for the box:
pts = -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5;
pts3 = ScalingTransform[6, 6, 6][pts];
pts4 = ScalingTransform[7, 7, 7][pts];
hex = 2, 3, 4, 1, 1, 4, 8, 5, 4, 3, 7, 8, 3, 2, 6, 7, 2, 1,
5, 6, 5, 8, 7, 6;
box = BoundaryMeshRegion[Join[pts3, pts4], Polygon[hex],
Polygon[hex + 8], MeshCellStyle -> Opacity[0.2]]
graphics
How do I draw a box with six cylindrical holes, one at the center of each face?
The code for the box:
pts = -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5,
0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5;
pts3 = ScalingTransform[6, 6, 6][pts];
pts4 = ScalingTransform[7, 7, 7][pts];
hex = 2, 3, 4, 1, 1, 4, 8, 5, 4, 3, 7, 8, 3, 2, 6, 7, 2, 1,
5, 6, 5, 8, 7, 6;
box = BoundaryMeshRegion[Join[pts3, pts4], Polygon[hex],
Polygon[hex + 8], MeshCellStyle -> Opacity[0.2]]
graphics
graphics
edited Aug 17 at 10:14
C. E.
47.7k391193
47.7k391193
asked Aug 17 at 9:59
mattiav27
2,03011428
2,03011428
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
9
down vote
accepted
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[Cylinder[0, .5, .5, 1, .5, .5, 1/8],
Cylinder[.5, 0, .5, .5, 1, .5, 1/8],
Cylinder[.5, .5, 0, .5, .5, 1, 1/8]]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False
]
or... just a bit crisper:
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[
Cylinder[#, 1/8] & /@
0, .5, .5, 1, .5, .5,
.5, 0, .5, .5, 1, .5,
.5, .5, 0, .5, .5, 1]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False]
add a comment |Â
up vote
11
down vote
RegionPlot3D[x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1,
Mesh -> None, Boxed -> False, Axes -> False,
PlotStyle -> Opacity[0.8],
PlotPoints -> 50
]
or
BoundaryDiscretizeRegion[
ImplicitRegion[
x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1
],
MaxCellMeasure -> 0.001, BaseStyle -> Opacity[0.8]
]
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
9
down vote
accepted
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[Cylinder[0, .5, .5, 1, .5, .5, 1/8],
Cylinder[.5, 0, .5, .5, 1, .5, 1/8],
Cylinder[.5, .5, 0, .5, .5, 1, 1/8]]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False
]
or... just a bit crisper:
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[
Cylinder[#, 1/8] & /@
0, .5, .5, 1, .5, .5,
.5, 0, .5, .5, 1, .5,
.5, .5, 0, .5, .5, 1]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False]
add a comment |Â
up vote
9
down vote
accepted
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[Cylinder[0, .5, .5, 1, .5, .5, 1/8],
Cylinder[.5, 0, .5, .5, 1, .5, 1/8],
Cylinder[.5, .5, 0, .5, .5, 1, 1/8]]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False
]
or... just a bit crisper:
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[
Cylinder[#, 1/8] & /@
0, .5, .5, 1, .5, .5,
.5, 0, .5, .5, 1, .5,
.5, .5, 0, .5, .5, 1]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False]
add a comment |Â
up vote
9
down vote
accepted
up vote
9
down vote
accepted
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[Cylinder[0, .5, .5, 1, .5, .5, 1/8],
Cylinder[.5, 0, .5, .5, 1, .5, 1/8],
Cylinder[.5, .5, 0, .5, .5, 1, 1/8]]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False
]
or... just a bit crisper:
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[
Cylinder[#, 1/8] & /@
0, .5, .5, 1, .5, .5,
.5, 0, .5, .5, 1, .5,
.5, .5, 0, .5, .5, 1]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False]
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[Cylinder[0, .5, .5, 1, .5, .5, 1/8],
Cylinder[.5, 0, .5, .5, 1, .5, 1/8],
Cylinder[.5, .5, 0, .5, .5, 1, 1/8]]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False
]
or... just a bit crisper:
RegionPlot3D[
RegionDifference[Cuboid,
RegionUnion[
Cylinder[#, 1/8] & /@
0, .5, .5, 1, .5, .5,
.5, 0, .5, .5, 1, .5,
.5, .5, 0, .5, .5, 1]],
PlotPoints -> 200,
PlotStyle -> Opacity[0.7],
Boxed -> False]
edited Aug 17 at 17:25
answered Aug 17 at 10:14
David G. Stork
21.5k11646
21.5k11646
add a comment |Â
add a comment |Â
up vote
11
down vote
RegionPlot3D[x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1,
Mesh -> None, Boxed -> False, Axes -> False,
PlotStyle -> Opacity[0.8],
PlotPoints -> 50
]
or
BoundaryDiscretizeRegion[
ImplicitRegion[
x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1
],
MaxCellMeasure -> 0.001, BaseStyle -> Opacity[0.8]
]
add a comment |Â
up vote
11
down vote
RegionPlot3D[x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1,
Mesh -> None, Boxed -> False, Axes -> False,
PlotStyle -> Opacity[0.8],
PlotPoints -> 50
]
or
BoundaryDiscretizeRegion[
ImplicitRegion[
x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1
],
MaxCellMeasure -> 0.001, BaseStyle -> Opacity[0.8]
]
add a comment |Â
up vote
11
down vote
up vote
11
down vote
RegionPlot3D[x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1,
Mesh -> None, Boxed -> False, Axes -> False,
PlotStyle -> Opacity[0.8],
PlotPoints -> 50
]
or
BoundaryDiscretizeRegion[
ImplicitRegion[
x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1
],
MaxCellMeasure -> 0.001, BaseStyle -> Opacity[0.8]
]
RegionPlot3D[x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1,
Mesh -> None, Boxed -> False, Axes -> False,
PlotStyle -> Opacity[0.8],
PlotPoints -> 50
]
or
BoundaryDiscretizeRegion[
ImplicitRegion[
x^2 + y^2 > 1/16 && x^2 + z^2 > 1/16 && y^2 + z^2 > 1/16,
x, -1, 1, y, -1, 1, z, -1, 1
],
MaxCellMeasure -> 0.001, BaseStyle -> Opacity[0.8]
]
edited Aug 17 at 10:37
answered Aug 17 at 10:29
chyanog
6,76921545
6,76921545
add a comment |Â
add a comment |Â
Â
draft saved
draft discarded
Â
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f180161%2fhow-do-i-draw-a-box-with-holes%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password