Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for version=6 through rmscene #7

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

chemag
Copy link

@chemag chemag commented Jan 17, 2023

No description provided.

chemag and others added 16 commits September 5, 2021 10:48
Tested:

Made sure all the .rm files in the repo (non-version=6) produce the exact same SVG files.

Before:
```
$ find rm_tools -type f -iname '*.rm' | xargs -i sh -c 'python rm_tools/rm2svg.py -i {} -o /tmp/foo.svg && md5sum /tmp/foo.svg' | sort | md5sum
9d7f1647b4f5a428900fb4c68d9da6ce  -
```

After:
```
$ find rm_tools -type f -iname '*.rm' | xargs -i sh -c 'python rm_tools/rm2svg.py -i {} -o /tmp/foo.svg && md5sum /tmp/foo.svg' | sort | md5sum
9d7f1647b4f5a428900fb4c68d9da6ce  -
```
Tested:
```
$ flake8 rm_tools/rm2svg.py | grep -v E501
$
```

Note that we're ignoring E501 (line too long) as the right
solution is black, which we will do in the next patch.

Also made sure all the .rm files in the repo (non-version=6)
produce the exact same SVG files.

Before:
```
$ find rm_tools -type f -iname '*.rm' | xargs -i sh -c 'python rm_tools/rm2svg.py -i {} -o /tmp/foo.svg && md5sum /tmp/foo.svg' | sort | md5sum
9d7f1647b4f5a428900fb4c68d9da6ce  -
```

After:
```
$ find rm_tools -type f -iname '*.rm' | xargs -i sh -c 'python rm_tools/rm2svg.py -i {} -o /tmp/foo.svg && md5sum /tmp/foo.svg' | sort | md5sum
9d7f1647b4f5a428900fb4c68d9da6ce  -
```
Includes:
* make indentation coherent
* add comments to SVG to make it more readable
* replace .format-based strings with f-strings
* fix a typo ("Mechanical" instead of "Machanical")

Tested:

Run parser before and after, and checked that the only difference
is the indentation and the comments.

Also:
```
$ find rm_tools -type f -iname '*.rm' | xargs -i sh -c 'python rm_tools/rm2svg.py -i {} -o /tmp/foo.svg && md5sum /tmp/foo.svg' | sort | md5sum
89fea1bc81d3925f5d049f2cc41a66c2  -
```
"y_width" is also known as "height".
"x_width" is also known as "width".

Tested:
```
$ find rm_tools -type f -iname '*.rm' | xargs -i sh -c 'python rm_tools/rm2svg.py -i {} -o /tmp/foo.svg && md5sum /tmp/foo.svg' | sort | md5sum
89fea1bc81d3925f5d049f2cc41a66c2  -
```
Also fix the README with how to run a command.

Tested:
```
$ rm_tools/rm2svg.py -i ./rm_tools/convert_procedure/paper/93ce11cf-31e6-4a6c-ac67-7214c6be96ab.rm -o /tmp/foo.svg
```
Includes:
(1) .content file changes
* json["formatVersion"] field set to 2
* json["pages"] field disappears. List of pages can be obtained from
  json["cPages"]["pages"][]["id"]
(2) tries to use [rmscene](https://github.com/chemag/rmscene) to
convert version=6 lines (.rm) files.
Tested:

Converted my whole repository of .rm files.
@Sythelux Sythelux mentioned this pull request Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant