@@ -24,7 +24,7 @@ Generate a [Solid](@ref) with physical behavior of a rigid body with mass, visua
24
24
computed from `shape` and `solidMaterial`. It is also possible to define only the mass of the solid and compute the
25
25
center of mass and inertia tensor from `shape` (e.g. `MassPropertiesFromShapeAndMass(mass=4.5)`) or explicitly
26
26
define all mass properties (e.g. `MassProperties(mass=4.5, centerOfMass=[1.0,2.0,3.0], Ixx=4.0, Iyy=5.0, Izz=6.0,
27
- Ixy=4.5, Ixz=4.6, Iyz=5.5)`).
27
+ Ixy=4.5, Ixz=4.6, Iyz=5.5)`).
28
28
29
29
- `collision`: Defines if the solid is considered in [Collision Handling](@ref). `collision=true` requires definition
30
30
of `shape`, mass properties (defined by `solidMaterial` or `massProperties`) and contact material (defined by
@@ -105,20 +105,25 @@ struct Solid{F <: Modia3D.VarFloatType} <: Modia3D.AbstractObject3DFeature
105
105
contactMaterial = " "
106
106
end
107
107
108
+ if typeof (solidMaterial) == String && solidMaterial == " "
109
+ solidMaterial = nothing
110
+ end
111
+
108
112
if typeof (solidMaterial) == String
109
113
solidMaterial = solidMaterialPalette[1 ][solidMaterial]
110
114
end
111
115
112
- if typeof (visualMaterial) == String
113
- visualMaterial = Shapes. visualMaterialPalette[visualMaterial]
116
+ if typeof (visualMaterial) == String
117
+ visualMaterial = visualMaterial == " " ? Shapes . VisualMaterial () : Shapes. visualMaterialPalette[visualMaterial]
114
118
end
115
119
116
120
if typeof (shape) == FileMesh
117
121
(shape. centroid, shape. shortestEdge, shape. longestEdge, shape. objPoints, shape. facesIndizes) = getMeshInfos (shape. filename, shape. scaleFactor)
118
122
(shape. volume, shape. centroidAlgo, shape. inertia) = computeMassProperties (shape. objPoints, shape. facesIndizes; bodyCoords= false )
119
123
end
120
124
121
- massProperties = createMassProperties (F, massProperties, shape, solidMaterial)
125
+ massProperties = isnothing (massProperties) && isnothing (solidMaterial) ? MassProperties {F} () : createMassProperties (F, massProperties, shape, solidMaterial)
126
+
122
127
contactSphereRadius:: Union{Nothing,F} = isnothing (contactSphereRadius) || F (contactSphereRadius) <= F (0 ) ? nothing : F (contactSphereRadius)
123
128
(isFlat, contactSphereRadius) = setContactSphereRadius (shape, contactSphereRadius, F)
124
129
new (shape, solidMaterial, massProperties, collision, contactMaterial, setCollisionSmoothingRadius (shape, F (collisionSmoothingRadius)), visualMaterial, isFlat, contactSphereRadius)
0 commit comments