LDInstruction - Printable Version +- LDraw.org Discussion Forums (https://forums.ldraw.org) +-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html) +--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html) +--- Thread: LDInstruction (/thread-25725.html) Pages:
1
2
|
LDInstruction - Stefan Frenz - 2021-12-12 Thanks to all helping me with LDInspector. In the last weeks I wrote a new module to generate instructions from a MPD model. It is far from being complete or feature-rich like LPub3D, but for me it suits better in some situations. The generated file is a LibreOffice Draw (odg) file, so further modification is very easy and only limited by LibreOffice. You may give it a try if you have Java installed (no need for JavaFX for this module). You only need the jar file and a context definition file LDInspector.ldi - you can use the one created by LDInspector or create one containing one line per LDraw part source like in Code: 0 FILE LDIContext.ldi To start the GUI, please use Code: java -cp ldinstr.jar ldinsp.guisw.InstructionHelper For a slightly modified version of the 603 model you should get an output odg file looking like the attached image: To me this approach has several PROs and CONs:
I would appreciate any feedback or even "this could be done easier using x, y or z". If there is interest in this project, the GUI will have to support the process much more than it does at the moment like hinting about options (left align, center align, right align, fixed offset), support in creating a valid LDInspector.ldi file and maybe a page-preview for multiple steps. Best regards and thanks in advance Stefan RE: LDInstruction - Philippe Hurbain - 2021-12-12 Hi Stefan, Looks like I do something wrong (problem of not mastering the subject ). When I launch LDInstruction I get Code: Exception in thread "main" java.lang.UnsupportedClassVersionError: ldinsp/guisw/InstructionHelper has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 RE: LDInstruction - Stefan Frenz - 2021-12-13 Hi Philippe, thanks for trying. The current jar-file is made for Java 11 or later. Tomorrow After some sleep I should find time to re-compile with Java 8 as target. Best regards Stefan RE: LDInstruction - Stefan Frenz - 2021-12-13 I updated the snapshot jar file, it should now work with Java 8 or later. The GUI is now marked as main class, to start it you can shorten the command line: Code: java -jar ldinstr.jar # now sufficient In the current jar file there is a command line version integrated to generate the instruction-odg which does exactly the same as the GUI-button "build instructions": Code: java -cp ldinstr.jar ldinsp.instr.BuildInstructions YOUR_MPD_FILE.mpd [OUTPUT.odg] As most of LDInspector is included, you may also use this jar file to check OMR validity: Code: java -cp ldinstr.jar ldinsp.tools.LDITFileChecker YOUR_MPD_FILE.mpd And you can get the bill of material for one or more models step-by-step and sub-model-by-sub-model and summed up: Code: java -cp ldinstr.jar ldinsp.tools.LDITBillOfMaterial YOUR_MPD_FILE.mpd [MORE.mpd] [MORE2.mpd] RE: LDInstruction - Philippe Hurbain - 2021-12-13 (2021-12-13, 7:06)Stefan Frenz Wrote: I updated the snapshot jar file, it should now work with Java 8 or later.It works! Now I'd like to know why when I updated my Java I was not even proposed to update to Java 11 !!! (but of course that's not your problem ) ...still struggling to understand how to go from raw 603 model to your nice single page modified version... RE: LDInstruction - Stefan Frenz - 2021-12-13 (2021-12-13, 10:02)Philippe Hurbain Wrote: It works! Now I'd like to know why when I updated my Java I was not even proposed to update to Java 11 !!! (but of course that's not your problem ) Java 8 is really different to Java 9 and later, so most systems have the option to keep version 8 updated and some other (higher) version updated seperately. As my current jar file does not need JavaFX, it is now "old school" without the Java module system... Bad thing from my point of view, but unfortunately nothing we can do about. I'm happy that it worked for you now. For the single page version, the step/maxColumns and step/maxRows options are changed from default 1 to value 0. This can be done by inserting at each submodel Code: 0 !LDINSP INSTR [step/maxColumns=0] [step/maxRows=0] There are several options which clearly need some documentation... I'm working on that. RE: LDInstruction - Philippe Hurbain - 2021-12-13 (2021-12-13, 11:54)Stefan Frenz Wrote: There are several options which clearly need some documentation... I'm working on that.Maybe, yes! Already got it working somewhat nicely though... RE: LDInstruction - Stefan Frenz - 2021-12-13 (2021-12-13, 10:02)Philippe Hurbain Wrote: ...still struggling to understand how to go from raw 603 model to your nice single page modified version... All changes are LDraw comments (type 0 lines) with "!LDINSP INSTR" or "!LDINSP INSTRSC" prefix. Every option is enclosed in brackets like [key=value]. Ordering or position of the corresponding line inside the step is not relevant, meaning: you can place every option for a step everywhere between the STEP/ROTSTEP lines. For convenience, the InstructionHelper GUI always places parameter changes at the top of the step and always in the same order, arranging corresponding options per line (e.g. "rotX" and "rotY" and "rotZ" are in one line and "step/maxColumns" and "step/maxRows" are in another line). All parameters can be set with the GUI. No keyword has to be remembered or typed in. The following changes inside the official omr lead to the given example (downloadable here):
In more detail: Code: 0 !LDINSP INSTR [doc/dpi=150] [doc/width=29700] [doc/height=21000] [doc/margin=1000] Second line: define background colors for model (light blue), part list inventory (darker light blue) and inlined sub-steps (light yellow). Code: 0 !LDINSP INSTRSC [scope=3626ap01.dat] [pli/rotX=15] [pli/rotY=0] Code: 0 !LDINSP INSTR [zoom=2]
The sidecar sub-file has Code: 0 !LDINSP INSTR [step/modelX=-2] [step/modelY=-1] The wheel sub-file has Code: 0 !LDINSP INSTR [inline] The added body sub-file has another sub-file flag Code: 0 !LDINSP INSTR [aspart] update: LDInstruction - Stefan Frenz - 2021-12-13 info: uploaded new current version snapshot (same address) to fix endless loop on some unexpected layout conditions RE: update: LDInstruction - Stefan Frenz - 2021-12-14 info: again updated "current version" to fix corner case column width problems RE: LDInstruction - Stefan Frenz - 2021-12-14 After some more tests, I took a chance to check for a technic model with integrated parts. Thank you Philippe for your Sorter MOC which I was allowed to use therefore. Now there are at least three bugs less. Attached is the changed mpd, only empty steps are removed and only basic LDINSTR meta commands are added: Code: 0 !LDINSP INSTR [doc/dpi=150] [doc/width=29700] [doc/height=21000] [doc/margin=1000]
Unfortunately I was not able to attach the generated odg file to this post, so the generated pdf is added for convenience. If you like to generate the odg, please just call the current unstable version with Code: java -cp ldinstr.jar ldinsp.instr.BuildInstructions Sorter.mpd SorterInstructions.odg RE: LDInstruction - Stefan Frenz - 2021-12-14 ...and some more rotations... RE: LDInstruction - Stefan Frenz - 2021-12-15 ...some more tweaking to have page breaks at convenient steps, changed zoom from 1 to 2 to have bigger images. I would treat this one as "ready". RE: LDInstruction - Stefan Frenz - 2021-12-15 ...to allow uploading the pdf, I had to merge two steps (wheels and cable bush)... All instructions are explained already except for: Code: 0 !LDINSP INSTR [step/pliBoxMaxWidth=-1] Code: 0 !LDINSP INSTR [highlight=1] [highlightRgb=00FF0000] [highlightWidth=2] RE: LDInstruction - Roland Melkert - 2021-12-15 (2021-12-12, 13:09)Stefan Frenz Wrote: I wrote a new module to generate instructions from a MPD model. This seems very interesting, it might actually motivate me to install Java (again) so I can give it a try. Also nice to see someone adapting the LDCad meta line format RE: LDInstruction - Stefan Frenz - 2021-12-16 (2021-12-15, 23:18)Roland Melkert Wrote: This seems very interesting, it might actually motivate me to install Java (again) so I can give it a try. I would appreciate any feedback! And indeed for LDInspector I already had to implement the reading part of the LDCad meta line format, and it's exactly what I needed. Thanks for the blueprint. LDInstruction version 0.1 - Stefan Frenz - 2021-12-16 Now there is a version 0.1 packed for further reference. Thanks again to Philippe - your model removed some really relevant bugs. The following screenshots are taken from a built instruction:
Code: 0 !COLOUR Dark_Bluish_Grey CODE 72 VALUE #646464 EDGE #D0D0D0 LDInstruction version 0.1 documentation - Stefan Frenz - 2021-12-16 This post explains the currently (version 0.1) available options.
Global parameter (prefix: "doc/") which can be set only once and may occur only in the first step of the main model:
Code: 0 !LDINSP INSTR [doc/dpi=150] [doc/width=29700] [doc/height=21000] [doc/margin=1000] Step rendering parameter (prefix: "step/") define options regarding layout and step.
Code: 0 !LDINSP INSTR [maxWidth=23500] [maxHeight=19000] Inline sub-model parameter (prefix: "inl/") define options regarding inlined models:
Code: 0 !LDINSP INSTR [inl/zoom=1.5] Model rendering parameter (no prefix) and part list inventory rendering parameter (prefix: "pli/"):
Code: 0 !LDINSP INSTR [maxWidth=23500] [maxHeight=19000] Code: 0 !LDINSP INSTR [pli/maxWidth=9000] [pli/maxHeight=9000] Additionally, the first step of a sub-model may contain at most one of the following two parameters:
Code: 0 !LDINSP INSTR [inline] Colors can be defined with standard LDraw colour meta, example: Code: 0 !COLOUR Black CODE 0 VALUE #1B2A34 EDGE #D0D0D0 Scoped pli-instructions define parameters for not-included (meaning: standard LDraw) parts, example: Code: 0 !LDINSP INSTRSC [scope=2462.dat] [pli/rotY=0] LDInstruction example - Stefan Frenz - 2021-12-16 This post shows another small example: the omr model 1972 is slightly changed (see mpd file attached to this post), resulting in six pages which are fully editable in LibreOffice. Of course the hoses in step 9 may be replaced, but shown here is the unmodified generated odg output: LDInstruction pli part replacement - Stefan Frenz - 2021-12-17 ...updated current version to support part replacement in part list inventory. For included sub-models, in the first step add something like Code: 0 !LDINSP INSTR [tg/replace=76348.dat] Code: 0 !LDINSP INSTRSC [scope=3022.dat] [tg/replace=76348.dat] With this option the hoses in step 9 look nicer in the pli: LDInstruction howto - Stefan Frenz - 2021-12-18 here is a small how to get from a small model like 40190 to a single sided instruction like this: Way 1: use the GUI. 1. Load the file and check/adjust global settings like dpi and page size according to your needs (default is DIN A4 landscape / 150 dpi). 2. In the main model step 1 enable "noResult" overwrite and set "noResult" value to "on". 3. In the car sub-model step 1 enable "step/modelX" overwrite and set its value to "-2" (right align). Also enable "step/maxCols." and "step/maxRows" and set their values to "0" (automatic column and row layout). 4+5. In the wheel sub-model and 93589p01 sub-part root (above step 1) activate overwrite "aspart" and set value to "on". Way 2: insert meta lines in mpd. 1+2. In the first step of the main file, set dpi, page size and switch result to off by adding Code: 0 !LDINSP INSTR [doc/dpi=300] [doc/width=29700] [doc/height=21000] [doc/margin=1000] 3. In the first step of the car sub-model set zoom, right align and layout by adding Code: 0 !LDINSP INSTR [zoom=1.3] 4+5. In the wheel sub-model and 93589p01 part sub-model set aspart option by adding Code: 0 !LDINSP INSTR [aspart] That's it, have fun. LDInstruction step container split - Stefan Frenz - 2021-12-18 the current version allows splitting the pli/inline/model container into separate boxes via new boolean parameter step/split. This results in top-down alignment of pli/inline/model, for example helpful in step 10 of model 40191 (modified version attached): RE: LDInstruction step container split - Philippe Hurbain - 2021-12-18 (2021-12-18, 11:14)Stefan Frenz Wrote: the current version allows splitting the pli/inline/model container into separate boxes via new boolean parameter step/split. This results in top-down alignment of pli/inline/model, for example helpful in step 10 of model 40191 (modified version attached):Busy on some other project, but I'll come back soon Looks more and more awesome. One question, do you intend to allow to add a global BOM (or maybe it already exists?) RE: LDInstruction step container split - Stefan Frenz - 2021-12-18 BOM is on about second position of my ToDo list together with model title page. I'm still fiddling how to express my wishes to the program, and I would like to have not only "plain" BOM but BOM for building sections. Maybe some kind of a table? Still thinking how to tell the program... Or is this useless at all? LDInstruction version 0.2 - Stefan Frenz - 2021-12-19 Now there is a version 0.2 packed for further reference. Main changes:
RE: LDInstruction step container split - Gerald Lasser - 2021-12-20 (2021-12-18, 17:33)Stefan Frenz Wrote: BOM is on about second position of my ToDo list together with model title page. I'm still fiddling how to express my wishes to the program, and I would like to have not only "plain" BOM but BOM for building sections. Maybe some kind of a table? Still thinking how to tell the program... Or is this useless at all? I think a BOM in a list style is definately also a good idea, may be even a BL Style wanted List. FOr the Classic-Lego-Instruction Style BOM, I would wish for a possibility to "sort" eventually parts by myself to get a space efficient layout. RE: LDInstruction step container split - Stefan Frenz - 2021-12-20 (2021-12-20, 7:51)Gerald Lasser Wrote: I would wish for a possibility to "sort" eventually parts by myself to get a space efficient layout. Thanks for your input. As everything is generated into an OpenDocument Draw file, one could re-sort as needed afterwards, but this is kind of painful for many parts. I was thinking of the sorting categories width, height, color, LDraw part number, LDraw part description; so there could be an option to define in which order those categories should be applied. Do you have an idea how to express your sorting wish? I could even think of a small source code API like this: Code: int diff=o1.getColId()-o2.getColId(); RE: LDInstruction step container split - Stefan Frenz - 2021-12-20 (2021-12-20, 8:32)Stefan Frenz Wrote: Do you have an idea how to express your sorting wish?Another idea: specify the parts in the exact order you would like to have them printed and a small routine that prints all commands with a default sorting...? LDInstruction: BOM attempt - Stefan Frenz - 2021-12-21 So this is the first attempt to have a BOM: for 603: for 1972: Not yet implemented is a table style with part description right besides the image. Command to insert is at the moment: Code: 0 !LDINSP INSTRCMD [cmd=bom] I'm not sure about the sorting. What about sort parameter? This would be like this: Code: 0 !LDINSP INSTRCMD [cmd=bom] [sort=color,description,width] Printing text is still a nightmare because of unknown width: at the moment, text is included "as text" in my program, only opening the file in Draw will show the resulting text width. Hmmmmmm. RE: LDInstruction: BOM attempt - Stefan Frenz - 2021-12-23 BOM-option with description (example shows 603): At the moment, reserved width for text has to be specified and is fixed, resulting in cropped text (like in last part of left column: "... with 1 Centre Stud"). The text is still "there", but "not visible", i.e. editing with LibreOffice Draw (or any other odg capable processor) will show the complete text and allows reformatting. In my code there is still some inconvenience in text handling (for example wrong y-align of "1x Plate 2 x 2"). I will have to spend more time on this which is not abundantly available at the moment. I need to pack some more Christmas brick gifts... (2021-12-20, 7:51)Gerald Lasser Wrote: I think a BOM in a list style is definately also a good idea, may be even a BL Style wanted List.Would the currently available list styles (option 1: image with amount below like in previous post, option 2: image with amount and description aside like in this post) meet your use cases? RE: LDInstruction - Philippe Hurbain - 2021-12-27 I played a little more with LDInstructions, and of course I get more questions... - It seems that the page break when there is a new submodel is inserted AFTER the first step of that submodel. I expected the break to occur before that step. - Is there a way to apply common settings to all submodel of a file? I used a vertical model, and having to change each assembly max size from landscape to portrait is a bit daunting... Question applies also to change each submodel to multi-step per page. RE: LDInstruction - Stefan Frenz - 2021-12-27 (2021-12-27, 17:10)Philippe Hurbain Wrote: - It seems that the page break when there is a new submodel is inserted AFTER the first step of that submodel. I expected the break to occur before that step.Hm. I would expect that, too. Maybe the sub-model has only maximum of 1 row? Maybe the current container on the page is not full before the first step of the submodel, so if it has enough space and the container allows placing another step... Would you mind mailing me your test file so I can dig into it? (2021-12-27, 17:10)Philippe Hurbain Wrote: - Is there a way to apply common settings to all submodel of a file? I used a vertical model, and having to change each assembly max size from landscape to portrait is a bit daunting... Question applies also to change each submodel to multi-step per page.At the moment the GUI represents only options that the backend understands 1:1, but there are some options (like mentioned col/row layout and maxSize parameter as well as highlighting or linewidth) that clearly should be set-able once for all submodels. To set options in all submodels by GUI is on the ToDo list but not implemented yet - I'm still thinking about some "treat this as default" as separate option (like "doc/maxWidth") which would make this GUI feature needless. PS: still fiddling with details of the BOM... LDInstruction current version with BOM - Stefan Frenz - 2021-12-28 the BOM, text and break commands are now available in the current version, the attached 603 example generates these two pages: There is a new LDINSP-meta: INSTRCMD. This takes exactly one cmd option (at the moment: break, text or bom) and options dependent on the command. Examples: Code: ...
At the moment, the INSTRCMD is handled well by the GUI, but there is no GUI to insert/edit/remove INSTRCMD metas (on the ToDo list). RE: LDInstruction current version with BOM - Stefan Frenz - 2021-12-28 ...current version updated again and clarified options in previous post... LDInstruction current version allowing LDCad paths - Stefan Frenz - 2021-12-29 There is a new current version of LDInstruction that does not interfere with generated LDCad path file content. All previous versions of the GUI store LDInstruction commends illegally between re-generated lines, so they are are removed on LDCad save (as stated by LDCad). Starting with this LDInstruction version the GUI stores meta lines before the re-generated lines, so they persist LDCad load-generate-save. Thank you to Philippe for the test model. RE: LDInstruction current version allowing LDCad paths - Philippe Hurbain - 2021-12-29 (2021-12-29, 13:19)Stefan Frenz Wrote: There is a new current version of LDInstruction that does not interfere with generated LDCad path file content.FYI the link above refers to your hard disk instead of your website RE: LDInstruction current version allowing LDCad paths - Stefan Frenz - 2021-12-29 *oooops* thank you! I modified the wrong link. LDInstruction version 0.3 - Stefan Frenz - 2021-12-30 Now there is a version 0.3 packed for further reference. Main changes:
Parameter for [cmd=text]:
Parameter for [cmd=break]:
Parameter for [cmd=bom]:
The GUI has some basic instruction editing feature, but it does not support via suggesting instruction command names or parameter options (somewhere down on ToDo list). LDInstruction current version with some more stuff - Stefan Frenz - 2022-01-03 The current version allows some new things:
Additional GUI changes:
RE: LDInstruction current version with some more stuff - Stefan Frenz - 2022-01-03 examples for PLI options: default: Screenshot_01_default.png (Size: 11.54 KB / Downloads: 125) change sort order via [step/pliSort=...]: Screenshot_02_sort.png (Size: 11.52 KB / Downloads: 124) again change sort order via [step/pliSort=...], limit pli box width via [step/pliBoxMaxWidth=...], enable annotations via [step/annotate=1]: Screenshot_03_sortAnnotateSize.png (Size: 12.62 KB / Downloads: 122) RE: LDInstruction current version with some more stuff - Stefan Frenz - 2022-01-04 Layout example, built from attached mpd: LDInstruction current version with even more stuff - Stefan Frenz - 2022-01-07 Thank you, Philippe, for your very helpful feedback and your test file. As result, the current version has some new features:
LDInstruction examples - Stefan Frenz - 2022-01-07 Examples for "color sorting" and "explicit pli". default color order is ascending color id: same sort rank for black and rubber black via "0+256,..." (rubber black and black are treated to be equal for sorting) Code: 0 !LDINSP INSTR [doc/colorOrder=0+256,1,4,7,14] different sort rank for all colors via "0,256,..." (only tire position differs: now rubber black is after black) Code: 0 !LDINSP INSTR [doc/colorOrder=0,256,1,4,7,14] default pli for minifig in step 6: Screenshot_4_defaultPLI.png (Size: 6.47 KB / Downloads: 101) explicit pli (as all parts in step 6 are in different colors, this re-sorting could be done also by changing the color order, but color order is global; additionally with INSTRDIR "pli" the complete appearance of the pli can be changed including part name, zoom, rotation or part count, skipping parts or adding different ones) Code: 0 !LDINSP INSTRDIR [type=pli] [part=3815c01.dat] [color=0] [count=1] Screenshot_5_explicitPLI.png (Size: 6.44 KB / Downloads: 104) explicit pli with [newLine] option Code: 0 !LDINSP INSTRDIR [type=pli] [part=3815c01.dat] [color=0] [count=1] Screenshot_6_explicitPLInewLine.png (Size: 6.53 KB / Downloads: 102) RE: LDInstruction - Jaco van der Molen - 2022-01-15 OK, this looks very nice! I will certainly give it a try. RE: LDInstruction - Stefan Frenz - 2022-01-15 I would happy to read about what you like and what you are missing update: LDInstruction - Stefan Frenz - 2022-01-25 There is a new current version which now supports explicit pli annotation (or as before: automatic ones) and supports explicit bom description text (or as before: default text with amount and part description). Each pli directive can have the new parameter "annotate" like this Code: 0 !LDINSP INSTRDIR [type=pli] [part=3001.dat] [color=15] [count=3] [annotate=Test] Screenshot_1.png (Size: 4.17 KB / Downloads: 76) Each bom command (complete bom or direct bom) can have the new parameter "text" like this Code: 0 !LDINSP INSTRCMD [cmd=bom] [textwidth=9000] [text=%ax %n in %c\n%d]
Using a format string "%ax %n in %c\n%d", a section of the bom of 603 looks like this: Screenshot_2.png (Size: 21.6 KB / Downloads: 76) update: LDInstruction - Stefan Frenz - 2022-02-02 There is a new current version which now supports a new command "image" to add an arbitrary model/step image. The GUI now has better help while editing commands and directives. So for example, adding a title page can be done by adding something like Code: 0 !LDINSP INSTRCMD [cmd=image] [before] [maxWidth=19000] [maxHeight=27700] [zoom=2.0] [shiftX=-1100.0] [shiftY=2200.0] RE: LDInstruction - Stefan Frenz - 2022-02-02 (2022-01-07, 14:58)Stefan Frenz Wrote: Thank you, Philippe, for your very helpful feedback and your test file. With Philippe's permission, I would like to point out the main steps to get instructions like these:
As long as there is only one step on one page, this should be straight forward. But if there are multiple steps on one page or even two columns (for example here: steps 1-9), the rendered image size has large impact on page breaks. Everything can be done in the GUI. But if you like to know what is done internally, the following snippets show interesting lines that were added to the LDraw file: Code: 0 !LDINSP INSTR [doc/dpi=150] update: LDInstruction - Stefan Frenz - 2022-03-05 The current version has some new features to fade out previous steps:
Default (standard highlighting, no fadeout): Standard highlighting, 50% fadeout towards FFFFFF: Standard highlighting, 75% fadeout towards FFFFFF, 75% transparency: No highlighting, 75% fadeout towards 7F7F7F, 75% transparency: Different fadeout values may support understanding a building step with hidden elements like step 57 in Philippe's Santa clock: Standard highlighting, 65% fadeout towards FFFFFF, 85% transparency for step 57 only: RE: LDInstruction - Cam's Bricks - 2022-03-14 I have downloaded this and looked at the various examples but I cannot seem to get anything like the examples. I am coming from LPub3D so please excuse my ignorance but Is there no way to see each page in the program? I am also not seeing any PLI or an easy way to create callouts or effectively use submodels. |