bbqqq

Use LDD as Building Instruction,Fully control steps,no generate time

Recommended Posts

I found a new way to use group function that turn LDD LXF file into easy to use digital building instruction.

Authors can manual fully control steps and building order. No more confuse, no more long time waiting for big LDD file to auto generate LDD BI.

Group & sub-group bricks by building order -> hide all -> hide each group icon then undo(ctrl+Z)to make bricks show up in building order.

For simple way. Just select groups icon in order to make LDD highlight each brick step by step.

Below is topic link of Realistic Helicopter Rotor Head Swashplate (Cyclic & Collective).

There are three Youtube video and many rendering pictures.

http://www.eurobricks.com/forum/index.php?showtopic=90047

Edited by bbqqq

Share this post


Link to post
Share on other sites

There is even more to say about groups and building instructions.

As hrontos discover time ago (take a look at "Using groups to generate correct instructions" reference the in Section Index), the BI generator included in LDD can interpret specific directives that it is possible to generate starting from LDD Groups.

Unfortunately poor tool regarding LDD Groups makes difficult to manage and correct the group structure from LDD GUI.

Your technique is interesting because it don't requires external tools and long elaboration time, but it can't produce a pdf/html digital booklet.

Share this post


Link to post
Share on other sites

@Calabar: Thanks, I am checking hrontos's works.

Beceuse LXF BI can rotate/zoom/hide/change_color/move/copy every groups step. So it can minimize building steps. and help making on pic BI.

The 21104 Cuusoo: NASA Mars Science Laboratory Curiosity Rover can be minimize ot 35 building steps only.

LXf: http://www.eurobricks.com/forum/index.php?showtopic=41226&st=3525#entry1779455

http://www.brickshelf.com/gallery/nachapon/94UCSSSD/56_21004_bi_bbqqq.lxf

11712858653_0cfe2c8788_z.jpg

lego 21104 one pic BI WIP by Nachapon S., on Flickr

Edited by bbqqq

Share this post


Link to post
Share on other sites

This is looking really good! But I guess there's no way to get part callouts?

Also, how did you make that exploded image? I would love to know which one of your tricks you used there!

Share this post


Link to post
Share on other sites

@BEAVer: Thanks, just temporary connect some dummy bricks(with un-use color) between group layers then delete them all at once(by color) afterward.

Edited by bbqqq

Share this post


Link to post
Share on other sites

Since I was asked to share the XSLT that can be used to convert groups in to BI steps, I attached the transformation.

Transformation outputs something like this:

<BuildingInstruction name="BuildingGuide1">
 <Step name="Step1">
   <Step name="Step1Substep1">
     <Step name="Step1Substep1Substep1">
       <Step name="Step1Substep1Substep1Substep1">
         <PartRef partRef="437" />
         <PartRef partRef="438" />
       </Step>
...
</BuildingInstruction>

It assumes,that your input file contains one main group split into more subgroups representing submodels and each subgroup can be split again into subgroups representing submodels of a submodel. Or the subgroup can contain individual parts that should be added in the given step.

maxnestlevel variable in the XSLT controls the nesting of BI steps.

Output should be pasted between <BuildingInstructions> elements at the end of the LXFML.

LDD will display these instructions, but camera view is not adjusted.

Also when there is any minor change made in the model, LDD will probably regenerate the instructions.

Technically, it is possible to change also camera view, but it is a manual work.

You can add:

<Camera cameraRef="1"/>

where cameraRef is a reference (number) to a camera defintion you create at the begining of the LXFML file.

Groups2BIs.zip

Edited by hrontos

Share this post


Link to post
Share on other sites

@hrontos, Thanks for share the process, I will try to learn it.

Trick to use LDD lxf file as interactive digital Building Instructions.

The "ghost" color for paint tools can be any brick, edit its LXFML -> materials="999".

That ghost effect is a cool and useful bug.

1. Works with max Advanced shading only

2. Edit lxfml to assign any brick with color that does not exist (ie:999) then open/import it in LDD.

3. Use dropper tool to suck the "ghost" color from it.

4. Use paint tool to assign ghost color to any brick or part of assembly.

5. Brick and part of assembly will become invisible but Advanced shading still draw the shadow shading so look like ghost bricks,. Have fun ;-)

LXF BI for set# 42022.

Three steps BI sample.

11974502973_dbfc4121f8_z.jpg

Lego Blockhouse 340-3 year 1968 by Nachapon S., on Flickr

Edited by bbqqq

Share this post


Link to post
Share on other sites

Since I was asked to share the XSLT that can be used to convert groups in to BI steps, I attached the transformation.

Transformation outputs something like this:

<BuildingInstruction name="BuildingGuide1">
<Step name="Step1">
<Step name="Step1Substep1">
<Step name="Step1Substep1Substep1">
<Step name="Step1Substep1Substep1Substep1">
<PartRef partRef="437" />
<PartRef partRef="438" />
</Step>
...
</BuildingInstruction>

It assumes,that your input file contains one main group split into more subgroups representing submodels and each subgroup can be split again into subgroups representing submodels of a submodel. Or the subgroup can contain individual parts that should be added in the given step.

I'm really impressed with the BIs that you've created using your XSLT transform. Is there any way you could you give a step-by-step outline of exactly what one does with the .lxf file to transform it with your XSLT transform.

I tried unpacking the .lxf and feeding the .lxfml file to your XSLT transform using xsltproc (in the Mac OS X terminal), but got nothing but errors. I tried saving the entire contents of the .lxfml file as an .xml file and still got errors.

Should I be taking only the "groups" sections of the .lxfml file and trying to transform them?

It seems like this tool could be very useful to many people but some more information about how to use it would be extremely welcome.

P. S. this is my first post on this forum, which I'm finding to be excellent.

Share this post


Link to post
Share on other sites

I'm really impressed with the BIs that you've created using your XSLT transform. Is there any way you could you give a step-by-step outline of exactly what one does with the .lxf file to transform it with your XSLT transform.

I tried unpacking the .lxf and feeding the .lxfml file to your XSLT transform using xsltproc (in the Mac OS X terminal), but got nothing but errors. I tried saving the entire contents of the .lxfml file as an .xml file and still got errors.

Should I be taking only the "groups" sections of the .lxfml file and trying to transform them?

It seems like this tool could be very useful to many people but some more information about how to use it would be extremely welcome.

P. S. this is my first post on this forum, which I'm finding to be excellent.

Whole LXFML file is expected as an input. Result has to be put back to LXFML file manually. I do not know xsltproc on Mac, I run it either in Visual Studio or using MSXML.

Edited by hrontos

Share this post


Link to post
Share on other sites

How do you get the edited LXFML back into LDD? If you import the .LXFML into a scene, and then go to "building guide mode", it generates brand new instructions, ignoring the ones you just created.

Share this post


Link to post
Share on other sites

The guide has to be complete. If even one single brick is omitted, LDD will generate it's own BI once again.

Share this post


Link to post
Share on other sites

Okay, I figured it out. I'll leave this here in case some poor fellow doesn't want to lose many hours of their life. First thing you need to do is export a LDD model as an LXFML with a couple groups already created. You should have only one main group that includes everything in your model. All other groups will then be subgroups under that. It's up to you how many subgroups you want to add, but the more detailed the subgroups, the better the instructions. Then, you need to:

1. Download hrondos' .zip file posted above.

2. Open the zip file and copy the .xslt file to any directory, I put mine in "C:\Users\jwillins"

3. Next you need to use an xml transform program. I downloaded MSXSL.exe from Micorsoft's website and put it in "C:\Users\jwillins"

4. Open a command prompt

5. Change the directory to the location of the MSXSL.exe ("cd C:\Users\jwillins")

6. Type 'msxsl.exe' into the command prompt, you should get a message describing how to use msxsl. Now that we know our parser is working, time to use it.

7. The command we want to run in the command prompt is:

  • msxsl c:\path\to\your\lego\file.LXFML Groups2BIs.xslt -xw -o name_of_output_file

  • msxsl - this calls the MSXSL.exe
  • c:\path\to\your\lego\file.LXFML - the LDD LXFML file with your groups you want to turn into instructions
  • Groups2BIs.xslt - this is the stylesheet hrondos created, it tells MSXSL.exe what to look for in the LDD LXFML and how to format it
  • -xw - this removes any whitespaces that are leftover after the parsing
  • -o name_of_output_file.txt - this outputs the build instructions to a text file

8. Now we have our new build instructions, we just paste them from your name_of_output_file.txt into the LDD LXFML at the very bottom into the build instructions tags and then save the file. You can leave this part out when copying over the instructions: "<?xml version="1.0" encoding="UTF-8"?>"

  • <BuildingInstructions>
  • your code here
  • </BuildingInstructions>

9. Here is where I lost many hours of my life. You can't just import the LXFML file into LDD b/c as soon as you hit Build Guide Mode, it generates brand new instructions. You have to rip open the .LXF file that you used to generate your LXFML in the first place. You can change the extension of the .LXF to .ZIP. Then you can unzip it and lo and behold, you can replace the .LXFML in the zip file with your own. Then change zip file's extension back to .LXF.

10. Now open the .LXF file in LDD.

I don't know if this was common knowledge to rip open .LXF files but I sure didn't know this.

Share this post


Link to post
Share on other sites

I have been using your instructions for a while, and I want to thank you very much. I have also written a *.bat file that makes it easier to do (you may need to edit them slightly depending on what directories you have). Here are the *.bat files:

Start_Building_Instructions.bat (this is just to make it easier to start so you don't need to remember the command line parameters):

%windir%\system32\cmd.exe /K CreateBuildingInstructions.bat LineBot.lxf

CreateBuildingInstructions.bat (change the values of LegoModelsNoQuotes, msxsl, and xslt to the values copy into a file named CreateBuildingInstructions.bat):

@echo off
set LegoModelsNoQuotes=C:\Users\Nathan Sokalski\Documents\LEGO Creations\Models\
set LegoModelsDir="%LegoModelsNoQuotes%"
set msxsl="C:\Users\Nathan Sokalski\Desktop\msxsl.exe"
set xslt="C:\Users\Nathan Sokalski\Desktop\Groups2BIs.xslt"
set lxfml=%~1ml
set xml=%~n1.xml
set zip=%~n1.zip

echo LegoModelsNoQuotes = %LegoModelsNoQuotes%
echo LegoModelsDir = %LegoModelsDir%
echo msxsl = %msxsl%
echo xslt = %xslt%
echo lxfml = %lxfml%
echo xml = %xml%
echo zip = %zip%
echo/

cd %LegoModelsDir%

echo Please export %~1 as %lxfml%
echo %~1 will now open, close it after exporting
pause
"%~1"
echo/

echo msxsl.exe will now create %xml% from %lxfml%
pause
%msxsl% "%lxfml%" %xslt% -xw -o "%xml%"
echo/

echo %~1 will now be renamed to %zip%
pause
ren %1 "%zip%"
echo/

echo Please copy IMAGE100.LXFML from %zip% to %LegoModelsNoQuotes%
echo Windows Explorer will now open, close it after copying
pause
%windir%\explorer.exe %LegoModelsDir%
echo/

echo Please copy all text (except 1st line) from %xml% to the Clipboard
echo NotePad will now open, close it after copying
pause
%windir%\notepad.exe "%xml%"
echo/

echo Please paste the copied text at the end of IMAGE100.LXFML between the BuildingInstructions tags
echo NotePad will now open, close it after pasting and saving (make sure to first delete anything already between the BuildingInstructions tags)
pause
%windir%\notepad.exe IMAGE100.LXFML
echo/

echo Please copy IMAGE100.LXFML to %zip% replacing the existing one
echo Windows Explorer will now open, close it after copying
pause
%windir%\explorer.exe %LegoModelsDir%
echo/

echo IMAGE100.LXFML, %xml%, and %lxfml% will now be deleted
pause
del IMAGE100.LXFML
del "%xml%"
del "%lxfml%"
echo/

echo %zip% will now be renamed to %~1
pause
ren "%zip%" "%~1"
echo/

echo The new %~1 will now be opened
pause
"%~1"

You will need to modify Start_Building_Instructions.bat for each of your models. I have been trying to find a way to automate some of the steps such as pasting the copied text into IMAGE100.LXFML, but the Windows Command Prompt has limitations on the amount of text it can work with (IMAGE100.LXFML is larger than it can edit). Hopefully this makes things easier!

Share this post


Link to post
Share on other sites

I have been using Groups2BIs.xslt for a while now, and it usually seems to work pretty well. However, it occasionally creates building instructions that get immediately overwritten by instructions generated by LDD, even though I do not modify my model and go straight to the building guide after opening LDD. I have checked to make sure my groups include all bricks and have only 1 root group, but the problem still remains. I seem to remember hearing something about using directives with LDD, but never found anything (are there any kind of directives for LDD?) I also seem to remember there being some kind of limit as to the nesting level (I think it said 4?), although the *.xslt file has a value of 999999 for maxnestlevel. Does anybody have any suggestions? Thanks.

Share this post


Link to post
Share on other sites

Referring to Hrontos post #6, it seems that the transition to the new board removes the attachment (maybe because zip files are now allowed anymore).

So here is a copy of the attachment: CLICK.

 

Share this post


Link to post
Share on other sites

Like I said in my post, it does not ALWAYS keep with the Groups result, only SOMETIMES. It always creates BIs, just not always ones that match the groups.

Share this post


Link to post
Share on other sites

Did you make some try?

I mean... did you understand why sometimes it works and sometimes it immediately rewrite the "BuildingInstruction" area? Maybe it is due to an excessive number of nested levels? If I'm not wrong, max level supported is three.

PS: it would be better to enclose the long code you write above inside "code" tags, and maybe remove all that bold from the following post.

Share this post


Link to post
Share on other sites

If 3 is the max nest leve, then I that is probably the reason for my problem (I thought it was 4). I am not especially familiar with editing xslt, but I would guess that there is some way to modify the code to support more, and 3 seems like somewhat of a small number. At some point I may try to learn enough about writing xslt so that I can make my code usable for deeper nesting levels, and I'm sure that both me and many other users would appreciate any help in doing this, and if I do figure out a way to make it work I will be sure to post it here.

Share this post


Link to post
Share on other sites

I don't think it is a matter of code. The code generated by the hrontos script is correct, but it seems that LDD is not able to read more than three (or maybe you are true four... I'm not absolutely sure!) nested levels.
My guess is that in the newest versions of LDD overwrite the " BuildingInstruction" area when this problem occurs (previous versions simply ignored the deeper levels, if I'm not wrong). But it is only a guess, maybe some try will help us to clarify.

Share this post


Link to post
Share on other sites

Just to let everyone know, I made a python script that does exactly as proposed before by hrontos. It operates on an exported lxfml and uses the group information to create building instructions. It also directly creates a new lxfml file that can be imported into LDD, so no more copying and pasting by hand.

So far, it works fine. More refinements are conceivable, such as checks that the groups are well-formed and all parts are actually in a group and only in one group. I'll get to these as the need will arise.

You can find the script here: https://github.com/mfeldt/GS2BI
And a somewhat lengthy video tutorial how to make instructions with it here: https://www.youtube.com/watch?v=mbef20mRTrI

 

Edited by mfeldt

Share this post


Link to post
Share on other sites

Very interesting work.

Anyway I think that if you want really made the difference (compared to hronts's script), your script should operate with the lxf file directly. Surely python provide libraries that allow to easily operate inside zip files. This will avoid the need to extract/repack the lxfml file, an operation that could be not so easy for users. For this kind of users it could be even better if you provide an executable (using PyInstaller?), maybe with a drag-n-drop interface (frankly I don't know if including some kind of GUI could make things too complex).

Another heavy limitation seems to be "Each part must be in one and only in one group". Do you mean that the script is not able to manage subgrups? The idea of a list of consecutive groups seems good for a "fine tuning" of instructions, but I think that the most common case is to use an already grouped file (groups are very useful outside the instruction matter) letting the groups will guide the LDD automatic BI generation but not for each single steps. In this way you have not to "destroy" the already present grouping and creating BI becomes a very fast operation.

Share this post


Link to post
Share on other sites

OK.... thanks for the feedback!  I didn't see the lxfml as a problem so far since LDD reads and writes these directly - no need to unpack or repack anything!  The zip step wouldn't be over-complicated, but personally I work with lxfml anyway since they're simply more comfortable!

I'll follow the idea with the executable once I've implemented more checks to enhance usability.

Of course the script handles subgroups!  As many as you wish... and this is actually used for creating the substeps in the BI!  I tried to have LDD auto-generate BIs on finely sub-grouped models, but they didn't seem to follow the grouping in any way.

Share this post


Link to post
Share on other sites

Thanks for the answer. :classic:

About using the lxf file directly, I was referring to users with very basic informatics abilities (in the previous post I was looking for a understandable word to describe them, but I forgot to add it :grin: ). I often deal with this kind of users and I ensure you that extract an lxf file is a complex (or even prohibitive!) operation for them.
If python has a proper library, manage the lxfml file inside the lxf file should not be complex.
EDIT: this article seems a quite simple guide and provide the proper methods for our case (open the zip file in read only, read the lxfml file, write a new lxf file using the modified lxfml file and the original lxf image).

About the subgroups, I'm glad I've misunderstood the reported sentence. Anyway don't forget that LDD BI can't work on more than three or four sublevels, as remembered in this topic too. Maybe is this the reason why in your experience sub groups seemed to don't influence BI?

About the executable, maybe it is not necessary to create a GUI. The application could simply work dragging and dropping the lxfml(lxf) file on the executable, that create a new file containing the index. I've a little executable that works exactly in this way (it fixes srt subtitles), so it is surely possible.
Another easier (to implement) solution could be to couple the python file with a batch file (you could call it "drop_on_me.bat"). Dragging the lxfml file on the batch file it will execute the script, something like (need to be tested, probably fixed):

@echo off
for %%a in (%*) do python2 gs2bi.py "%%a" "%~dp0""%%~na_BI%%~xa"

Maybe an error message if gs2bi.py is not in the same directory as the batch file would be very useful too. Something like:

@echo off
IF EXIST "%~dp0gs2bi.py" (
  for %%a in (%*) do python2 gs2bi.py "%%a" "%~dp0""%%~na_BI%%~xa"
) ELSE (
  ECHO gs2bi.py have to be placed in the same directory of the batch file
  pause
)

 

Share this post


Link to post
Share on other sites

I use this to process lxf (=zip files) and read the lxfml file in my python scripts

archive = zipfile.ZipFile(lxf_filename, 'r')   

    lxfml_file = archive.read('IMAGE100.LXFML')

    tree = ET.fromstring(lxfml_file)

 

Of course you need to import zipfile and ElementTree

 

Edited by M2m

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.