Subject:
|
DAT files: Do No Harm
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Wed, 21 Aug 2002 20:28:42 GMT
|
Highlighted:
|
(details)
|
Viewed:
|
645 times
|
| |
| |
What consideration should an editor program make for unfamiliar content or
eccentric style when it loads and saves an LDRAW file with changes?
I am implementing the following general ideas in BrickDraw3D, based on
various situations in test files.
A program which reads, edits, and writes an LDRAW file should:
1. Do no harm: never change a line unless it really has been edited
2. Use the same scheme of line breaks it found there (CR, CRLF, LF, LFCR)
3. Keep the exact part filename specified, even if slightly different on
host computer (example: when shield.dat maps to SHIELD.dat, or even shield.ldr)
4. Preserve indentation, maybe even try to mimic it when a new part is
inserted to a step (as in pyramid.dat which has indentation)
5. Preserve dangling line remnant (example: type 1 line has 2 part names...
user was trying out alternatives. Jacob's vognhest.dat for example.)
6. Always format floats without trailing zeroes (printf "%g") but see #1
7. (Maybe) fix minor math errors like degenerate matrices (but see #1)
8. Try not to fill in an implied part name (where an empty part name implies
previous part) unless necessary (due to edit).
9. Perform smart merges with the file copy to support simultaneous editing
10. Try in other ways to format new lines in the way established in the file?
a. when the file has a nice table format, respect that
These rules help preserve the freedom to use a text editor and leave control
over style where it belongs: with the human, who should be allowed to be sloppy.
On the other hand, a command to clean up a file's format would still be useful.
Comments welcome on any or all of these choices, especially where they might
have been ruled on already.
Exhibits:
vognhest.dat - Jacob Sparre Andersen's horse for the chariot has a table
format (see #10a) and dangling line remnant for alternative part (see #5).
http://jacob.sparre.dk/LEGO/Antikken/Romerriget/Circus_Maximus/circus.zip
on http://hugin.ldraw.org/LEGO/Antikken/Romerriget/Circus_Maximus/
|
|
Message has 3 Replies: | | Re: DAT files: Do No Harm
|
| (...) These 2 are the 2 biggest problems I have with MLCAD. For some reason MLCad changes the filename in the NAME comment block to an .ldr extension even if the source file is .dat. As more of a part author than a model builder, this is very (...) (22 years ago, 22-Aug-02, to lugnet.cad.dev, lugnet.cad.mlcad)
| | | Re: DAT files: Do No Harm
|
| I don't have any comments, except to say that I agree with pretty much everything you wrote. And that I'd be very hard-pressed to actually implement some of it. And I didn't completely understand all of your points... (...) Yes! (...) Good idea, (...) (22 years ago, 22-Aug-02, to lugnet.cad.dev)
| | | Re: DAT files: Do No Harm
|
| (...) I would go for this. If a line is indeed edited, then I would preserve it's indentation, but remove trailing decimal zeros, and possibly clean up other things, like changing "-0" to "0". If the file has any exponential notation, e.g, "2e1", (...) (22 years ago, 22-Aug-02, to lugnet.cad.dev)
|
14 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|