Skip to content

SkipGradients - #4714

Open
HansOlsson wants to merge 2 commits into
modelica:masterfrom
HansOlsson:NoGradientSlopedPipe
Open

HansOlsson wants to merge 2 commits into
modelica:masterfrom
HansOlsson:NoGradientSlopedPipe

Conversation

@HansOlsson

Copy link
Copy Markdown
Contributor

Split off from #4711

This is for the Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.TankWith3InletOutletArraysWithEvaporatorCondensor model used in Modelica.Fluid.Examples.AST_BatchPlant and is for the slanted pipe at the top:

This PR intends to get it to look as follows (this is also how it looks like in Dymola 2026x):

TankWith3InletOutletArraysWithEvaporatorCondensor

Supporting gradients on polygons would instead give (notice the odd gradients for the top-pipe; to me this just looks odd):

TankWith3InletOutletArraysWithEvaporatorCondensor_Weird

I assume the idea was something like the following (using paint) - but that requires gradients along the axis of polygons, which seems quite difficult to support:

TankWith3InletOutletArraysWithEvaporatorCondensor_Intended

@HansOlsson HansOlsson added L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) example Issue only addresses example(s) icon Issues addresses the icon graphics labels Dec 10, 2025
@maltelenz

Copy link
Copy Markdown
Contributor

Doesn't it just require rotation, or am I misunderstanding the problem?

Example model:

model RotatedGradient
  annotation(
    Icon(
      coordinateSystem(extent = {{-100, -100}, {100, 100}}),
      graphics = {
        Polygon(origin = {-100, -25}, fillColor = {0, 0, 255}, fillPattern = FillPattern.HorizontalCylinder, points = {{0, 100}, {200, 70}, {200, 50}, {200, 50}, {0, 80}, {0, 100}}),
        Polygon(origin = {-26.277, -37.037}, rotation = -10.471, fillColor = {170, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, points = {{-78.894, 99.214}, {-70.024, 77.449}, {-50, 90}, {-32.628, 80}, {-15.687, 90}, {-3.137, 83.372}, {13.614, 91.606}, {28.046, 84}, {39.34, 89.724}, {54.725, 82.533}, {65.771, 89.724}, {80.625, 82.557}, {91.42, 95.999}, {89.933, 103.544}, {79.812, 88.469}, {68.619, 102.334}, {55.363, 90.654}, {41.223, 100.391}, {29.301, 89.41}, {13.181, 100.246}, {-2.824, 93.725}, {-14.118, 100}, {-32.628, 88}, {-50, 100}, {-68.861, 84.074}, {-71.939, 100.516}})
      }
    )
  );
end RotatedGradient;

and how it looks in System Modeler:

image

@HansOlsson

Copy link
Copy Markdown
Contributor Author

Doesn't it just require rotation, or am I misunderstanding the problem?

I didn't think of that, but it is possible, one would then have to specify that the gradient is applied before the rotation - I don't know if that will cause weird effects for other cases. I'll forward that idea internally.

But since the gradient haven't worked as intended for years (or decades) I think just removing them as in this PR would work as well; they cannot be that important.

BTW: The idea was to rotate both of the polygons, and I hope we agree that something is needed.

@maltelenz

Copy link
Copy Markdown
Contributor

The idea was to rotate both of the polygons

Right, I missed the cylinder.

I hope we agree that something is needed.

Yes, the current look is dreadful :)

@HansOlsson HansOlsson added this to the MSL4.2.0 milestone Sep 7, 2026
@HansOlsson

Copy link
Copy Markdown
Contributor Author

Doesn't it just require rotation, or am I misunderstanding the problem?

Example model:

model RotatedGradient
  annotation(
    Icon(
      coordinateSystem(extent = {{-100, -100}, {100, 100}}),
      graphics = {
        Polygon(origin = {-100, -25}, fillColor = {0, 0, 255}, fillPattern = FillPattern.HorizontalCylinder, points = {{0, 100}, {200, 70}, {200, 50}, {200, 50}, {0, 80}, {0, 100}}),
        Polygon(origin = {-26.277, -37.037}, rotation = -10.471, fillColor = {170, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, points = {{-78.894, 99.214}, {-70.024, 77.449}, {-50, 90}, {-32.628, 80}, {-15.687, 90}, {-3.137, 83.372}, {13.614, 91.606}, {28.046, 84}, {39.34, 89.724}, {54.725, 82.533}, {65.771, 89.724}, {80.625, 82.557}, {91.42, 95.999}, {89.933, 103.544}, {79.812, 88.469}, {68.619, 102.334}, {55.363, 90.654}, {41.223, 100.391}, {29.301, 89.41}, {13.181, 100.246}, {-2.824, 93.725}, {-14.118, 100}, {-32.628, 88}, {-50, 100}, {-68.861, 84.074}, {-71.939, 100.516}})
      }
    )
  );
end RotatedGradient;

Looking more, I don't think that is right - the large polygon should also have rotated gradient (so that the gradient represent a slightly tilted pipe- where the darker parts are the edges of the pipe). Getting the coordinates right seemed a bit messy.

So, just skipping the gradients seems simplest.

@maltelenz

Copy link
Copy Markdown
Contributor

Getting the coordinates right seemed a bit messy.

Slightly, but trivial for an LLM. Here you go:

model FixedRotatedPolygons
  annotation(
    Icon(
      coordinateSystem(extent = {{-100, -100}, {100, 100}}),
      graphics = {
        Polygon(origin = {73.723, -12.037}, rotation = -8.531, fillColor = {0, 0, 255}, fillPattern = FillPattern.HorizontalCylinder, points = {{-89.527, 99.861}, {112.71, 99.862}, {115.677, 80.083}, {115.677, 80.083}, {-86.56, 80.082}, {-89.527, 99.861}}),
        Polygon(origin = {73.723, -12.037}, rotation = -8.531, fillColor = {170, 255, 255}, fillPattern = FillPattern.HorizontalCylinder, points = {{-78.894, 99.214}, {-70.024, 77.449}, {-50, 90}, {-32.628, 80}, {-15.687, 90}, {-3.137, 83.372}, {13.614, 91.606}, {28.046, 84}, {39.34, 89.724}, {54.725, 82.533}, {65.771, 89.724}, {80.625, 82.557}, {91.42, 95.999}, {89.933, 103.544}, {79.812, 88.469}, {68.619, 102.334}, {55.363, 90.654}, {41.223, 100.391}, {29.301, 89.41}, {13.181, 100.246}, {-2.824, 93.725}, {-14.118, 100}, {-32.628, 88}, {-50, 100}, {-68.861, 84.074}, {-71.939, 100.516}})
      }
    )
  );
end FixedRotatedPolygons;

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

example Issue only addresses example(s) icon Issues addresses the icon graphics L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants