simulatino / trimtrailingwhitespaces

Python script that detects textfiles and then removes trailing white spaces and more.
The Unlicense
11 stars 2 forks source link

Placement.transformation.rotation=0 and other default annotation values #12

Closed tbeu closed 10 years ago

tbeu commented 10 years ago

Wish: Would be also possible to remove the dummy Placement.transformation.rotation=0 annotation, i.e. convert

Blocks.Math.Add3 Add annotation (Placement(transformation(extent={{20,-10},
              {40,10}}, rotation=0)));

to

Blocks.Math.Add3 Add annotation (Placement(transformation(extent={{20,-10},
              {40,10}})));
tbeu commented 10 years ago

In the same way:

can all be removed.

dietmarw commented 10 years ago

One thing I like to confirm first is why each of the cases should be removed. Can you give a short reasoning per case.

tbeu commented 10 years ago

I can't since I do not know why Dymola introduces / introduced them.

tbeu commented 10 years ago

But in order to keep annotations simple, clean and clear I prefer not to list the default modification every time.

dietmarw commented 10 years ago

In that case I would put this on hold. I don't want to change the appearance/behaviour of the models by removing annotations that are legal but still do something useful.

E.g., I guess it is safe to remove Icon|Diagram.coordinateSystem.extent={{-100,-100},{100,100}} since that is just a default. But I'm unsure of the visible=true. I guess it is the default too. I'll try to get some feedback from DS on this.

tbeu commented 10 years ago

Your guess is correct according to MLS 3.2rev2.

But what do you mean by "something useful"? It does not matter if it is there or not. So it is neither useful nor harmful. Just superfluous.

dietmarw commented 10 years ago

Feedback from DS: preserveAspectRatio=true should be kept (since Dymola defaults to false here) the rest should be pretty safe to remove.

dietmarw commented 10 years ago

I think I got this now pretty much nailed. @tbeu Would be nice if you could test it. It's not in master yet so you will have to do:

$ pip install -U https://github.com/dietmarw/trimtrailingwhitespaces/archive/t12-remove-defaults.zip

One thing that I noticed is not working is the removal of some Dymola annotations. Still working on this one. Mind the new version is now MUCH more fail-save with regard to breaking the code. But it all depends on the test cases and (im)possible annotation constructs.

dietmarw commented 10 years ago

The part with the Dymola specific annotations is now fixed again and part of the "t12-remove-defaults" branch.

dietmarw commented 10 years ago

@tbeu Any other issues detected or do you think this branch is fit for merging?

tbeu commented 10 years ago

I tested BioChem, Modelica_DeviceDrivers and FaultTriggering and found no problems.

And I opened one question in Physiolibrary.

dietmarw commented 10 years ago

Fixed in v0.5.0.