Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Modelica/Mechanics/MultiBody/Visualizers/Advanced/Shape.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ model Shape
"Visualizing an elementary object with variable size; all data have to be set as modifiers (see info layer)"

extends ModelicaServices.Animation.Shape;
extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialShape;
extends ModelicaServices.AnimationInterface.PartialShape;

annotation (
Icon(coordinateSystem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within Modelica.Mechanics.MultiBody.Visualizers.Advanced;
model Surface
"Visualizing a moveable, parameterized surface; the surface characteristic is provided by a function"
extends Modelica.Mechanics.MultiBody.Icons.Surface;
extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialSurface;
extends ModelicaServices.AnimationInterface.PartialSurface;
extends ModelicaServices.Animation.Surface;
annotation (Icon(graphics={Polygon(
points={{-102,40},{-98,92},{28,-8},{96,146},{104,-118},{-18,-34},{-52,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within Modelica.Mechanics.MultiBody.Visualizers.Advanced;
model Vector "Visualizing a vector quantity (force, torque, etc.)"

extends ModelicaServices.Animation.Vector;
extends Modelica.Utilities.Internal.PartialModelicaServices.Animation.PartialVector;
extends ModelicaServices.AnimationInterface.PartialVector;

annotation (
Documentation(info="<html>
Expand Down
2 changes: 0 additions & 2 deletions Modelica/Utilities/Files.mo
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,6 @@ end temporaryFileName;

function loadResource
"Return the absolute path name of a URI or local file name"
extends
Modelica.Utilities.Internal.PartialModelicaServices.ExternalReferences.PartialLoadResource;
extends ModelicaServices.ExternalReferences.loadResource;
annotation (
Documentation(info=
Expand Down
151 changes: 0 additions & 151 deletions Modelica/Utilities/Internal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,157 +3,6 @@ package Internal
"Internal components that a user should usually not directly utilize"
extends Modelica.Icons.InternalPackage;
import Modelica.Units.SI;
package PartialModelicaServices
"Interfaces of components requiring a tool specific implementation"
extends Modelica.Icons.InternalPackage;
package Animation "Models and functions for 3-dim. animation"
extends Modelica.Icons.Package;
partial model PartialShape "Interface for 3D animation of elementary shapes"

import Modelica.Mechanics.MultiBody.Frames;
import Modelica.Mechanics.MultiBody.Types;

parameter Types.ShapeType shapeType="box"
"Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, <external shape>)";
input Frames.Orientation R=Frames.nullRotation()
"Orientation object to rotate the world frame into the object frame" annotation(Dialog);
input SI.Position r[3]={0,0,0}
"Position vector from origin of world frame to origin of object frame, resolved in world frame" annotation(Dialog);
input SI.Position r_shape[3]={0,0,0}
"Position vector from origin of object frame to shape origin, resolved in object frame" annotation(Dialog);
input Real lengthDirection[3](each final unit="1")={1,0,0}
"Vector in length direction, resolved in object frame" annotation(Dialog);
input Real widthDirection[3](each final unit="1")={0,1,0}
"Vector in width direction, resolved in object frame" annotation(Dialog);
input SI.Length length=0 "Length of visual object" annotation(Dialog);
input SI.Length width=0 "Width of visual object" annotation(Dialog);
input SI.Length height=0 "Height of visual object" annotation(Dialog);
input Types.ShapeExtra extra=0.0
"Additional size data for some of the shape types" annotation(Dialog);
input Real color[3]={255,0,0} "Color of shape" annotation(Dialog(colorSelector=true));
input Types.SpecularCoefficient specularCoefficient = 0.7
"Reflection of ambient light (= 0: light is completely absorbed)" annotation(Dialog);

annotation (
Documentation(info="<html>
<p>
This model is documented at
<a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape</a>.
</p>
</html>"));

end PartialShape;

partial model PartialVector "Interface for 3D animation of a vector quantity (force, torque etc)"
import Modelica.Mechanics.MultiBody.Types;
import Modelica.Mechanics.MultiBody.Frames;

input Frames.Orientation R=Frames.nullRotation()
"Orientation object to rotate the world frame into the vector frame" annotation(Dialog);
input SI.Position r[3]={0,0,0}
"Position vector from origin of world frame to origin of vector frame, resolved in world frame" annotation(Dialog);
input Real coordinates[3]={0,0,0}
"Coordinates of the vector resolved in vector frame" annotation(Dialog);
input Types.Color color=Types.Defaults.ArrowColor
"Color of vector" annotation(Dialog(colorSelector=true));
input Types.SpecularCoefficient specularCoefficient = 0.7
"Material property describing the reflecting of ambient light (= 0 means, that light is completely absorbed)" annotation(Dialog);
parameter Types.VectorQuantity quantity = Types.VectorQuantity.Force "Quantity of the coordinates";
input Boolean headAtOrigin=false "= true, if the vector is pointing towards the origin of vector frame" annotation(Dialog);
input Boolean twoHeadedArrow=false "= true, if the arrow has two heads after each other (pointing in the same direction)" annotation(Dialog);

annotation (
Documentation(info="<html>
<p>
This model is documented at
<a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Vector\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Vector</a>.
</p>
</html>"));
end PartialVector;

partial model PartialSurface "Interface for 3D animation of surfaces"

import Modelica.Mechanics.MultiBody.Frames;
import Modelica.Mechanics.MultiBody.Types;

input Frames.Orientation R=Frames.nullRotation()
"Orientation object to rotate the world frame into the surface frame"
annotation(Dialog(group="Surface frame"));
input SI.Position r_0[3]={0,0,0}
"Position vector from origin of world frame to origin of surface frame, resolved in world frame"
annotation(Dialog(group="Surface frame"));

parameter Integer nu=2 "Number of points in u-Dimension" annotation(Dialog(group="Surface properties"));
parameter Integer nv=2 "Number of points in v-Dimension" annotation(Dialog(group="Surface properties"));
replaceable function surfaceCharacteristic =
Modelica.Mechanics.MultiBody.Interfaces.partialSurfaceCharacteristic
"Function defining the surface characteristic"
annotation(choicesAllMatching=true,Dialog(group="Surface properties"));

parameter Boolean wireframe=false "= true: 3D model will be displayed without faces"
annotation (Dialog(group="Material properties"),choices(checkBox=true));
parameter Boolean multiColoredSurface=false "= true: Color is defined for each surface point"
annotation(Dialog(group="Material properties"),choices(checkBox=true));
input Real color[3]={255,0,0} "Color of surface" annotation(Dialog(colorSelector=true,group="Material properties", enable=not multiColoredSurface));
input Types.SpecularCoefficient specularCoefficient = 0.7
"Reflection of ambient light (= 0: light is completely absorbed)"
annotation(Dialog(group="Material properties"));
input Real transparency=0 "Transparency of shape: 0 (= opaque) ... 1 (= fully transparent)"
annotation(Dialog(group="Material properties"));

annotation (Documentation(info="<html>
<p>
This model is documented at
<a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface</a>.
</p>
</html>"));
end PartialSurface;
end Animation;

package ExternalReferences "Functions to access external resources"
extends Modelica.Icons.InternalPackage;
partial function PartialLoadResource
"Interface for tool specific function to return the absolute path name of a URI or local file name"
extends Modelica.Icons.Function;
input String uri "URI or local file name";
output String fileReference "Absolute path name of file";
annotation (Documentation(info="<html>
<p>
This partial function defines the function interface of a tool-specific implementation
in package ModelicaServices. The interface is documented at
<a href=\"modelica://Modelica.Utilities.Files.loadResource\">Modelica.Utilities.Internal.FileSystem.loadResource</a>.
</p>

</html>"));
end PartialLoadResource;
end ExternalReferences;

package System "System dependent functions"
extends Modelica.Icons.InternalPackage;
partial function exitBase "Interface for tool specific function to terminate the execution of the Modelica environment"
extends Modelica.Icons.Function;
input Integer status=0 "Result to be returned by environment (0 means success)";
annotation (Documentation(info="<html>
<p>
This partial function defines the function interface of a tool-specific implementation
in package ModelicaServices.
</p>
</html>"));
end exitBase;
end System;
annotation (Documentation(info="<html>

<p>
This package contains interfaces of a set of functions and models used in the
Modelica Standard Library that requires a <strong>tool specific implementation</strong>.
There is an associated package called <strong>ModelicaServices</strong>. A tool vendor
should provide a proper implementation of this library for the corresponding
tool. The default implementation is \"do nothing\".
In the Modelica Standard Library, the models and functions of ModelicaServices
are used.
</p>
</html>"));
end PartialModelicaServices;

package FileSystem
"Internal package with external functions as interface to the file system"
Expand Down
8 changes: 8 additions & 0 deletions ModelicaServices/AnimationInterface/Frames/Orientation.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
within ModelicaServices.AnimationInterface.Frames;
record Orientation
"Orientation object defining rotation from a frame 1 into a frame 2"
extends Icons.Record;
Real T[3, 3] "Transformation matrix from world frame to local frame";
Types.AngularVelocity w[3]
"Absolute angular velocity of local frame, resolved in local frame";
end Orientation;
9 changes: 9 additions & 0 deletions ModelicaServices/AnimationInterface/Frames/nullRotation.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
within ModelicaServices.AnimationInterface.Frames;
function nullRotation
"Return orientation object that does not rotate a frame"
extends Icons.Function;
output Orientation R
"Orientation object such that frame 1 and frame 2 are identical";
algorithm
R := Orientation(T=identity(3),w= zeros(3));
end nullRotation;
4 changes: 4 additions & 0 deletions ModelicaServices/AnimationInterface/Frames/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
within ModelicaServices.AnimationInterface;

package Frames
end Frames;
3 changes: 3 additions & 0 deletions ModelicaServices/AnimationInterface/Interfaces/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
within ModelicaServices.AnimationInterface;
package Interfaces
end Interfaces;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
within ModelicaServices.AnimationInterface.Interfaces;

partial function partialSurfaceCharacteristic "Interface for a function returning surface characteristics"
extends Modelica.Icons.Function;
input Integer nu "Number of points in u-Dimension";
input Integer nv "Number of points in v-Dimension";
input Boolean multiColoredSurface=false
"= true: Color is defined for each surface point";
output Types.Position X[nu,nv]
"[nu,nv] positions of points in x-Direction resolved in surface frame";
output Types.Position Y[nu,nv]
"[nu,nv] positions of points in y-Direction resolved in surface frame";
output Types.Position Z[nu,nv]
"[nu,nv] positions of points in z-Direction resolved in surface frame";
output Real C[if multiColoredSurface then nu else 0,
if multiColoredSurface then nv else 0,3]
"[nu,nv,3] Color array, defining the color for each surface point";
end partialSurfaceCharacteristic;
30 changes: 30 additions & 0 deletions ModelicaServices/AnimationInterface/Types/Color.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
within ModelicaServices.AnimationInterface.Types;

type Color = Integer[3] (each min=0, each max=255)
"RGB representation of color"
annotation (
Dialog(colorSelector=true),
choices(
choice={0,0,0} "{0,0,0} \"black\"",
choice={155,0,0} "{155,0,0} \"dark red\"",
choice={255,0,0} "{255,0,0 } \"red\"",
choice={255,65,65} "{255,65,65} \"light red\"",
choice={0,128,0} "{0,128,0} \"dark green\"",
choice={0,180,0} "{0,180,0} \"green\"",
choice={0,230,0} "{0,230,0} \"light green\"",
choice={0,0,200} "{0,0,200} \"dark blue\"",
choice={0,0,255} "{0,0,255} \"blue\"",
choice={0,128,255} "{0,128,255} \"light blue\"",
choice={255,255,0} "{255,255,0} \"yellow\"",
choice={255,0,255} "{255,0,255} \"pink\"",
choice={100,100,100} "{100,100,100} \"dark grey\"",
choice={155,155,155} "{155,155,155} \"grey\"",
choice={255,255,255} "{255,255,255} \"white\""),
Documentation(info="<html>
<p>
Type <strong>Color</strong> is an Integer vector with 3 elements,
{r, g, b}, and specifies the color of a shape.
{r, g, b} are the \"red\", \"green\" and \"blue\" color parts.
Note, r, g and b are given in the range 0&nbsp;&hellip;&nbsp;255.
</p>
</html>"));
51 changes: 51 additions & 0 deletions ModelicaServices/AnimationInterface/Types/ShapeExtra.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
within ModelicaServices.AnimationInterface.Types;
type ShapeExtra = Real
"Type of the additional data that can be defined for an elementary ShapeType"
annotation (
Documentation(info="<html>
<p>
This type is used in shapes of visual objects to define
extra data depending on the shape type. Usually, input
variable <strong>extra</strong> is used as instance name:
</p>

<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\">
<tr><th><strong>shapeType</strong></th><th>Meaning of parameter <strong>extra</strong></th></tr>
<tr>
<td>\"cylinder\"</td>
<td>if extra&nbsp;&gt;&nbsp;0, a black line is included in the
cylinder to show the rotation of it.</td>
</tr>
<tr>
<td>\"cone\"</td>
<td>extra = diameter-left-side / diameter-right-side, i.e.,<br>
extra = 1: cylinder<br>
extra = 0: \"real\" cone.</td>
</tr>
<tr>
<td>\"pipe\"</td>
<td>extra = outer-diameter / inner-diameter, i.e,<br>
extra = 1: cylinder that is completely hollow<br>
extra = 0: cylinder without a hole.</td>
</tr>
<tr>
<td>\"gearwheel\"</td>
<td>extra is the number of teeth of the (external) gear.
If extra&nbsp;&lt;&nbsp;0, an internal gear is visualized with |extra| teeth.
The axis of the gearwheel is along \"lengthDirection\", and usually:
width = height = 2*radiusOfGearWheel.</td>
</tr>
<tr>
<td>\"spring\"</td>
<td>extra is the number of windings of the spring.
Additionally, \"height\" is <strong>not</strong> the \"height\" but
2*coil-width.</td>
</tr>
<tr>
<td>external shape</td>
<td>extra = 0: Visualization from file is not scaled.<br>
extra = 1: Visualization from file is scaled with \"length\", \"width\" and \"height\"
of the shape</td>
</tr>
</table>
</html>"));
63 changes: 63 additions & 0 deletions ModelicaServices/AnimationInterface/Types/ShapeType.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
within ModelicaServices.AnimationInterface.Types;
type ShapeType = String
"Type of shape (box, sphere, cylinder, pipecylinder, cone, pipe, beam, gearwheel, spring, <external shape>)"
annotation ( choices(
choice="box" "\"box\"",
choice="sphere" "\"sphere\"",
choice="cylinder" "\"cylinder\"",
choice="pipecylinder" "\"pipecylinder\"",
choice="cone" "\"cone\"",
choice="pipe" "\"pipe\"",
choice="beam" "\"beam\"",
choice="gearwheel" "\"gearwheel\"",
choice="spring" "\"spring\"",
choice="modelica://PackageName/PathName.dxf"),
Documentation(info="<html>
<p>
Type <strong>ShapeType</strong> is used to define the shape of the
visual object as parameter String. Usually, \"shapeType\" is used
as instance name. The following
values for shapeType are possible, e.g., shapeType=\"box\":
</p>

<div>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/MultiBody/Visualizers/Shape.png\" alt=\"model Visualizers.FixedShape\">
</div>

<p>
The dark blue arrows in the figure above are directed along
variable <strong>lengthDirection</strong>. The light blue arrows are directed
along variable <strong>widthDirection</strong>. The <strong>coordinate systems</strong>
in the figure represent frame_a of the Shape component.
</p>

<p>
Additionally, external shapes can be specified as (not all options might be supported by all tools):
</p>

<ul>
<li> <strong>\"1\", \"2\",&nbsp;&hellip;</strong><br>
define external shapes specified in DXF format in files \"1.dxf\", \"2.dxf\",&nbsp;&hellip;
The DXF-files must be found either in the current directory or in the directory where
the Shape instance is stored that references the DXF file.
This (very limited) option should not be used for new models. Example:<br>
shapeType=\"1\".<br></li>

<li> \"<strong>modelica:</strong>//&lt;Modelica-name&gt;/&lt;relative-path-file-name&gt;\"<br>
characterizes the file that is stored under the location of the
&lt;Modelica-name&gt; library path with the given relative file name.
Example:<br> shapeType = \"modelica://Modelica/Resources/Data/Shapes/Engine/piston.dxf\".<br></li>

<li> \"<strong>file:</strong>///&lt;absolute-file-name&gt;\"<br>
characterizes an absolute file name in the file system. Example:<br>
shapeType=\"file:///C:/users/myname/shapes/piston.dxf\".</li>
</ul>

<p>
The supported file formats are tool dependent. Most tools support
at least DXF-files (a tool might support 3-dim. Face of the DXF format only),
but may support other format as well (such as stl, obj, 3ds).
Since visualization files contain color and other data, the corresponding
information in the model is usually ignored.
</p>
</html>"));
Loading