@@ -127,6 +127,11 @@ include(joinpath(Modia3D.path, "src", "contactDetection", "ContactDetectionMPR",
127127
128128# -------------------------------------- Gravity field ----------------------------------
129129
130+ """
131+ gravityField = NoGravityField()
132+
133+ Generate an instance of type `NoGravityField` that defines no gravity.
134+ """
130135struct NoGravityField <: Modia3D.AbstractGravityField
131136 gvec:: SVector{3,Float64} # [m/s^2] Vector of gravity acceleration
132137 NoGravityField () = new (SVector {3,Float64} (0.0 , 0.0 , 0.0 ))
@@ -169,7 +174,7 @@ const EarthRadius = 6.3781e6 # [m] Radius of earth (https://en.wik
169174
170175
171176"""
172- PointGravityField(mass), PointGravityField( ;mue=G*EarthMass)
177+ PointGravityField([ mass| ;mue=G*EarthMass] )
173178
174179Return a PointGravityField struct with the gravity field constant mue (mue = G*mass).
175180
@@ -202,6 +207,86 @@ gravityAcceleration(grav::PointGravityField, r_abs::AbstractVector) = -(grav.mue
202207
203208# -------------------------------------- Global Scene Options -------------------------------
204209
210+ """
211+ sceneOptions = Modia3D.SceneOptions(;kwargs...)
212+
213+ Define global options for a simulation of the scene with keyword arguments:
214+
215+ | Keyword arguments | defaults |
216+ |:------------------------------|:----------------------------------------|
217+ | enableContactDetection | true |
218+ | elasticContactReductionFactor | 1.0 |
219+ | gravityField | [`Modia3D.UniformGravityField`](@ref)() |
220+ | enableVisualization | true |
221+ | visualizeGravity | true |
222+ | visualizeFrames | false |
223+ | visualizeConvexHulls | true |
224+ | visualizeContactPoints | false |
225+ | visualizeSupportPoints | false |
226+ | nominalLength | 1.0 |
227+ | defaultFrameLength | 0.2*nominalLength |
228+ | defaultJointLength | nominalLength/10 |
229+ | defaultJointWidth | nominalLength/20 |
230+ | defaultForceLength | nominalLength/10 |
231+ | defaultForceWidth | nominalLength/20 |
232+ | defaultBodyDiameter | nominalLength/9 |
233+ | defaultWidthFraction | 20 |
234+ | defaultArrowDiameter | nominalLength/40 |
235+ | `defaultN_to_m` | 1000 |
236+ | `defaultNm_to_m` | 1000 |
237+ | useOptimizedStructure | true |
238+ | defaultContactSphereDiameter | 0.1 |
239+ | contactDetection | ContactDetectionMPR_handler() |
240+
241+
242+ # Optional keyword arguments
243+
244+ - `enableContactDetection::Bool`: = true, if contact detection is enabled
245+ - `elasticContactReductionFactor::Float64`: used_contact_compliance = contact_compliance * elasticContactReductionFactor (> 0).
246+ - `gravityField::Modia3D.AbstractGravityField`: Type of gravity field, such as:
247+ [`Modia3D.NoGravityField`](@ref),
248+ [`Modia3D.UniformGravityField`](@ref),
249+ [`Modia3D.PointGravityField`](@ref).
250+ - `enableVisualization::Bool`: = true, if animation is enabled
251+ - `visualizeGravity::Bool`: = true, if gravity field shall be visualized (acceleration vector or field center)
252+ - `visualizeFrames::Bool`: = true, if all frames shall be visualized
253+ - `visualizeConvexHulls::Bool`: = true, if convex hulls (used for contact detection) shall be visualized
254+ - `visualizeContactPoints::Bool`: = true, if contact points shall be visualized
255+ - `visualizeSupportPoints::Bool` = true, if support points shall be visualized
256+ - `nominalLength::Float64`: [m] Nominal length of 3D system
257+ - `defaultFrameLength::Float64`: [m] Default for frame length if visualizeFrames = true (but not world frame)
258+ - `defaultJointLength::Float64`: [m] Default for the fixed length of a shape representing a joint
259+ - `defaultJointWidth::Float64`: [m] Default for the fixed width of a shape representing a joint
260+ - `defaultForceLength::Float64`: [m] Default for the fixed length of a shape representing a force (e.g., damper)
261+ - `defaultForceWidth::Float64`: [m] Default for the fixed width of a shape representing a force (e.g., spring, bushing)
262+ - `defaultBodyDiameter::Float64`: [m] Default for diameter of sphere representing the center of mass of a body
263+ - `defaultWidthFraction::Float64`: Default for shape width as a fraction of shape length
264+ - `defaultArrowDiameter::Float64`: [m] Default for arrow diameter (e.g., of forces, torques, sensors)
265+ - `defaultN_to_m::Float64`: [N/m] Default scaling of force arrows (length = force/defaultN_to_m)
266+ - `defaultNm_to_m::Float64`: [N.m/m] Default scaling of torque arrows (length = torque/defaultNm_to_m)
267+ - `useOptimizedStructure::Bool`: = true, if the optimized structure (with super objects, and common inertia) is used
268+ - `defaultContactSphereDiameter::Float64`: [m] Diameter of sphere used for contact point visualization
269+ - `contactDetection::Modia3D.AbstractContactDetection`: Handler used for contact detection
270+ (for example to determine the smallest distance between two objects).
271+
272+
273+ # Example
274+
275+ For all the details see "Modia3D/examples/dynamics/Simulate_Pendulum.jl":
276+
277+ ```julia
278+
279+ @assembly Pendulum(;Lx = 1.0) begin
280+ ...
281+ end
282+
283+ pendulum = Pendulum(Lx=1.6, sceneOptions=
284+ Modia3D.SceneOptions(visualizeFrames=true, defaultFrameLength=0.3))
285+ model = Modia3D.SimulationModel( pendulum )
286+ result = ModiaMath.simulate!(model, stopTime=4.5)
287+ ```
288+
289+ """
205290struct SceneOptions
206291 useOptimizedStructure:: Bool # = true, if the optimized structure (with super objects, and common inertia) is used
207292
0 commit comments