How do I draw a box with holes?

The name of the pictureThe name of the pictureThe name of the pictureClash 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]]


Mathematica graphics










share|improve this question



























    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]]


    Mathematica graphics










    share|improve this question

























      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]]


      Mathematica graphics










      share|improve this question















      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]]


      Mathematica graphics







      graphics






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 17 at 10:14









      C. E.

      47.7k391193




      47.7k391193










      asked Aug 17 at 9:59









      mattiav27

      2,03011428




      2,03011428




















          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]


          enter image description here






          share|improve this answer





























            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]
            ]


            enter image description here






            share|improve this answer






















              Your Answer




              StackExchange.ifUsing("editor", function ()
              return StackExchange.using("mathjaxEditing", function ()
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
              );
              );
              , "mathjax-editing");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "387"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              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






























              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]


              enter image description here






              share|improve this answer


























                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]


                enter image description here






                share|improve this answer
























                  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]


                  enter image description here






                  share|improve this answer














                  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]


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 17 at 17:25

























                  answered Aug 17 at 10:14









                  David G. Stork

                  21.5k11646




                  21.5k11646




















                      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]
                      ]


                      enter image description here






                      share|improve this answer


























                        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]
                        ]


                        enter image description here






                        share|improve this answer
























                          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]
                          ]


                          enter image description here






                          share|improve this answer














                          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]
                          ]


                          enter image description here







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Aug 17 at 10:37

























                          answered Aug 17 at 10:29









                          chyanog

                          6,76921545




                          6,76921545



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              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













































































                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Displaying single band from multi-band raster using QGIS

                              How many registers does an x86_64 CPU actually have?