How to "inline" a sub-model?


How to "inline" a sub-model?
#1
I noticed that Tore Eriksson "inlined" a lot of parts in Datsville in the past. I'm not sure exactly what that means, but I'm guessing it means removing a model from a sub-assembly and placing it in a higher-level parent model without messing up the model's position.

I would like to do the same. I would like to extract minifigures from within individual MPD models and place them in a higher "traffic" layer without screwing up their positions.

Am I being clear? How do I accomplish this?
Reply
Re: How to "inline" a sub-model?
#2
The easiest way to do this that I know about is to use the inline feature of LDraw Design Pad (LDDP)
Reply
Re: How to "inline" a sub-model?
#3
Inlining means that you substitude a linetype1 reference with the content of that referenced file and take care of the position and orientation.
There are several tools nowadays that can help you to do that (DATHeader, LDDP, Inliner etc.). Depending on real task every application has it benefits.

I hope this answers your question.
Reply
Re: How to "inline" a sub-model?
#4
Agreed, this is my tool of choice for this job (except when I need deep inlining down to triangles and quads, there are better tools for that). LDDP is here. LDDP is also useful to do the inverse transformation (create submodels).
Reply
Re: How to "inline" a sub-model?
#5
You can also use my LDCad and it's nesting feature. Just enter nesting mode using the top level model ('n' while nothing is selected) , select (some) of the submodel's parts and press ins. Those parts will the be inserted (cloned) at the top top level model. When done just delete the original sub model reference if needed.
Reply
Re: How to "inline" a sub-model?
#6
How do I go about doing this?

I have "block_012.ldr" which references "building_009_miningfacility.mpd" which references "pedestrian_036_bluefiguresit2.ldr" and "pedestrian_037_bluefiguresit1.ldr". The model "building_009_miningfacility.mpd" uses local coordinates, and "block_012.ldr" uses global coordinates.

This is all for Datsville of course.

https://code.google.com/p/datsville/
Reply
Re: How to "inline" a sub-model?
#7
I hope I understand now correctly what you like to do:

You have a pedestrian that is in model a that is used in model b. Now you want to "move" the pedestrian to model c that is also referenced in model b and the pedestrian should be at the exact same position.

Hmmm....
If that is correct I do not know about an actual tool that can handle that task.
I have a very vague idea how to solve that, but currently it is too late to give a fully qualified solution.

In the meantime please answer if my idea of your problem is correct.
Reply
Re: How to "inline" a sub-model?
#8
No. The pedestrian is in model a, which is referenced in model b. Model b is referenced in model c. I want to remove model a from model b and place it in model c.

The coordinates are the issue as they are not the same in all three models.
Reply
Re: How to "inline" a sub-model?
#9
Roland Melkert Wrote:You can also use my LDCad and it's nesting feature. Just enter nesting mode using the top level model ('n' while nothing is selected) , select (some) of the submodel's parts and press ins. Those parts will the be inserted (cloned) at the top top level model. When done just delete the original sub model reference if needed.

That is a good idea, except the minifigure is inside a building and cannot be selected from outside using the mouse.
Reply
Re: How to "inline" a sub-model?
#10
Michael Heidemann Wrote:Inlining means that you substitude a linetype1 reference with the content of that referenced file and take care of the position and orientation.
There are several tools nowadays that can help you to do that (DATHeader, LDDP, Inliner etc.). Depending on real task every application has it benefits.

I hope this answers your question.

OK, that's not what I want.
Reply
Re: How to "inline" a sub-model?
#11
I see, given the fact you not actually want to inline ( http://forums.ldraw.org/showthread.php?t...2#pid10812 )

You just need to obtain the abs pos/ori of the reference in question ?

This you can do by entering nesting and selecting the origin part of the minifig (whatever part is at 0,0,0 in the minifig mpd).
Then open the property dlg for the selection (enter key). During nesting all those numbers are at toplevel coordinates, copy them (dlg right click popup menu).
Leave nesting (shift+n) and insert a new minifg reference anywhere.
Open the props dialog again and paste the pos/ori

ps: When something is blocking the minifig just temporay move stuff in order to do the posori copy and hit ctrl+z afterwards.
pps: I just finished part hiding in my dev tree of 1.3 Smile
Reply
Re: How to "inline" a sub-model?
#12
On the topic of inlining...

Does anyone know how to reverse this process? It seems a lot of Datsville buildings' sub-models were inlined, but I think it's much better from an editing perspective to retain the original structure in the form of MPDs.
Reply
Re: How to "inline" a sub-model?
#13
As far as I know this is only possible under some circumstances. Generally I would say no, that is impossible, as I tried it in the past.
If someone has a solution for this that works in any case, please let me know.
Reply
Re: How to "inline" a sub-model?
#14
Actually it's just a cut/paste operation in LDCad
Reply
Re: How to "inline" a sub-model?
#15
Ok, you can copy a inlined model into a separate file (can be done with every editor) and I think that is the answer he really needs. But that is not a real _reverse inline_ that I was talking about.
Reply
Re: How to "inline" a sub-model?
#16
Yes but LDCad gives you the option to remove the position and rotation information from the selection when coping to the clipboard. The main selected part then becomes '0 0 0 1 0 0 0 1 0 0 0 1' and all the others are corrected accordingly.

Automatic 'selection to submodel' is a feature on my todo list, but it's basically the same.
Reply
Re: How to "inline" a sub-model?
#17
There is no way to select the "main" part since the part is commented out.

Quote:0 Inlined: 1 7 -250 -24 380 -1 0 0 0 1 0 0 0 -1 desk.dat
0 begin computer desk
1 0 -240 -24 40 -1 0 0 0 1 0 0 0 -1 3001.dat
1 0 -290 -24 40 0 0 -1 0 1 0 1 0 0 3004.dat
1 4 -240 -8 80 1 0 0 0 1 0 0 0 1 4079.dat
1 0 -260 -32 40 -1 0 0 0 1 0 0 0 -1 3020.dat
1 0 -210 -32 40 0 0 -1 0 1 0 1 0 0 3023.dat
1 15 -260 -40 30 -1 0 0 0 1 0 0 0 -1 3023.dat
1 15 -260 -40 50 -1 0 0 0 1 0 0 0 -1 3069bp68.dat
1 15 -270 -64 30 -1 0 0 0 1 0 0 0 -1 4070.dat
1 15 -250 -64 30 -1 0 0 0 1 0 0 0 -1 4070.dat
1 7 -220 -56 30 -1 0 0 0 1 0 0 0 -1 3039p23.dat
1 15 -260 -53 44 -1 0 0 0 0 -1 0 -1 0 3069bp25.dat
0 end computer desk
Reply
Re: How to "inline" a sub-model?
#18
The mainpart is just the one you selected first, it has no special meaning.

A copy of your text above, pasted in LDCad gave me:

Code:
1 0 0 0 0 -1 0 0 0 1 0 0 0 -1 3001.dat
1 0 -50 0 0 0 0 -1 0 1 0 1 0 0 3004.dat
1 4 0 16 40 1 0 0 0 1 0 0 0 1 4079.dat
1 0 -20 -8 0 -1 0 0 0 1 0 0 0 -1 3020.dat
1 0 30 -8 0 0 0 -1 0 1 0 1 0 0 3023.dat
1 15 -20 -16 -10 -1 0 0 0 1 0 0 0 -1 3023.dat
1 15 -20 -16 10 -1 0 0 0 1 0 0 0 -1 3069bp68.dat
1 15 -30 -40 -10 -1 0 0 0 1 0 0 0 -1 4070.dat
1 15 -10 -40 -10 -1 0 0 0 1 0 0 0 -1 4070.dat
1 7 20 -32 -10 -1 0 0 0 1 0 0 0 -1 3039p23.dat
1 15 -20 -29 4 -1 0 0 0 0 -1 0 -1 0 3069bp25.dat

But given the source has the inlined, begin and end meta info. You could probably also write a simple script to extract those models.
Reply
Re: How to "inline" a sub-model?
#19
OK, I figured out that I just need to subtract the position from here:

Code:
0 Inlined:  1 7 -250 -24 380 -1 0 0 0 1 0 0 0 -1 desk.dat

from each of these:

Code:
1 0 -240 -24 40 -1 0 0 0 1 0 0 0 -1 3001.dat
1 0 -290 -24 40 0 0 -1 0 1 0 1 0 0 3004.dat
1 4 -240 -8 80 1 0 0 0 1 0 0 0 1 4079.dat
1 0 -260 -32 40 -1 0 0 0 1 0 0 0 -1 3020.dat
1 0 -210 -32 40 0 0 -1 0 1 0 1 0 0 3023.dat
1 15 -260 -40 30 -1 0 0 0 1 0 0 0 -1 3023.dat
1 15 -260 -40 50 -1 0 0 0 1 0 0 0 -1 3069bp68.dat
1 15 -270 -64 30 -1 0 0 0 1 0 0 0 -1 4070.dat
1 15 -250 -64 30 -1 0 0 0 1 0 0 0 -1 4070.dat
1 7 -220 -56 30 -1 0 0 0 1 0 0 0 -1 3039p23.dat
1 15 -260 -53 44 -1 0 0 0 0 -1 0 -1 0 3069bp25.dat

to get the original positions of the contents of "desk.dat".

But what about the rotation matrix? How do I apply its inverse?
Reply
Re: How to "inline" a sub-model?
#20
Simplest way is to build a full 4x4 matrix for the 'inline' ref line.
Then inverse it and apply it to all the others.

Your math lib should have an inverse function.
Reply
Re: How to "inline" a sub-model?
#21
Are you talking about something like this?
http://ncalculators.com/matrix/4x4-inver...ulator.htm

Where should I put the values of a linetype 1 to?
Reply
Re: How to "inline" a sub-model?
#22
Yes,

You can input it like

a b c x
d e f y
g h i z
0 0 0 1

or

a d g 0
b e h 0
c f i 0
x y z 1

which one doesn't matter as long you keep the same layout for all calculations.

But this only gives you an inverse matrix, you still have to multiple the 4x4 matrices of the other lines with the obtained inverse one. So writing a script / small app for it is more efficient.
Reply
Re: How to "inline" a sub-model?
#23
Never mind. I will just rotate the sub-models until I get a result that looks right in MLCAD. Datsville doesn't have that many models that need to be fixed, anyway.
Reply
Re: How to "inline" a sub-model?
#24
As far as I can see that does not work.

file test.ldr contains:
1 16 200 100 50 1 0 0 0 -1 0 0 0 1 3005.dat

I put those values in the calculator and created a second file:
1 16 200 -100 50 -1 0 0 0 1 0 0 0 -1 test.ldr

The result is not the same as:
1 16 0 0 0 1 0 0 0 1 0 0 0 1 3005.dat

Any ideas?
Reply
Re: How to "inline" a sub-model?
#25
You can't input the inverse directly into the ref, you need to multiple the old ref matrix witht the inverse and use the resulting one for the ref line.

[200 100 50 1 0 0 0 -1 0 0 0 1] * [200 -100 50 -1 0 0 0 1 0 0 0] = [0 0 0 1 0 0 0 1 0 0 0 1]

But I don't understand why you making it this complicated, especially since the inline model doesn't use a 'nice' center point. It's much more easy to just use copy and paste in LDCad or MLCad to create a submodel using a decent center (e.g. the chair at 0,0,0)
Reply
Re: How to "inline" a sub-model?
#26
I will try this once you add the new camera features to LDCad. Currently, I spend nearly all my time fighting the camera and don't get much actual work done. Sad
Reply
Re: How to "inline" a sub-model?
#27
Fair enough, but do note the next version will probably only include the new major 1.3 features. Depending on available time I probably push the smaller stuff (like camera/gui improvements) to the second beta. So please be patient Smile
Reply
Re: How to "inline" a sub-model?
#28
I installed LDDP. What do I do now? I know there's a command in the Tools menu, but I don't know how it works.

I tried inlining this:

Code:
1 0 0 0 -3600 1 0 0 0 1 0 0 0 1 infrastructure_airportrunway_bane-for.ldr

But all I got as a result is this:

Code:
0 Original Line: 1 0 0 0 -3600 1 0 0 0 1 0 0 0 1 infrastructure_airportrunway_bane-for.ldr
0 Inlined by LDDesignPad

1 0 0 0 -3600 1 0 0 0 1 0 0 0 1 infrastructure_airportrunway_bane-for.ldr
0 End of Inlined Part

Where are all the parts?!
Reply
Re: How to "inline" a sub-model?
#29
LDDP doesn't work from files inside a mpd, this means that you have to extract all ldr files from your mpd and put them in the same folder.
Reply
Re: How to "inline" a sub-model?
#30
OK thanks.
Reply
Re: How to "inline" a sub-model?
#31
I've got a related question. I am trying to make some renders which include multiple models posed together. To do this, I need to get the models into the same file. Each model is an MPD with many nested submodels. I could simply export the submodels from MLCAD, but some of the models may use the same submodel names so that won't work. I could manually alter the submodels' names so none of them would get overwritten, but that would take forvere. What I'd like to do is convert each MPD into a fully inlined LDR file. The problem is that when I try to do this will LDDP it inlines everything right down to the part library. I want to bring all the LDR submodels into the top level file, but not any of the DAT files. I'd prefer not to select each LDR individually and inline since, again, this takes forever.

Any advice?
Reply
Re: How to "inline" a sub-model?
#32
I'm guessing MPDCenter will do what you want.
Reply
Re: How to "inline" a sub-model?
#33
You'll most likely end up having to rename some of your parts if they share the same file name.
Reply
Re: How to "inline" a sub-model?
#34
I would have suggested that too Smile

That is exactly the situation I had in mind if I designed MPDCenter.
Reply
Re: How to "inline" a sub-model?
#35
Eric Albrecht Wrote:To do this, I need to get the models into the same file. Each model is an MPD with many nested submodels.

You could easily do that by using the nesting mode in my LDCad.

Open the top level model, and put it in nesting mode ('n'). Then select all (ctrl+a) and copy (ctrl+c). A dialog might ask for some options regarding origin corrections and stepping etc. The whole model tree will be reduced to flattened library part references (could take a few seconds) you can paste in e.g. notepad or a new model.

edit: I'm assuming the model tree does not use embedded parts though, only official / unofficial filebased parts.
Reply
Re: How to "inline" a sub-model?
#36
Thanks, that was exactly what I needed.
Reply
Re: How to "inline" a sub-model?
#37
I just found an error that migh occur, depending the way you work. I'll upload a new version in the next minutes.

Uploaded. Version 2.3.4.0 should be fine for your needs.

Please see attached small documentation how to ....


Attached Files
.pdf   MPDC How to join several mpd files.pdf (Size: 47.16 KB / Downloads: 1)
Reply
RE: How to "inline" a sub-model?
#38
Hi. I am trying to use your tool "Inliner".

http://ldraw.heidemann.org/index.php?page=inliner

I don't understand what the "inlinedeep" parameter does. Should I choose the maximum value? I really don't want to inline all the lines and quads and so forth. I just want to inline the parts. Thanks.

[edit]

Something appears to be wrong. I tried to inline a building model using "inliner", and it did not finish within the 7 hours I waited before quitting. I tried the same with MPDCenter and it took less than a minute to finish.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 39 Guest(s)