Function Repository Resource:

CuboidalFlange3D

Source Notebook

Represent a cuboid-like 3D object with protrusions

Contributed by: Jaroslav Kysela

ResourceFunction["CuboidalFlange3D"][]

represents a cube with one protrusion.

ResourceFunction["CuboidalFlange3D"][type]

represents a graphics object of type type with one protrusion.

ResourceFunction["CuboidalFlange3D"][type,frspec]

represents an object with front protrusions specified by frspec.

ResourceFunction["CuboidalFlange3D"][type,{spec1,spec2,}]

specifies protrusions for individual faces.

ResourceFunction["CuboidalFlange3D"][type,<|1spec1,2spec2,|>]

specifies protrusions for specific faces.

Details and Options

ResourceFunction["CuboidalFlange3D"] can be used in Graphics3D.
ResourceFunction["CuboidalFlange3D"] in general returns a (possibly large and nested) list of graphics primitives such as Cuboid or BSplineSurface that together constitute a flange.
ResourceFunction["CuboidalFlange3D"] is intended as a convenience function that allows for easy creation of composed cube-like graphics objects with textual labels. Its purpose is purely visual, and no computation with the output (such as RegionMeasure) is supported.
Graphics rendering is affected by directives such as FaceForm, Opacity, EdgeForm, and color.
The first argument specifies the shape and size of the main graphics object, the second argument specifies the position and shape of protrusions.
First argument can be of the following forms:
Automaticdefault shape is set to "Cuboid"
shapenamestring specifying the shape, see below
{shapename,hlen}specify half the length of the body (default is 1)
{shapename,hw,hlen}specify half the width and height (default is 1)
{shapename,hw,hh,hlen}specify half the heigth separately from the width (default is 1)
{shapename,hw,hh,hlen,pars}specify additional parameters such as rounding radii (if any exist)
Parameter shapename can be of the following forms:
"Cuboid"object given by Cuboid
"RoundedCuboid"object given by ResourceFunction["RoundedCuboid"]
"RoundedFrame3D"object given by ResourceFunction["RoundedFrame3D"]
"Empty"no object created
fun[hw,hh,hlen,pars]object generated by a pure function
For named shapes, the input parameters are checked for whether they lie in the allowed range. When a pure function is supplied, no parameter preprocessing is performed.
Second argument can be of the following forms:
numnumber of evenly distributed protrusions on the front face
posspeclist of protrusion positions specified in the plane of the front face
{posspec,shapespec}positions as well as the shape of the protrusions, see below
{spec1,spec2,}list of as many as six specifications for individual faces, each of which is of any of the forms in the previous lines
<|k1spec1,k2spec2,|>Association where keys specify the positions of faces to which the specifications apply
When the second argument is specified as an Association, it can be of two distinct forms:
<|num1spec1,num2spec2,|>specify faces based on their numerical index, e.g. <|3{2,"Cylinder"},55|> creates two cylindrical protrusions on the third face and five cuboidal protrusions on the fifth face
<|Leftspec1,Rightspec2,|>specify faces based on their relative position, the example above would correspond to <|Above{2,"Cylinder"},Right5|>
The position specification posspec for protrusions can have the following forms:
numnon-negative number of protrusions, evenly distributed on the face
{{x1,y1},{x2,y2},}list of Cartesian coordinates for individual protrusions
{{x1,y1,em1},{x2,y2,em2},}together with the position also specify for each protrusion how much it should protrude from the surface
The Cartesian coordinates are relative with 0 correspoding to the center, 1 for one corner of the main body, and -1 for the opposite corner. The third coordinate characterizes how much the protrusion sinks into the surface or protrudes from it.
The shape specification shapespec for protrusions follows exactly the shape specification for the main body with the only difference that the second parameter corresponds to the full length, not just half the length. The allowed shapes are, also, slightly different:
"Cylinder"object given by Cylinder
"RoundedCylinder"object given by ResourceFunction["RoundedCylinder"]
"Annulus3D"object given by ResourceFunction["Annulus3D"]
"RoundedAnnulus3D"object given by ResourceFunction["RoundedAnnulus3D"]
"Cuboid"object given by Cuboid
"RoundedCuboid"object given by ResourceFunction["RoundedCuboid"]
fun[hw,hh,hlen,pars]object generated by a pure function
The following full specifications for each shape are allowed:
{"Cylinder",rad,hlen}cylinder of half-length hlen and radius rad
{"RoundedCylinder",rad,hlen,rrad}rounded cylinder with rounding radius rrad
{"Annulus3D",rad,hlen,inrad}3D annulus with inner radius inrad
{"RoundedAnnulus3D",rad,hlen,inrad,rrad}rounded 3D annulus with inner radius inrad and rounding radius rrad
{"Empty",hx,hy,hz}empty cuboid-like object of given dimensions
{"Cuboid",hx,hy,hz}cuboid with half-width hx, half-depth hy, and half-length hz
{"RoundedCuboid",hx,hy,hz,rrad}rounded cuboid with rounding radius rrad
{"RoundedFrame3D",hx,hy,hz,tx,ty,rrad}rounded 3D frame with thicknesses tx and ty, and with rounding radius rrad
When only a partial shape specification is given, default values are used instead. The default value for hx, hy, and hz is 1 for the main body and 0.1 for protrusions. Additional parameters are dynamically calculated from the values of hx, hy, and hz (if not supplied explicitly). The thicknesses tx and ty for "RoundedFrame3D" are set to 0.3hx and 0.3hy, respectively. The inner radius inrad and rounding radius rrad are set to 0.5hx and 0.01hx, respectively. For "Cylinder", "RoundedCylinder", "Annulus3D", and "RoundedAnnulus3D" rad is set to hx, while hlen is set to hz. Also, for protrusions the value of hz (or hlen) corresponds to the entire length, whereas for the main body it is only half the length.
The following options can be given:
"Label"Nonetextual label(s) on the main object
RasterSize200raster size of each label
"RotateProtrusions"Automaticwhether to rotate the protrusions
Textual labels specified by "Label" are represented as rasterized images wrapped in Texture that spans a Polygon.
The "Label" setting can have the following forms:
None | Automaticno label
"SomeText…"textual label on the front face
Style[stylespec]text wrapped in Style
{textspec,scale}specify also a scale (default scale is 1)
{textspec,scale,orientation}specify orientation (can be any real number, default is 0)
{labspec1,labspec2,}specify labels for individual faces, not just the front face
<|k1labspec1,k2labspec2,|>specify for specific faces, the form of keys is the same as for protrusions
The RasterSize setting can have the following forms:
numthe same size for all labels
{num1,num2,}specify sizes for each label
<|k1num1,k2num2,|>specify sizes for specific labels, the form of keys is the same as for protrusions
The "RotateProtrusions" setting can have the following forms:
True|Falsespecify whether the protrusions are rotated for all faces
Automaticequivalent to False for types "Cylinder", "RoundedCylinder", "Annulus3D", and "RoundedAnnulus3D", and to True otherwise (default)
{rotspec1,rotspec2,}specify individually for each face
<|k1rotspec1,k2rotspec2,|>specify for specific faces, the form of keys is the same as for protrusions
When "RotateProtrusions" is active, the protrusions for a given face are rotated in such a way that they point to the center of the face.

Examples

Basic Examples (5) 

Flange with four "rivets":

In[1]:=
Graphics3D[
 ResourceFunction[
  "CuboidalFlange3D"][{"RoundedFrame3D", 0.2}, {{0.8, 0.8}, {0.8, -0.8}, {-0.8, 0.8}, {-0.8, -0.8}}]]
Out[1]=

Cuboid with a "button":

In[2]:=
Graphics3D[ResourceFunction["CuboidalFlange3D"]["Cuboid", 1]]
Out[2]=

Dice with numbered faces:

In[3]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"][{"Cuboid", 1, 1, 1}, 0, "Label" -> ToString /@ Range[6]]}]
Out[3]=

3D frame with a textual label:

In[4]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"]["RoundedFrame3D", 0, "Label" -> <|3 -> "No. 5"|>]]
Out[4]=

Customize the shapes:

In[5]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"][
   Ball[{0, 0, 0}, #2] &, {CirclePoints[0.5, 3], {Cone[{{0, 0, -0.5}, {0, 0, #3}}, #1] &, 0.2, 0.2, 1}}]}]
Out[5]=

Scope (17) 

Main body (6) 

By default, create a cuboid with one protrusion:

In[6]:=
Graphics3D[ResourceFunction["CuboidalFlange3D"][]]
Out[6]=

Specify the shape of the body:

In[7]:=
Graphics3D[ResourceFunction["CuboidalFlange3D"][#], PlotLabel -> #] & /@ {"Cuboid", "RoundedCuboid", "RoundedFrame3D"}
Out[7]=

Supply custom-made pure function to define the shape:

In[8]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][
  Cone[{{0, 0, 0}, {0, 0, #2}}, #1] &]]
Out[8]=

"Turn off" the body and keep only the protrusions:

In[9]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"]["Empty", {1, 1, 5, 5, 5, 5}]]
Out[9]=

Specify the length, width, and height of the body:

In[10]:=
{len, w, h} = {2, 1, 3};
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][{"Cuboid", w, h, len}]]
Out[11]=

Specify additional parameters such as the rounding radius:

In[12]:=
Graphics3D[
 ResourceFunction[
  "CuboidalFlange3D"][{"RoundedCuboid", 2, 1, 3, 0.3}]]
Out[12]=

Protrusions (11) 

Specify the number of protrusions:

In[13]:=
Graphics3D[ResourceFunction["CuboidalFlange3D"][Automatic, 3]]
Out[13]=

Instead of the number, specify the relative Cartesian coordinates in the plane of the base:

In[14]:=
{
 Graphics3D[
  ResourceFunction["CuboidalFlange3D"][
   Automatic, {{1, 0}, {0, 0}, {-1, 0}}], PlotLabel -> "Different relative x-coordinates"],
 Graphics3D[
  ResourceFunction["CuboidalFlange3D"][
   Automatic, {{0, 1}, {0, 0}, {0, -1}}], PlotLabel -> "Different relative y-coordinates"],
 Graphics3D[
  ResourceFunction["CuboidalFlange3D"][
   Automatic, {{1, 1}, {0.5, -0.5}, {-0.5, -0.5}, {-1, 1}}], PlotLabel -> "Different x- and y-coordinates"]
 }
Out[14]=

Optional third coordinate specifies how the protrusion sinks into the base:

In[15]:=
Graphics3D[
 ResourceFunction[
  "CuboidalFlange3D"][{"Cuboid", 1, 0.1}, {{-1, 0, 0.1}, {-0.5, 0, 0.05}, {0, 0, 0}, {0.5, 0, -0.05}, {1, 0, -0.1}}], ViewPoint -> Front, ViewProjection -> "Orthographic"]
Out[15]=

Specify the shape of the protrusions:

In[16]:=
Graphics3D[ResourceFunction["CuboidalFlange3D"][Automatic, {5, #}], PlotLabel -> #] & /@ {"Cylinder", "RoundedCylinder", "Annulus3D", "RoundedAnnulus3D", "Cuboid", "RoundedCuboid"}
Out[16]=

Custom-made shape supplied as a pure function:

In[17]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][
  Automatic, {5, Cone[{{0, 0, 0}, {0, 0, #2}}, #1] &}]]
Out[17]=

Specify the length, width, height, and additional parameters of protrusions the exact same way as for the main body:

In[18]:=
Graphics3D[{ResourceFunction[
   "CuboidalFlange3D"][{"RoundedCuboid", 0.2}, {5, {"RoundedCylinder", 0.1, 0.5, 0.08}}]}]
Out[18]=

The coordinates and the detailed shape specification can be supplied simultaneously:

In[19]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][
  Automatic, {{{-0.5, -0.2, 0}, {0.8, 0.6, -0.2}, {0.8, -0.3, 0.5}}, {"RoundedCylinder", 0.3, 1, 0.05}}]]
Out[19]=

Specify protrusions for the bottom face:

In[20]:=
Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"]["Cuboid", {0, 5}]}]
Out[20]=

Specify protrusions for all the faces:

In[21]:=
Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"]["Cuboid", {1, 2, 3, 4, 5, 6}]}]
Out[21]=

Set protrusions only for the "fourth" face using three equivalent ways:

In[22]:=
{
 Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"][
    "Cuboid", {0, 0, 0, 2, 0, 0}]}],
 Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"]["Cuboid", <|4 -> 2|>]}],
 Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"]["Cuboid", <|Right -> 2|>]}]
 }
Out[22]=

Specify protrusions for multiple faces:

In[23]:=
Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"][
   "Cuboid", <|Below -> 2, Above -> {3, "RoundedAnnulus3D"}, Front -> {{{-0.5, 0.3}}, "Annulus3D"}|>]}]
Out[23]=

Options (12) 

Label (7) 

Add a textual label to the body:

In[24]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"]["RoundedCuboid", 0, "Label" -> "Some text"]}]
Out[24]=

Add styling:

In[25]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"]["RoundedCuboid", 0, "Label" -> Style[Column[{"Some text", "Second line"}, Alignment -> Center], FontColor -> Blue, FontFamily -> "Arial"]]}]
Out[25]=

Modify the size as well as the rotation of the label:

In[26]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"]["RoundedCuboid", 0, "Label" -> {"Some text", 0.3, \[Pi]/4}]}]
Out[26]=

The default size of the rotated label is automatically adjusted to fit into the face:

In[27]:=
Table[Graphics3D[
  ResourceFunction["CuboidalFlange3D"][{"Cuboid", 0.8, 1.5, 0.5}, 0, "Label" -> {"Long label", 1, \[Alpha]}], ViewPoint -> Above], {\[Alpha], 0, \[Pi]/2, \[Pi]/8}]
Out[27]=

Specify labels for other faces using either a List of an Association:

In[28]:=
{
 Graphics3D[{ResourceFunction["CuboidalFlange3D"]["RoundedCuboid", 0, "Label" -> {Style["Some text", Red], None, {"More text", 1.2}}]}],
 Graphics3D[{ResourceFunction["CuboidalFlange3D"]["RoundedCuboid", 0, "Label" -> <|1 -> Style["Some text", Red], 3 -> {"More text", 1.2}|>]}]
 }
Out[28]=

Use symbolic names:

In[29]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][{"Cuboid", 1, 1, 1}, 0, "Label" -> <|Above -> "Above", Below -> "Below", Right -> "Right", Left -> "Left", Front -> "Front", Back -> "Back"|>], Axes -> True]
Out[29]=

The names are aligned with the "eponymous" ViewPoint settings:

In[30]:=
obj = ResourceFunction["CuboidalFlange3D"][{"Cuboid", 1, 1, 1}, 0, "Label" -> <|Above -> "Above", Below -> "Below", Right -> "Right", Left -> "Left", Front -> "Front", Back -> "Back"|>];
Manipulate[
 Graphics3D[obj, ViewPoint -> vp], {{vp, Front, "ViewPoint"}, {Front, Back, Right, Left, Above, Below}, ControlType -> Setter}]
Out[6]=

RasterSize (2) 

Adjust the raster size for all labels:

In[31]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][Automatic, 0, "Label" -> ToString /@ CharacterRange["A", "F"], RasterSize -> 10]]
Out[31]=

Adjust each label separately, Association is also supported:

In[32]:=
{
 Graphics3D[
  ResourceFunction["CuboidalFlange3D"][Automatic, 0, "Label" -> {"A", None, "C", "D"}, RasterSize -> {5, 1, 20}]],
 Graphics3D[
  ResourceFunction["CuboidalFlange3D"][Automatic, 0, "Label" -> {"A", None, "C", "D"}, RasterSize -> <|1 -> 5, 3 -> 20|>]]
 }
Out[32]=

RotateProtrusions (3) 

By default, the protrusions are rotated such that they point towards the face center:

In[33]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][
  Automatic, {CirclePoints[0.8, 5], "Cuboid"}]]
Out[33]=

Turn the automatic rotation off:

In[34]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][
  Automatic, {CirclePoints[0.8, 5], "Cuboid"}, "RotateProtrusions" -> False]]
Out[34]=

Address individual faces separately:

In[35]:=
Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"][
   Automatic, {{CirclePoints[0.8, 5], "Cuboid"}, {CirclePoints[0.8, 5], "Cuboid"}}, "RotateProtrusions" -> {False, True}]}]
Out[35]=

Specification with Association is supported and follows closely the one for protrusions:

In[36]:=
Graphics3D[{Opacity[0.5], ResourceFunction["CuboidalFlange3D"][
   Automatic, {{CirclePoints[0.8, 5], "Cuboid"}, {CirclePoints[0.8, 5], "Cuboid"}}, "RotateProtrusions" -> <|1 -> False, 2 -> True|>]}]
Out[36]=

Applications (5) 

Simple model of a camera:

In[37]:=
Graphics3D[{Red, ResourceFunction[
   "CuboidalFlange3D"][{"RoundedCuboid", 2, 2, 1, 0.1}, {1, {"RoundedAnnulus3D", 1.4, 0.6, 1, 0.1}}, "Label" -> <|5 -> {"Camera", 1, \[Pi]}, 6 -> {"Model no. 5", 0.6}|>], Black, ResourceFunction[
   "CuboidalFlange3D"][{"Empty", 2, 2, 1}, {1, {"Cylinder", 1, 0.5}}]}, Boxed -> False, ViewPoint -> {-2.28, 1.73, 1.80}, ViewVertical -> {-0.058, 0.99, 0.12}]
Out[37]=

Simple model of a control panel:

In[38]:=
i = 1;
pos = Subdivide[-1, 1, 5 + 1][[2 ;;]];
leds = Table[{Opacity[0.5, col], ResourceFunction[
     "CuboidalFlange3D"][{"Empty", 4, 2, 1}, {{{pos[[i++]], 0, 0.1}}, {"RoundedCylinder", 0.4, 0.6, 0.2}}]}, {col, {Red, Orange, Yellow, Green, Blue}}];
Graphics3D[{Gray, ResourceFunction[
   "CuboidalFlange3D"][{"RoundedCuboid", 4, 2, 1, 0.08}, {5, {"RoundedAnnulus3D", 0.6, 0.5, 0.4, 0.09}}], leds}, Boxed -> False, Lighting -> "Neutral"]
Out[39]=

Water tank with rivets:

In[40]:=
coords = Subdivide[-1, 1, 10 + 1][[2 ;; -2]];
offset = Last[coords];
coords = Join[Table[{-offset, y}, {y, coords}], Table[{offset, y}, {y, coords}], Table[{x, -offset}, {x, coords}], Table[{x, offset}, {x, coords}]];
rivets = {coords, {Ball[{0, 0, 0}, #2] &, 0.1, 0.1, 0.09}};
Graphics3D[{Gray, ResourceFunction[
   "CuboidalFlange3D"][{"RoundedCuboid", 3, 2.5, 2.5, 0.05}, {rivets, rivets, rivets, rivets, rivets, rivets}]}, Boxed -> False]
Out[41]=

Cage:

In[42]:=
coords = Subdivide[-1, 1, 7][[2 ;; -2]];
offset = Last[coords];
coords = Join[Table[{-offset, y}, {y, coords}], Table[{offset, y}, {y, coords}], Table[{x, -offset}, {x, coords}], Table[{x, offset}, {x, coords}]];
Graphics3D[{Gray, ResourceFunction[
   "CuboidalFlange3D"][{"Cuboid", 1, 1, 0.1}, {coords, {"Cylinder", 0.05, 2}}], Translate[
   ResourceFunction["CuboidalFlange3D"][{"Cuboid", 1, 1, 0.1}, 0], {0,
     0, 2.1}]}]
Out[43]=

Star:

In[44]:=
Graphics3D[
 ResourceFunction["CuboidalFlange3D"][{"Empty", 1, 1, 1}, Table[{1, {Cone[{{0, 0, 0}, {0, 0, #3}}, #1] &, 3, 10}}, 6]], Axes -> True]
Out[44]=

Properties and Relations (2) 

Multiple flanges can be composed to create more complex objects:

In[45]:=
Graphics3D[{Orange, ResourceFunction[
   "CuboidalFlange3D"][{"RoundedCuboid", 1, 1, 0.5, 0.05}, {1, {"RoundedAnnulus3D", 0.8, 0.2, 0.6}}, "Label" -> <|5 -> {"Part no. 5", 0.8, \[Pi]}|>],
  Black, ResourceFunction[
   "CuboidalFlange3D"][{"Empty", 1, 1, 0.5}, {1, {"Cylinder", 0.6, 0.18}}], Opacity[0.5, Orange], ResourceFunction[
   "CuboidalFlange3D"][{"Empty", 1, 1, 0.5}, {1, {"RoundedAnnulus3D", 0.5, 0.3, 0.2}}]}, ViewPoint -> {-2.37, 1.57, 1.82}, ViewVertical -> {-0.12, 0.98, 0.12}]
Out[45]=

Text wrapped around a rectangular surface:

In[46]:=
sc = 1.2;
Graphics3D[{ResourceFunction["CuboidalFlange3D"][{"Empty", 1, 1, 1}, 0, "Label" -> {None, None, {"This is some text", sc}, {"that continues here", sc}, {"and also here...", sc}, {"and finally ends here", sc}}]}]
Out[47]=

Possible Issues (4) 

The length parameter for the body is half the resulting length, but not so for the protrusions:

In[48]:=
len = 2;
Graphics3D[
 ResourceFunction[
  "CuboidalFlange3D"][{"Cuboid", len}, {1, {"Cylinder", len}}], Axes -> True]
Out[49]=

The textual label may contain rasterization artifacts:

In[50]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"]["Cuboid", 0, "Label" -> "SomeText", RasterSize -> 5]}, PlotLabel -> "RasterSize\[Rule]5"]
Out[50]=

Increase the rasterization rate of the label:

In[51]:=
Graphics3D[{ResourceFunction["CuboidalFlange3D"]["Cuboid", 0, "Label" -> "SomeText", RasterSize -> 100]}, PlotLabel -> "RasterSize\[Rule]100"]
Out[51]=

Custom shapes have to be supplied as pure functions, i.e. with head Function:

In[52]:=
ClearAll[thorn]
thorn[rad_, y_, len_] := Cone[{{0, 0, 0}, {0, 0, len}}, rad] &
Graphics3D[{ResourceFunction["CuboidalFlange3D"][
   "Cuboid", {3, {thorn, 0.1, 0.1, 0.8}}]}]
Out[36]=
In[53]:=
ClearAll[thorn]
thorn = Cone[{{0, 0, 0}, {0, 0, #3}}, #1] &;
Graphics3D[{ResourceFunction["CuboidalFlange3D"][
   "Cuboid", {3, {thorn, 0.1, 0.1, 0.8}}]}]
Out[54]=

When two parameters {w,l} are supplied, they are internally expanded into {w,w,l} and the form of Function has to reflect it:

In[55]:=
{
 Graphics3D[{ResourceFunction["CuboidalFlange3D"][
    "Cuboid", {3, {Cone[{{0, 0, 0}, {0, 0, #3}}, #1] &, 0.098, 1.23}}]}, PlotLabel -> "Thorn length set to 1.23"],
 Graphics3D[{ResourceFunction["CuboidalFlange3D"][
    "Cuboid", {3, {Cone[{{0, 0, 0}, {0, 0, #2}}, #1] &, 0.098, 1.23}}]}, PlotLabel -> "Thorn length set to 0.098"]
 }
Out[55]=

Neat Examples (1) 

3D art:

In[56]:=
coords = Subdivide[-0.9, 0.9, 15][[2 ;; -2]];
offset = Last[coords];
coords = Join[Table[{-offset, y}, {y, coords}], Table[{offset, y}, {y, coords}], Table[{x, -offset}, {x, coords}], Table[{x, offset}, {x, coords}]];
Graphics3D[{{Opacity[0.5], ResourceFunction["CuboidalFlange3D"][{"Cuboid", 5, 5, 5}, 0]}, ResourceFunction["CuboidalFlange3D"][{"Empty", 5, 5, 5}, Table[{coords, {"Cuboid", 0.1, 1, 0.1}}, 6]]}]
Out[57]=
In[58]:=
funProtrusion[len_, w_, h_, pars___] := Rotate[ResourceFunction["RoundedFrame3D"][{w, h, len}, {pars[[1]], pars[[2]]}, RoundingRadius -> pars[[3]]], pars[[4]], {1, 0, 0}]
protsfun[
   rot_] := {CirclePoints[0.8, 15], {funProtrusion[##] &, 0.5, 0.4, 0.4, 0.1, 0.1, 0.01, rot}};
Graphics3D[
   ResourceFunction["CuboidalFlange3D"][{"Empty", 1, 1, 1}, Table[protsfun[#], 6]]] & /@ {0, \[Pi]/4, \[Pi]/2}
In[59]:=

Publisher

Jaroslav Kysela

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 26 June 2023

Related Resources

Author Notes

A possible improvement could be the introduction of the fourth coordinate to the specification of protrusions, which "coordinate" would specify the relative rotation of the given protrusion w.r.t. to its angular position.

License Information