ABSTRACT (original article): This study proposes an advanced algorithm for predicting the optimal orientation in human manikin 3D printing. We can print the manikin mesh data on any scale depending on the user’s needs. Once the 3D printing scale was determined, the manikin data were dissected based on the 3D printer’s maximal printing volume using our previous work. Then, we applied the newly proposed algorithm, designated as “per-pixel signed-shadow casting,” to each dissected manikin part to calculate the volumes of the object and the support structure. Our method classified the original mesh triangles into three groups—alpha, beta, and top-covering—to eliminate the need for special hardware such as graphic cards. The result is shown as a two-dimensional bitmap file, designated as “tomograph”. This tomograph represents the local support structure distribution information on a visual and quantitative basis. Repeating this tomography method for the three rotational axes resulted in a four-dimensional (4D) box-shaped graph. The optimal orientation of any arbitrary object is easily determined from the lowest-valued pixel in the 4D box graph. We applied this proposed method to several basic primitive shapes with different degrees of symmetry and complex shapes, such as the famous “Stanford Bunny”. Finally, the algorithm was applied to human manikins using several printing scales. The theoretical values were compared with those obtained from analytical or g-code-based experimental volumes. CITATION (original article): Jung, J.Y., Chee, S. & Sul, I.H. Support structure tomography using per-pixel signed shadow casting in human manikin 3D printing. Fash Text 9, 21 (2022). https://doi.org/10.1186/s40691-022-00290-z

Introduction

Most 3D printers, except for the relatively expensive SLS type, need a support structure (SS) when the object’s inclination is more than a certain threshold angle (a.k.a. filment critical angle,
θ
c
). The more SS means the more printing time and filament usage. Fortunately, the volume of SS (
V
ss
) can be minimized by choosing a proper printing direction (object’s 3D orientation, designated as (yaw, pitch, roll) in this work). This work voxelized the input mesh to find the amount of SS of a given orientation. Repeating the following procedure, varying the orientation, can give the optimal orientation information.
Figure 1. support structure examples in the optimal (left) and worst (right) orientation of Stanford Bunny (image captured with Python 3)

Basic idea: Ezair et al.(2015)’s shadow casting

If
θ
c
is zero,
V
ss
can be simply thought of as a shadow volume created by a virtual sunlight and the target object (Figure 2d). Zero
θ
c
means that every inclination of the object needs SS. In this case,
V
ss
can be simply calculated by,
V
ss
=
V
tc
-
V
o
(
1
)
V
o
is the object’s volume, which is always constant regardless of the orientation.
V
tc
is the volume between the printer’s bottom and the object’s top-covering elements, which varies for each orientation. The simplest way to get
V
tc
is to use the graphic card’s visible surface test.
Figure 2. Ezair et al.’s shadow-casting based support structure calculation scheme (a) Target object, (b) Calculating top-cover volume (
V
tc
) using GPU, (c) calculating object volume (
V
o
), (d) final support structure volume

Our modified idea : per - pixel signed shadow casting

Unfortunately, the 3D printing filaments have non-zero (generally 45~60 degrees)
θ
c
values. It means that some parts of overhangs do not need a support structure. We designated them as Non-oVerhang (NV) pixels. Then Eq. (1) should be modified to a more general form, Eq. (2).
V
ss
=
V
tc
-
V
o
-
V
nv
=
V
tc
-
V
α
-
V
β
-
V
nv
(
2
)
In this case, the exact amount of Vss can be only known by pixel-wise ray-casting-like computation. We voxelized the object's mesh surface and stored their information as (X,Y,Z,
n
z
), where the first three correspond to coordinates of voxel’s center of mass and the last one to normal vector z-component of the mother triangular element. We called this data structure a "pixel" in this work. Each pixel was classified into several different groups; α pixel if the normal vector faces upwards (i.e.
n
z
> 0), β if downwards (
n
z
< 0), NV pixel if β pixel do not satisfy threshold condition (-sin
θ
c
<
n
z
< 0). And top-most pixels among the same (X,Y) position were classified as the Top-Covering (TC) pixel. Now integrating each pixel group's Z-coordinates can lead to the corresponding volume. The whole procedure is like Figure 3.
Figure 3. Implicit calculation of support structure volume (Vss)

Mathematica code example

(0) Internal Functions


(1) File loading and voxelization

Enter filename and orientation angle here
In[]:=
FileName="Bunny_1k.obj";​​{Yaw,Pitch,Roll}={0.Degree,0.Degree,0.Degree};
g - code options from slicing software (Default values were borrowed from those of Sindoh DP - 101 FDM - type printer)
In[]:=
T
clad
=1.;(*thicknessofwall(clad)[mm]*)​​
ρ
​
PLA
=0.001210;(*densityofPLAfilament[g/mm^3]*)​​{
F
clad
,
F
core
,
F
ss
}={1.0,0.15,0.20};(*Fillratioforclad,coreandSS*)​​
θ
c
(*criticalangleforsupportstructure*)=60.Degree;
Target mesh loading
In[]:=
ℳ=Import[FileNameJoin[{NotebookDirectory[],FileName}],"MeshRegion"];(*initialmesh,beforerotation*)

(2) Rotation, pixel group classification, and volume/mass calculation

Mesh rotation
In[]:=
ℛ=TransformedRegion[ℳ,Get4DMatrix[ℳ,Yaw,Pitch,Roll]];(*meshafterrotation.*)​​maxℛℬ=RegionBounds[ℛ];(*boundingboxofℛ.Shouldbesmallerthanthe3Dprinter'svolume*)
Voxelization step (time - consuming)
In[]:=
{
plist
α
,
plist
β
,
plist
tc
,
plist
nv
,normalVectors}=GetPxlGroups[ℛ,
θ
c
];(*pixelgroupsaftervoxelization*)​​
plist
vo
=GetVoPxls[
plist
α
,
plist
β
];(*eq.(1);
V
o
=
V
α
-Vβ*)​​
plist
ss
=GetVssPxls[
plist
β
,
plist
α
,
plist
tc
,
plist
nv
];(*eq.(2);
V
ss
=
V
β
-Vα+
V
tc
-
V
nv
*)
Calculate volumes
In[]:=
{
V
α
,
V
tc
,
V
β
,
V
nv
,
V
ss
}=Map[GetPxlVol,{
plist
α
,
plist
tc
,
plist
β
,
plist
nv
,
plist
ss
}];​​
V
o
(*objectvolume*)=
V
α
-
V
β
;
Split the object volume into core (inner volume) and clad (surface) to consider fill factor
In[]:=
A
clad
=Area/@MeshPrimitives[ℛ,2]//Total;(*objectsurfacearea*)​​
V
clad
=
A
clad
*
T
clad
;(*[mm^3]*)​​
V
core
=
V
o
-
V
clad
;
Calculate masses from the volume values
In[]:=
M
clad
(*objectwallmass,[g]*)=
V
clad
*
F
clad
*
ρ
​
PLA
;​​
M
core
(*objectinnermass,consideringfillfactor*)=
V
core
*
F
core
*
ρ
​
PLA
;​​
M
ss
(*suportstructuremass*)=
V
ss
*
F
ss
*
ρ
​
PLA
;​​
M
total
(*totalfilamentmassneededfor3Dprinting*)=
M
core
+
M
clad
+
M
ss
Out[]=
31.4153

(4) 3D Rendering (Optional)

Prepare graphs for each pixel list
{
g
α
,
g
β
,
g
tc
,
g
nv
}=Map[PlotPxls,{{
plist
α
,
color
α
},{
plist
β
,
color
β
},{
plist
tc
,
color
tc
},{
plist
nv
,
color
nv
}}];​​{
g
vo
,
g
ss
}=Map[PlotPxlsWithAxes,{{
plist
vo
,
color
vo
},{
plist
ss
,
color
ss
}}];​​
g
ℛ
=Show[Graphics3D[{EdgeForm[{White}],Opacity[0.3,White],ℛ}],AxesFalse,BoxedFalse,PlotRange->maxℛℬ];(*showtherotatedmesh*)
Show the graphs at a time
In[]:=
ManipulateShow[{f[[choice]]},BoxRatiosAutomatic],RowCheckboxBarDynamic[choice],1Style["α pixels",FontColor
color
α
],2Style["TC pixels",FontColor
color
tc
],3Style"β pixels",FontColor
color
β
,4Style["NV pixels",FontColor
color
nv
],5Style["Vo",FontColor
color
vo
],6Style["Vss",FontColor
color
ss
],7Style["target mesh",FontColorGray],Appearance"Horizontal",{{choice,{6,7}},None},ControlPlacementBottom,Initializationf={
g
α
,
g
tc
,
g
β
,
g
nv
,
g
vo
,
g
ss
,
g
ℛ
};,SaveDefinitions->True

Finding optimal orientation

Figure 4. optimal orientation search result for Standford Bunny (X,Y, and Z axes mean yaw, pitch, and roll values)

Bottom structure

The amount of bottom structure, such as skirt, brim, and raft, was omitted in this version for the simplicity’s sake. Please refer to our recent python version (https://github.com/cfms-lab/tomo_TSE2023).

Acknowledgement

This notebook was written with Mathematica 13.0.1. version. This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (No. 2019R1F1A1040883, No.2022R1A2C1010072).

CITE THIS NOTEBOOK

Support structure tomography using per-pixel signed shadow casting in human manikin 3D printing​
by Jin Young Jung, Seonkoo Chee & In Hwan Sul​
Wolfram Community, STAFF PICKS, May 21, 2024
​https://community.wolfram.com/groups/-/m/t/3180028