Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Wrong part of the model shows up #36

Open
Mrfuture opened this issue Dec 20, 2013 · 30 comments
Open

Wrong part of the model shows up #36

Mrfuture opened this issue Dec 20, 2013 · 30 comments
Labels

Comments

@Mrfuture
Copy link

Hi.
I have exported a big model from MLCad and when i import the file that shall contain the whole model, Blender just show a small part of it,
I have been successful doing this with another file.
The model was an big multi part model saved as MPD

@JoshTheDerf
Copy link
Collaborator

This is usually caused by a missing part. If the importer cannot find a part, it simply fails silently, leaving however much of the model had been imported previously. I am currently working (without success) on finding a way around this.

@Mrfuture
Copy link
Author

Thanks, I was thinking what could have done this and removed the Lsynth hose. This time it nearly loaded the whole model.. But there is still something wrong.
A bit strange since all have been recently rebuildt with the current LDraw library.
I can understand the Lsynth parts since it is not a real part, but everything else should be normal lego parts from Ldraw library. I removed the only one currently in the model.

@JoshTheDerf
Copy link
Collaborator

Could you try running Blender from the command line (or terminal depending on what operating system you use), and posting the output here?

@Mrfuture
Copy link
Author

I cant get the whole list but i think it it gves some file not found in the beginning before it start prosessing the file
Im running on windows 7

It starts with this

[LDR Importer] Attempting to import C:\Temp\DS Exp 2013_00001-1.ldr - 12:32:18

[LDR Importer] Could not find file Unknown - 12:32:18

[LDR Importer] File not found: Unknown - 12:32:18

and then a lot of

Info: Removed 909 vertices

until it ends with

[LDR Importer] C:\Temp\DS Exp 2013_00001-1.ldr successfully imported! - 12:30:13

If you want, I can send you the file?

@JoshTheDerf
Copy link
Collaborator

Yes please!

It would appear there's some part definitions that don't exist.

@Mrfuture
Copy link
Author

How do i send it to you.? I cant attach it to ths message.
What i have seen is that there is the bottom (called back) and the front part of the model that is missing.in the main file. But the data is in the file but some how not processed.

@JoshTheDerf
Copy link
Collaborator

Paste the .ldr file in https://gist.github.com/ and give me the link?

@Mrfuture
Copy link
Author

I hope i did ths the rigth way

https://gist.github.com/Mrfuture/c911c5aad896f9be8f2c

@JoshTheDerf
Copy link
Collaborator

Looking at that file, it would appear that there are multiple models in it (similar to a .mpd). I don't believe that that is well supported, although I may be wrong.

EDIT: The model looks pretty neat in LDView!

EDIT2:
@Mrfuture: The file appears to import correctly in the latest version of LDR-Importer and Blender 2.69 (running on Ubuntu 13.04)

There are some missing vertices (mainly on the engine dishes, but this is currently not fixable, and is related to the vertice definitions of some ldraw parts). As a rule of thumb (at least for me) refrain from trying to import parts that are round and concave.

Increasing the scale, turning on "Use High-Res Bricks" or switching Model Cleanup may help alleviate the problem a bit, but will also increase lag and require more memory.

@Mrfuture
Copy link
Author

https://gist.github.com/Mrfuture/fe43635cf66058467dd0
Here is another example. This worked perfect.
Bouth models was something me and my friend created back in the 1990 something.
This one was his ship. and the first was mine. The MOCs still standing.
Now im soon 45 and still build with Lego from tme to time.

@le717
Copy link
Owner

le717 commented Dec 20, 2013

Hello!

I have not yet tested your models, but from reading the code it seems they are indeed multi-part dat models as Tribex thought. LDR Importer does not currently support this format (see #7), but we do plan on eventually fixing this, most likely after we complete a much needed rewrite.

I have never tested how the script reacts to a multi-part dat, but your descriptions makes sense (if that makes any sense :P) to how it might treat one.

In the mean time, we will try to help you import your model. If it is possible you may want to start with splitting the multiple parts into separate files and referencing them in one large model. 😉

@le717 le717 mentioned this issue Dec 20, 2013
6 tasks
@Mrfuture
Copy link
Author

Hi
I can try over the weekend to split up the model in seperat files. If not i get caught up in christmas prep.
But why did the second model work and not the first one. The files looks the same but the second is more clean than the first one.
And it could always be an old problem coming back and haunt me. I had a problem with the file complaining about a non exixtent missing file when loading the file.. But since the main model missing the bottom and the front part it is a bit strange.

@Mrfuture
Copy link
Author

New information. The problem has been solved. Beside for the problem with Lsynth that make the same problem.
I found one part in the file after loading it in LDview. It reported an unkown file at line 372. I checked the file in Notepad with line number turned on and found it. it was in the back11.ldr section of the file i removed that line and saved.
I did an new export to LDR files and then lmported it into Blender. This time the whole ship appeard.

Thanks for all help and good luck with the importer. I will keep a tab on this one. Have been looking for something like it for some time.

@JoshTheDerf
Copy link
Collaborator

Congrats on getting it to work! We'll try to make the importer more predictable in the future.

@Mrfuture
Copy link
Author

Hi

Sorry to bother you again.

I have fixed some other problem and now was playing with the export to Blender again.
But suddenly I get these errors in the consol window in Blender

[LDR Importer] ERROR: Reason: UnicodeDecodeError. - 17:43:28

[LDR Importer] Attempting to import C:\temp\DS Exp 2013_00001.ldr - 17:43:42

[LDR Importer] ERROR: UnicodeDecodeError
Traceback (most recent call last):
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\import_ldraw.py", line 766, in create_model

LDrawFile(context, file_name, mat)

File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\ addons\import_ldraw.py", line 126, in init

self.parse(filename)

File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\import_ldraw.py", line 244, in parse

lines = f_in.readlines()

File "C:\Program Files\Blender Foundation\Blender\2.68\python\lib\codecs.py", line 300, in decode (result, consumed) = self._buffer_decode(data, self.errors, final)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 92: invalid start byte

  • 17:43:42
    [LDR Importer] ERROR: Reason: UnicodeDecodeError. - 17:43:42

I have restarted blender, reexported the file but stil I get this problem right a way after select the file and start.

I also have got the Lsynth to work with the export. I needed to copy the Lsynth parts files to Ldraw\parts dir.
May be something for later that it check the unofficial\Lsynth catalog if it cant find the file in main Ldraw dirs ?

Petter

@le717
Copy link
Owner

le717 commented Dec 21, 2013

Wow, GitHub broke that email formatting.

I've seen this error before in some of my personal projects. I occurs when a file with an Big or Little Endian encoding is read but the file is opened using UTF-8 encoding. LDR models are supposed to use UTF-8 (I believe NO-BOM), so that is how the script attempts to read them. Are one of the models you posted above the model you are importing? I'll look into fixing the issue this afternoon.

@le717
Copy link
Owner

le717 commented Dec 22, 2013

@Mrfuture The issue should be fixed in #37. I thoroughly tested it myself. 😉

And it could always be an old problem coming back and haunt me. I had a problem with the file complaining about a non exixtent missing file when loading the file.. But since the main model missing the bottom and the front part it is a bit strange.

New information. The problem has been solved. Beside for the problem with Lsynth that make the same problem. I found one part in the file after loading it in LDview. It reported an unkown file at line 372. I checked the file in Notepad with line number turned on and found it. it was in the back11.ldr section of the file i removed that line and saved.
I did an new export to LDR files and then lmported it into Blender. This time the whole ship appeard.

Yea, that is #11, Non-existent bricks crash script. This happens because of the way the script is written, and attempts to skip those bricks and move on have failed, same for trying to throw an error box rather than silently failing. I added a section in the Readme warning about this. Rest assured, we know about the error, and we ourselves (well, I know I do) get annoyed by it. 😉

Hm, I'll have to look up these Lsynth bricks so I know what you are referring to and check compatibility.

@Mrfuture
Copy link
Author

The ONE With The .ldr not The mpd. But that file is The one i export to ldr files
Petter

----- Opprinnelig melding -----
Fra: "Triangle717" notifications@github.com
Sendt: ‎21.‎12.‎2013 18:05
Til: "le717/LDR-Importer" LDR-Importer@noreply.github.com
Kopi: "Mrfuture" p.lerdahl@getmail.no
Emne: Re: [LDR-Importer] Wrong part of the model shows up (#36)

Wow, GitHub broke that email formatting.

I've seen this error before in some of my personal projects. I occurs when a file with an Big or Little Endian encoding is read but the file is opened using UTF-8 encoding. LDR models are supposed to use UTF-8 (I believe NO-BOM), so that is how the script attempts to read them. Are one of the models you posted above the model you are importing? I'll look into fixing the issue this afternoon.


Reply to this email directly or view it on GitHub:
#36 (comment)

@Mrfuture
Copy link
Author

Lsynth is a part generator for bricks like hoses and wires for decoration,pneumatic or eletrick parts. You find it in MLCad.
Those have a set of basic "bricks" it use to emulate the hose or wire look.

@Mrfuture
Copy link
Author

OK Now i have tested the updated importer but still has the error,
I have removed the importer and installed it again into blender.
I have tried the other way to try to save the file again in MLCad and edit it thete but it looks like if it has been edited
But what i strange is that if i delete the export and do a new export. It still gives the error even when i never have edit that file. But i can import other files.

@le717
Copy link
Owner

le717 commented Dec 23, 2013

@Mrfuture What is the error you are getting now with the updated script? Can you upload the model to Dropbox or some place like that so I can examine the file directly and try to come up with a proper fix?

@Mrfuture
Copy link
Author

Hi again

To me it looks like it is the same message.

Read new prefs: C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\

config\userpref.blend

found bundled python: C:\Program Files\Blender Foundation\Blender\2.68\python

[LDR Importer] Configuration file found at

C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\presets\

io_import_ldraw\config.py - 12:15:51

[LDR Importer] The LDraw Parts Library installation path to be used is

C:\Program Files (x86)\LDraw - 12:15:51

reloading addon: import_ldraw 1387665876.4707716 1387883962.689631 C:\Users\Pett

er\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\addons\import_ldraw.p

y

Modules Installed from 'C:\Users\Petter\Desktop\LDR-Importer-v1.1\import_ld

raw.py' into 'C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\

2.68\scripts\addons' ()

trying to save userpref at C:\Users\Petter\AppData\Roaming\Blender Foundation\Bl

ender\2.68\config\userpref.blend ok

<!> event has invalid window

[LDR Importer] Attempting to import C:\temp\DS Exp 2013_00001.ldr - 12:20:04

[LDR Importer] ERROR: UnicodeDecodeError

Traceback (most recent call last):

File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\

addons\import_ldraw.py", line 766, in create_model

else:

File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\

addons\import_ldraw.py", line 126, in init

File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\

addons\import_ldraw.py", line 244, in parse

File "C:\Program Files\Blender Foundation\Blender\2.68\python\lib\codecs.py",

line 300, in decode

(result, consumed) = self._buffer_decode(data, self.errors, final)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 92: invalid

start byte

  • 12:20:04

[LDR Importer] ERROR: Reason: UnicodeDecodeError. - 12:20:04

I think it must be something with this file. Since if I use another model it works fine.
If I take this to LDView it does not report any error.
But what is strange is that it looks like it happened something to the main file since if I export it into Ldr files from MLCad it does not work anymore with the importer. Even if I do this or saving under a new name and do a new export it stil fail.

The file attached is an exported file. The mpd from earlier is the main model file,

But take your time. May be I going to complete the model before I try to import it into Blender again. But not today. It’s Christmas and family first :-)

Merry Christmas

From

Petter Lerdahl

Fra: Triangle717 [mailto:notifications@github.com]
Sendt: 24. desember 2013 00:21
Til: le717/LDR-Importer
Kopi: Mrfuture
Emne: Re: [LDR-Importer] Wrong part of the model shows up (#36)

What is the error you are getting now with the updated script? Can you upload the model to Dropbox so I can


Reply to this email directly or view it on GitHub #36 (comment) . https://github.com/notifications/beacon/6229698__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwMzM3MzYzMywiZGF0YSI6eyJpZCI6MjI0MjU3NjR9fQ==--63d2bd29e4cce5cdff02caa2bb6a80909a02ea1a.gif

@JoshTheDerf
Copy link
Collaborator

But not today. It’s Christmas and family first :-)

Amen to that. :D

@Banbury
Copy link
Collaborator

Banbury commented Dec 25, 2013

Maybe you should us a different editor like Notepad++?

@Mrfuture
Copy link
Author

The windows notepad have option to save as following format
Ansi (default), Unicode, Unicode big endian and UT-8
I have tried all exept the endian one. All fails.

But i shall try the other.

@le717
Copy link
Owner

le717 commented Dec 28, 2013

@Mrfuture It looks like you are still on the v1.1 release rather than using the newest revision from the master. Do this:

  • Uninstall the current version of the plug-in from Blender.
  • Download the newest revision from the master branch and save it somewhere (like your Desktop).
  • Restart Blender, and install the revision you just downloaded. When you go to activate it, it should report as version 1.2 (though that is incorrect, it's actually a pre-release).
  • Try your model again and report back to me what happens. :)

I tested it myself using a model encoded in ANSI, UTF-8 NOBOM, UTF-8 BOM, UCS-2 BE and UCS-2 LE encoding, and every single time it imported.

@MinnieTheMoocher
Copy link

lsynth does not come with mlcad afaik.

it is a standalone addition to the ldraw library, comprising files for synthetisation of flexible parts
like hoses or cables.
its files need to be found by the importer.
usually, those files lie in a folder separate from the ldraw library,
so the importer will not find them.

example: my lsynth files are located in d:\lego\ldraw\lsynth,
i.e., in a sibling folder next to d:\lego\ldraw\p

my suggestion is to let the user specify additional pathes to look for files in.

this option should be a list, editable in the blender GUI options of the importer script.

in your case, you would add the path to your lsynth files to that list, so they will be found.

as a workaround, until that option is available, you could put the lsynth files
in the same folder where your model is
and use a version of LDR importer which contains a fix for #40

@Mrfuture
Copy link
Author

I have now uninstalled v.1.1 (reported as v1.2 in blender 2.68
then exited and then downloaded the new file from the link ie717 provided. in the same folder as the old files and yes to overwrite.
Then started blender and selected the map from the app add on menu in settings.
Checked to activate it. The version was 1.2 save the new setup.
Exited blender and started again.
Then selected the file to import in the import ldraw.
then it happend again.
Read new prefs: C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68
config\userpref.blend
found bundled python: C:\Program Files\Blender Foundation\Blender\2.68\python

[LDR Importer] Configuration file found at
C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts\presets
io_import_ldraw\config.py - 17:59:34

[LDR Importer] The LDraw Parts Library installation path to be used is
C:\Program Files (x86)\LDraw - 17:59:34

[LDR Importer] Attempting to import C:\temp\DS Exp 2013-x1_00001.ldr - 17:59:57

[LDR Importer] ERROR: UnicodeDecodeError
Traceback (most recent call last):
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts
addons\import_ldraw.py", line 809, in create_model
LDrawFile(context, file_name, mat)
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts
addons\import_ldraw.py", line 162, in init
self.parse(filename)
File "C:\Users\Petter\AppData\Roaming\Blender Foundation\Blender\2.68\scripts
addons\import_ldraw.py", line 287, in parse
lines = f_in.readlines()
File "C:\Program Files\Blender Foundation\Blender\2.68\python\lib\codecs.py",
line 300, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf6 in position 92: invalid
start byte

  • 17:59:57

[LDR Importer] ERROR: Reason: UnicodeDecodeError. - 17:59:57

I have tried different files of the same model but it still fails.
Could it be the Blender version ?

@Mrfuture
Copy link
Author

MinnieTheMoocher If you install the all in one installer for Ldraw you can choose if you want it or not. but i think the menu is in MLcad but it does not work if you not install it. (aka ithe add on not installed.) but i could be wrong :-)

I cheated a bit to copy the Lsynth files into ldraw parts catalog. but the best is if you can add aditional or it check in the lsynth map.

@Mrfuture
Copy link
Author

I have been doing some searching for why the files does not work.
I splitted up the set to its sub models (export under multipart menu) and then tried to load ech part into blender.

  1. multisub part files (sub model with other sub models Created to make a bigger sub model.. This only load some parts. Maybe only those in the main file.
  2. The LSynth parts looks like not always working. If i'm correct, this made the strange file unicode error. But i have to check it a bit more.

But then again all this is not new to the things neede to be fixed. So im ether be waiting or make i way around.
I wil give an update if i get it to work,
This tests have been done with the v1.1 of the importer I have only that one on my work computer .
I wil try the same test at home also with v1.2

@le717 le717 mentioned this issue Jan 7, 2014
10 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants