kbalage

LDCad - how to import a submodel from another file

Recommended Posts

I'm trying to import an .ldr submodel from "MPD A" to "MPD B". If I have both files open I can see the models and submodels using the "All models currently being edited" view. If I have the "MPD B" main session active and try to drag and drop a submodel in it that exists in "MPD A" I receive the following error message - Using subfile "submodel-1.ldr" outside its main (MPD) file is not permitted.

I can drag and drop the "MPD A" main model with all the submodels included, then use the "Embed unofficial content" function to include the contents in the "MPD B" file but that means all models and submodels will become part of the "MPD B" file and I only want to import one specific subfile.

Tried to follow the advice found here but I'm not sure what step I am missing or doing wrong.

Share this post


Link to post
Share on other sites

Here is how to do it:

1. Open LDcad, click 'start a new model.

2. Give it a name, and click 'accept'.

3. Select both mpd files outside of ldcad.

4. Drag and drop the selection onto a new ldcad project (Maybe add an 'import option' for this in the 'file' menu).

5. Check 'use files by reference'.

6. Click 'Select'.

7. re-position the two models if necessary.

8. Click 'edit' > 'select'>  'all'.

9. Click on the filename box on the top right.

10. Ensure ''normal' is selected and not 'nested'.

11. Click 'edit' > 'selection' > 'reorganise' > 'embed unofficial content'.

12. Click 'yes' if a confirm message box appears.

13. Leave the optional prefix empty.

14. click 'ok'.

15. Click 'file' > 'save'.

16. Enter a filename.

Now the files you dragged and dropped can be deleted without effecting your new model.

The following error may appear if you maximise LDCAD:

'FBO initialisation failed. option disabled, if you want to try it again, re-enable the option in the open-GL preferences menu'.

The above steps work, although in the sub-file list on the top right the two MPDs still have the old model names. using 'file' > 'clean up...' > 'remove' > 'subfiles not used by main file' had no effect, nor does saving it as .ldr instead of .mpd. But if you dont mind this extra clutter then its not much of a problem.

Regards, Snipe.

Edited by SNIPE

Share this post


Link to post
Share on other sites

@SNIPE thank you for the detailed explanation, as I tested with this method I am basically merging the two files with all the submodels and main models they contain. What I'm trying to achieve is to pick a single subfile from file A and put that into file B (that can already have several subfiles on its own). I would like to avoid the need to merge the files and then later one by one remove the unnecessary subfiles.

I did some tests and found a solution, not sure if there's anything more straightforward than this:

- Open a.mpd, open the submodel to export
- Session/Duplicate this subfile, select "new file" in the popup window, fill in the data for the new file
- Save this file as a new file, e.g. export.mpd
- Open b.mpd
- drag and drop export.mpd into b.mpd, select "use files by reference"
- Click 'edit' > 'selection' > 'reorganise' > 'embed unofficial content'.

Share this post


Link to post
Share on other sites

Ah, I see

Yeah this is something I've wanted to do as well, I'll try your solution shortly. Hopefully LDCAD wil have an simple option for this in the future

Share this post


Link to post
Share on other sites

@SNIPE after a few tests I found a limitation with my solution - if there's a next level of submodel(s) in the submodel I would like to export, then those submodels are not transferred with the method I described. This is true for the rubber bands, chains, PF assemblies etc.

Share this post


Link to post
Share on other sites
1 hour ago, kbalage said:

@SNIPE after a few tests I found a limitation with my solution - if there's a next level of submodel(s) in the submodel I would like to export, then those submodels are not transferred with the method I described. This is true for the rubber bands, chains, PF assemblies etc.

This is a known bug and will be fixed in 1.6c

Share this post


Link to post
Share on other sites
1 minute ago, roland said:

This is a known bug and will be fixed in 1.6c

Thanks roland! Are there any other alternatives until then to transfer a submodel from one file to another?

Share this post


Link to post
Share on other sites

You can open both models in LDcad, then go to the submodel you want to copy and select all parts (CTRL+A) and copy them (CTRL+C). Then go the model to which you want to copy the submodel and create a new submodel and paste all the parts (CTRL+V) :classic:

Share this post


Link to post
Share on other sites
28 minutes ago, kbalage said:

Thanks roland! Are there any other alternatives until then to transfer a submodel from one file to another?

The method Snipe described is the intended way to copy dependencies into a new model. But it isn't necessary to do so, you can also just use the model as is and keep the two files paired together.

If you really need / want to merge multiple files you can also just copy their contents using e.g. notepad, just keep an eye on the 0 FILE * lines in means of unique names and maybe add them to non mpd's etc.

Share this post


Link to post
Share on other sites

Can we use notepad to flatten a multi submodel file into a single model?

Edited by SNIPE

Share this post


Link to post
Share on other sites
19 minutes ago, SNIPE said:

Can we use notepad to flatten a multi submodel file into a single model?

Everything is possible but there’re matrices multiplications involved, you can’t just copy and paste the submodels definitions where they are used.

Share this post


Link to post
Share on other sites
On 1/8/2019 at 11:22 PM, SNIPE said:

Can we use notepad to flatten a multi submodel file into a single model?

I believe mpdcenter has an option to flatten an mpd model into a single model.

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.