LDraw.org Discussion Forums
Online tool for OMR compliance - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw File Processing and Conversion (https://forums.ldraw.org/forum-22.html)
+--- Thread: Online tool for OMR compliance (/thread-23490.html)

Pages: 1 2


Online tool for OMR compliance - Lasse Deleuran - 2019-06-16

It has been some time since I floated the idea in here, but I have finally added functionality to buildinginstructions.js and by extension, the website BrickHub.org which checks for OMR compliance, and in most cases, can fix errors directly on the site. here is a video showing how to use it

I do not expect that I have found all OMR checks, and some of my checks might even be erroneous. This is why I am creating this thread. Let's discuss OMR checks and fixes Smile 

The checks and fixes are currently implemented in this Javascript file: LDROMR.js

Here are the checks that I have implemented:
  • Check and fix individual file headers read "0 FILE <set number> - <name>.ldr" then "0 <name>", followed by "0 Name:<set number> - <name>.ldr".
  • Ensure the file name is "<set number> - <name>.mpd"
  • Check and fix moved parts: If a part is named "~Moved <name>" then replace its usages with "<name>.dat"
  • Check and fix placements: If a part is placed with more than three decimals in any coordinate, then round the placement to three decimals. Example: "1 16 0.0001 0 0 ..." becomes "1 16 0 0 0 ...".
  • Check and fix all author lines: Ensure all authors are the same and read "!Author First name Last name [username]"
  • Check and fix all license lines to read "Redistributable under CCAL version 2.0 : see CAreadme.txt"
  • Set all "0 LDRAW_ORG" lines to read either "Model" or "Unofficial_Model".
  • Ensure all unofficial parts are copied into the MPD file and named with the set number prefix in the "0 FILE" and "0 Name:" lines.
  • If the set is from 2007 or after and contains old colors (6, 7, or 8), then replace them with the newer colored parts.
  • If the set is from before 2007 and contains new colors (70, 71, or 72), then replace them with the old colored parts.
These are the checks I have not yet implemented:
  • Verify that "Theme" lines correctly identify a theme.
  • Verify that "History" lines are well formed.
  • Verify that "History" lines are in the correct order.
The purpose of this work is to make it even easier to submit OMR-compliant model file - especially for people who are not using Windows, so they can't easily use MPDCenter.


RE: Online tool for OMR compliance - Orion Pobursky - 2019-06-17

Is this .js file something we can use on LDraw.org or is it tightly coupled to all your other code?


RE: Online tool for OMR compliance - Philippe Hurbain - 2019-06-17

Great tool and tutorial video! I'll check that in more details when I do my next model...


RE: Online tool for OMR compliance - Eugen - 2019-06-17

(2019-06-16, 19:58)Lasse Deleuran Wrote: The purpose of this work is to make it even easier to submit OMR-compliant model file - especially for people who are not using Windows, so they can't easily use MPDCenter.

Is it possible port it to C++? It would be cool merge such OMR checker in open-source cross platform software such as LeoCAD, (that work not only on Windows, but on Linux MacOS and other OS too)


RE: Online tool for OMR compliance - Lasse Deleuran - 2019-06-17

(2019-06-17, 0:26)Orion Pobursky Wrote: Is this .js file something we can use on LDraw.org or is it tightly coupled to all your other code?

I have done my best to make it reusable for others, and focused on basic tree traversal. The Javascript file basically consists of pairs of functions, and converting it to any other object oriented or functional language should be a breeze. 

The potentially difficult part would be to match the data model. The LDraw (or MPD) file structure is parsed into a tree structure: Each 'file' in an MPD file is represented by one type of nodes. Each step within it as a second type of node, and finally each line is a third type of node.

Other programs might not model steps as separate nodes, but as long as you model MPD files as tree structures, then translation to another program should be fairly easy.


I have added documentation to the LDROMR.js file to help potential developers both to add their own checks and to translate everything to another language.


RE: Online tool for OMR compliance - Lasse Deleuran - 2019-06-17

(2019-06-17, 6:27)Philippe Hurbain Wrote: Great tool and tutorial video! I'll check that in more details when I do my next model...

That would be great. And please tell me how it goes.


RE: Online tool for OMR compliance - Orion Pobursky - 2019-06-17

(2019-06-17, 13:46)Lasse Deleuran Wrote: I have done my best to make it reusable for others, and focused on basic tree traversal. The Javascript file basically consists of pairs of functions, and converting it to any other object oriented or functional language should be a breeze. 

The potentially difficult part would be to match the data model. The LDraw (or MPD) file structure is parsed into a tree structure: Each 'file' in an MPD file is represented by one type of nodes. Each step within it as a second type of node, and finally each line is a third type of node.

Other programs might not model steps as separate nodes, but as long as you model MPD files as tree structures, then translation to another program should be fairly easy.


I have added documentation to the LDROMR.js file to help potential developers both to add their own checks and to translate everything to another language.

Awesome. I’ll look into it at some point. 

Santeri is working on a part validator but it’s written in python. I don’t want to step on his toes.


RE: Online tool for OMR compliance - Lasse Deleuran - 2019-06-17

(2019-06-17, 13:31)Eugen Wrote: Is it possible port it to C++? It would be cool merge such OMR checker in open-source cross platform software such as LeoCAD, (that work not only on Windows, but on Linux MacOS and other OS too)
Porting to C++ is easy.
Fitting it into the internal structure might be tricky. I do not know enough of this to give an estimation.

If it fails, then my "sample_functions.htm" file can be used as a starting point for an OMR conversion service. Let's see what people will find useful.


RE: Online tool for OMR compliance - Willy Tschager - 2019-07-04

Lasse,

I tried your tool today with the 926 - Command Centre as for some strange reasons it is in the AIOI but not the OMR. I deliberately added some errors just to see how the site copes with them. Here is the source and the result I downloaded from Brickhub.

[attachment=3816]
[attachment=3817]

It picked the {} in the Usename, it fixed the MLCad metas:

0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG 0 0

BUT

(please ignore my tone if you might find it harsh ;-)
  • It didn't load the MPD name - just the set number and as you can see it returned a 926 - 926.mpd.
  • I find the page overwhelming at first.
  • I don't like the fact that the thumbnail generator/instructions/parts is in between the section where I actually edit the header and the suggestions what has to be changed in order to get it OMRized.
  • I cannot actually see the code itself or at least the header
  • All line breaks get deleted and you cannot longer view the file in notepad for a quick check.
  • The site continuous to switch between Unofficial_Model and Model. When I set it to Model it still suggests to set to Unofficial model
  • I would love to get an indication in the header section itself if for example:
    Author: Willy Tschager [Holly-Wood] ✎
    is right or wrong OMR wise (green tick/red cross)
  • There is a Download button and a Delete button, where is the upload button when I'm done? I know there is the button which says Upload once you have picked the file from the disk but my understanding is that I LOAD, correct and upload.

w.


RE: Online tool for OMR compliance - Lasse Deleuran - 2019-07-13

(2019-07-04, 11:39)Willy Tschager Wrote: Lasse,

I tried your tool today with the 926 - Command Centre as for some strange reasons it is in the AIOI but not the OMR. I deliberately added some errors just to see how the site copes with them. Here is the source and the result I downloaded from Brickhub.




It picked the {} in the Usename, it fixed the MLCad metas:

0 ROTATION CENTER 0 0 0 1 "Custom"
0 ROTATION CONFIG 0 0

BUT

(please ignore my tone if you might find it harsh ;-)
  • It didn't load the MPD name - just the set number and as you can see it returned a 926 - 926.mpd.
  • I find the page overwhelming at first.
  • I don't like the fact that the thumbnail generator/instructions/parts is in between the section where I actually edit the header and the suggestions what has to be changed in order to get it OMRized.
  • I cannot actually see the code itself or at least the header
  • All line breaks get deleted and you cannot longer view the file in notepad for a quick check.
  • The site continuous to switch between Unofficial_Model and Model. When I set it to Model it still suggests to set to Unofficial model
  • I would love to get an indication in the header section itself if for example:
    Author: Willy Tschager [Holly-Wood] ✎
    is right or wrong OMR wise (green tick/red cross)
  • There is a Download button and a Delete button, where is the upload button when I'm done? I know there is the button which says Upload once you have picked the file from the disk but my understanding is that I LOAD, correct and upload.

w.

First of all. Thanks for the feedback and I'm sorry I could not come back to this earlier. I'm used to a much harsher tone in my everyday work, so it is no problem that you write it all up in brief form. I can also understand the frustration, so let's dive into the points:
  • File name being "926 - 926.mpd": I found the bug in the uploader. This has been fixed now. Uploading your file results in the name being read correctly: "Command Centre - Main File". Thanks for reporting it!
  • Page being overwhelming: I have reduced the amount of text and done some restructuring. I hope it is less overwhelming now, but I would still like to take suggestions.
  • Suggestions below image: Good point. The suggestions have now been moved up above the image.
  • View the file source code in the page: I am working on a solution for this. The parts list has a pop-up for Bricklink wanted list code, so this feature should be easy to add for the file content.
  • Line breaks: The code was saving with Linux line ends. I have changed it to Windows style, which is also more correct according to the standard.
  • Unofficial_Model vs Official Model: It was not easy to make a good decision here. I want people to be able to change to either of these values, but this also causes you to be able to change back and forth all the time. I have come up with a new solution. When you set it to 'Model' it is unlikely that you want to change it back to unofficial, so I have removed the option - unless you just pressed 'Model' - then you are still able to press 'Unofficial' in case you pressed the other button by mistake.
  • Having red/green ticks next to the header fields: This makes sense. I will look into a way where this will not be too cluttered while still showing the OMR messages - this is currently a challenge for me to get right for users on touch-based devices, hence the more blunt OMR line blocks below.
  • Download vs Upload: I am not sure I understand this correctly. 'Upload' always means computer->website, while 'Download' means website->computer.
I will return once I have a solution for the being able to view the file content.

And again. Please bring in more suggestions. Smile