New Blender Importer/Exporter for Blender 2.82


New Blender Importer/Exporter for Blender 2.82
#1
After months of work, I've released my Blender LDraw handler. https://github.com/cuddlyogre/ExportLdraw

Download the project zip, and extract the contents to C:\Users\username\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\ExportLdraw, then in Blender, go to Edit > Preferences > Add-ons > search for LDraw and check the box next to Import-Export: Export LDraw. Menu options are in Import and Export.

Please install it and show me what you can do.

I need to write up proper instructions, but here's the readme :

Code:
LDraw Handler for Blender 2.82, written by Matthew Morrison [cuddlyogre] - cuddlyogre@gmail.com - www.cuddlyogre.com

Materials were taken almost wholesale from https://github.com/TobyLobster/ImportLDraw. I added my own glass material that was taken from a BlenderArtists thread, but most of it is unchanged. I essentially learned Python by dissecting and studying this plugin, and it inspired me to make my own. My plugin wouldn't exist without this one.

I have to write up actual instructions, but normal usage is straightforward.

Importing: File > Import > LDraw (.mpd/.ldr/.l3b/.dat)

Exporting requires a bit of setup, but once that's taken care of: File > Export > LDraw (.mpd/.ldr/.l3b/.dat)

I have a few parts in the official parts library that were created in Blender and exported using my plugin.

You are able to export parts and models with the correct project setup. You can even build entire models in Blender, but the workflow needs to be figured out for that to be any kind of fun.

I built this plugin with performance and compatibility in mind. It handles MLCad parts, LDCad projects, ldr, and mpd. It also processes most official META commands. For instance, STEP will set keyframes so you can watch the model be built. Theoretically, you could build and entire animation in an MPD file if you did it right. TEXMAP support is really all that's missing feature wise.

https://omr.ldraw.org/files/337 loads in about 13 seconds https://omr.ldraw.org/files/338 has lots of incorrectly written parts and MLCAD parts that import correctly

You are able to choose the logo you want to show on studs, or no logo or stud at all.

It works with Eevee and Cycles right out of the gate.

On my TODO is the ability to replace selected parts with different resolution parts. For instances, 338 from eariler has a lot of gaps in the tires and fender because the model is built with parts with different resolutions.

Pull requests and examples of my plugin in action are welcome.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#2
This thread should probably be moved to LDraw Editors and Viewers.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#4
(2020-08-05, 5:27)Matthew Morrison Wrote: This thread should probably be moved to LDraw Editors and Viewers.

No, this is a converter. Blender is not an LDraw program, and a Blender importer definitely counts as "file processing and conversion".
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#5
(2020-08-05, 19:17)Travis Cobbs Wrote: No, this is a converter. Blender is not an LDraw program, and a Blender importer definitely counts as "file processing and conversion".

I moved the thread to this (Conversion) forum. I forget where it was (Parts authoring maybe?)
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#6
(2020-08-05, 19:42)Orion Pobursky Wrote: I moved the thread to this (Conversion) forum. I forget where it was (Parts authoring maybe?)

Thank you!
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#3
(2020-08-05, 5:19)Matthew Morrison Wrote: After months of work, I've released my Blender LDraw handler. https://github.com/cuddlyogre/ExportLdraw

Download the project zip, and extract the contents to C:\Users\username\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\ExportLdraw, then in Blender, go to Edit > Preferences > Add-ons > search for LDraw and check the box next to Import-Export: Export LDraw. Menu options are in Import and Export.

Please install it and show me what you can do.

The equivalent path for MacOS would apparently be: /Applications/Blender.app/Contents/Resources/2.83/scripts/addons/ExportLdraw

Can't wait to fiddle around with this. First I guess I need to learn Blender itself… ;-)
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#7
Hello,

what is the difference or the advantage of this add-on compared to the "ImportLDraw" add-on?


Regards

Manfred
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#8
(2020-10-09, 9:51)Manfred Schäfer Wrote: Hello,

what is the difference or the advantage of this add-on compared to the "ImportLDraw" add-on?


Regards

Manfred

I guess the biggest advantage is that this exporter "exports" to a blender file (obviously), but the key difference is that the blender import plugin may only work for certain versions of Blender. So if the author does not keep up with the blender plugin it may not work in future Blender versions.

Hence I believe this may be the better option.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#15
(2020-12-16, 15:30)Rob Frydryck Wrote: I guess the biggest advantage is that this exporter "exports" to a blender file (obviously), but the key difference is that the blender import plugin may only work for certain versions of Blender. So if the author does not keep up with the blender plugin it may not work in future Blender versions.

Hence I believe this may be the better option.

So can this export a model as a .ldr file or only single parts and if it can what setup is required? I'm asking because the README file didn't seem to say how only that you could export but didn't say exactly what! I would appreciate any information you can provide me!
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#16
(2021-04-13, 23:40)Anderson Wrote: So can this export a model as a .ldr file or only single parts and if it can what setup is required? I'm asking because the README file didn't seem to say how only that you could export but didn't say exactly what! I would appreciate any information you can provide me!

Maybe you can find helpful the comment I made in this same thread (https://forums.ldraw.org/thread-24153-po...l#pid40723) after looking at the example files.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#9
(2020-10-09, 9:51)Manfred Schäfer Wrote: Hello,

what is the difference or the advantage of this add-on compared to the "ImportLDraw" add-on?


Regards

Manfred

Sorry for the delay in response. Life distracting me and whatnot.

The primary advantages are performance and accuracy of the import.

Models that take 60 seconds or more in the other plugin take about 10 seconds to import with mine. 

Parts that don't follow the spec correctly and shortcut parts will import correctly in my plugin. I found that the other plugin has problems in this area.

You're also able to create whole models and new parts with my plugin. I need to write up the instructions on how to do so, but I've got parts in the official library that were made with this plugin.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#10
(2020-08-05, 5:19)Matthew Morrison Wrote: Please install it and show me what you can do.

I need to write up proper instructions, but here's the readme :

Code:
...
You are able to export parts and models with the correct project setup. You can even build entire models in Blender, but the workflow needs to be figured out for that to be any kind of fun.
...

I just discovered this add-on and I am very interested on the export part, Cool but all my attempts end with an empty file (just the two bytes of an end of line). Confused My tests have been with Blender meshes: the monkey and the ico sphere. Could you give some brief instructions?

Compared with ImportLdraw I miss the options that position the camera, add an environment and put the model on a ground plane. That makes rendering easier for people with little knowledge of Blender, not my case.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#11
(2021-03-01, 23:22)Jose Alfonso Wrote: I just discovered this add-on and I am very interested on the export part, Cool but all my attempts end with an empty file (just the two bytes of an end of line). Confused My tests have been with Blender meshes: the monkey and the ico sphere. Could you give some brief instructions?

Compared with ImportLdraw I miss the options that position the camera, add an environment and put the model on a ground plane. That makes rendering easier for people with little knowledge of Blender, not my case.
I'll work on getting a tutorial out soon.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#12
I've added some exporting instructions to the Readme and some examples in the example folder.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#13
(2021-03-29, 13:47)Matthew Morrison Wrote: I've added some exporting instructions to the Readme and some examples in the example folder.

Matthew,

it would be best creating a page at the LDraw wiki with an exhaustive tutorial and additionally send me a description for the Third Party Page.

w.
LEGO ergo sum
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#17
Thank you for your comments.

I'm working qol changes like panels to speed things up. I just have to learn the API for it and get the time together to do it. I also plan on writing up much better instructions and recording a tutorial when I have the time.

This plugin was originally a tool for just me so I welcome as much input as I can get.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#14
(2021-03-29, 13:47)Matthew Morrison Wrote: I've added some exporting instructions to the Readme and some examples in the example folder.

Sorry, but your instructions are a little messy. Confused  It is not clear in which tabs the different customs properties must go, but I have figured from your example how to export an object without subparts and predefined colors: just adding the custom property ldraw_export_polygons=1 in Object tab. For me that covers most situations. Maybe the extension should create a panel in the Sidebar to add that custom properties in the right tabs. Idea

In the exported file there is no header, but I have seen one in the Text Editor in your example. I think the header should be added automatically by the exporter, not creating a text file in Blender. You just have to add two new fields in the Export Panel: Author and Description. I think those two and Filename are the essential data for a header. Keywords could also be a field, but I am not sure about History because is a multiline info.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#18
(2021-03-29, 19:03)Jose Alfonso Wrote: Sorry, but your instructions are a little messy. Confused  It is not clear in which tabs the different customs properties must go, but I have figured from your example how to export an object without subparts and predefined colors: just adding the custom property ldraw_export_polygons=1 in Object tab. For me that covers most situations. Maybe the extension should create a panel in the Sidebar to add that custom properties in the right tabs. Idea

In the exported file there is no header, but I have seen one in the Text Editor in your example. I think the header should be added automatically by the exporter, not creating a text file in Blender. You just have to add two new fields in the Export Panel: Author and Description. I think those two and Filename are the essential data for a header. Keywords could also be a field, but I am not sure about History because is a multiline info.

I'll add that to the list!
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#19
(2021-04-25, 23:51)Matthew Morrison Wrote: I'll add that to the list!

Whenever I try to import the preferences dialog looks funy, the headers for each section show up, but no options( https://i.imgur.com/6EfLmRB.png

When I go to actually import a ldraw.dat part I am met with the following error:
Code:
Python: Traceback (most recent call last):
  File "C:\Users\Streaming\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\ExportLdraw-master\operator_import.py", line 364, in execute
    'prefer_unofficial': self.prefer_unofficial,
  File "C:\Program Files\Blender Foundation\Blender 2.83\2.92\scripts\modules\bpy_types.py", line 721, in __getattribute__
    return super().__getattribute__(attr)
AttributeError: 'IMPORT_OT_do_ldraw_import' object has no attribute 'prefer_unofficial'

location: <unknown location>:-1

I looked around for a bug-tracker but could not find one, sorry if this is not the right place to post this.

I have tested in both Blender 2.92 and 2.82, same results on Windows 10.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#20
(2021-08-22, 10:58)KristyB Wrote: Whenever I try to import the preferences dialog looks funy, the headers for each section show up, but no options( https://i.imgur.com/6EfLmRB.png

When I go to actually import a ldraw.dat part I am met with the following error:
Code:
Python: Traceback (most recent call last):
  File "C:\Users\Streaming\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\ExportLdraw-master\operator_import.py", line 364, in execute
    'prefer_unofficial': self.prefer_unofficial,
  File "C:\Program Files\Blender Foundation\Blender 2.83\2.92\scripts\modules\bpy_types.py", line 721, in __getattribute__
    return super().__getattribute__(attr)
AttributeError: 'IMPORT_OT_do_ldraw_import' object has no attribute 'prefer_unofficial'

location: <unknown location>:-1

I looked around for a bug-tracker but could not find one, sorry if this is not the right place to post this.

I have tested in both Blender 2.92 and 2.82, same results on Windows 10.

I had a wayward comma that I've fixed. Please download the plugin again and replace the existing ExportLdraw plugin folder with the new files.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#21
I've updated the plugin to save your chosen import options. Next time you run your import, it will reuse the previously chosen options.

If you run across any errors, delete config/import_options.json from the plugin folder. The defaults are saved on the next import.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#22
Thank you, Matthew, for this piece of SW. It works surprisingly well - at least for import. (I did not try any export yet.) With import, I must say I was impressed: the plugin speed, the correct handling of unofficial parts, LDCAD hoses and strings working perfectly. And steps converted to the animation is a wonderful addition! Also submodels converted to Blender groups - great idea, it helps in some situations like with models containing buffer exchange commands, see below.

As usually, you know them - users :-) - I also have two things which do not work as I expected:

1. BUFFER EXCHANGE commands aren't supported. Is it even possible in blender?

2. Trans Black color (and maybe other transparent colors than Trans Clear) is almost opaque. I tried to debug the issue and cannot see any reason for this: the ALPHA parameter of the color is read correctly, I even tried to set it to some very low value like 10 or 4. It makes some effect but even then the Trans Black window is very opaque, like if alpha=160, my estimation.
It might be that I'm too green greenhorn in blender but I'd say all the scene and lights are correct - other models are rendered correctly.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#23
(2021-11-09, 0:23)Milan Vančura Wrote: Thank you, Matthew, for this piece of SW. It works surprisingly well - at least for import. (I did not try any export yet.) With import, I must say I was impressed: the plugin speed, the correct handling of unofficial parts, LDCAD hoses and strings working perfectly. And steps converted to the animation is a wonderful addition! Also submodels converted to Blender groups - great idea, it helps in some situations like with models containing buffer exchange commands, see below.

As usually, you know them - users :-) - I also have two things which do not work as I expected:

1. BUFFER EXCHANGE commands aren't supported. Is it even possible in blender?

2. Trans Black color (and maybe other transparent colors than Trans Clear) is almost opaque. I tried to debug the issue and cannot see any reason for this: the ALPHA parameter of the color is read correctly, I even tried to set it to some very low value like 10 or 4. It makes some effect but even then the Trans Black window is very opaque, like if alpha=160, my estimation.
It might be that I'm too green greenhorn in blender but I'd say all the scene and lights are correct - other models are rendered correctly.

I'm sorry for the huge delay in response. The alerts for ldraw forum posts go to my spam so I miss them.

Thank you for the kind words. I put a lot of work into the things you mentioned and it's great knowing people benefit from that work.

Can you post a screenshot of the colors issue you're having? It's possible you have an older version of the plugin that was darkening everything too much due to a math/logic error. The colors are now much brighter and more in line with what other tools show.

I'll have to read more into buffer exchange. That's the first I've heard of it.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#27
(2021-12-16, 20:06)Matthew Morrison Wrote: I'm sorry for the huge delay in response. The alerts for ldraw forum posts go to my spam so I miss them.

Thank you for the reply, Matthew. To make thing easier, hopefully, I summarized the problem of transparent colors as a github project issue where I included render results and more details.

About buffer exchange: it would be GREAT if you found a way how to support it in your plugin because it affects the completed model, too - not only the step-by-step animation. So every model using buffer exchange is rendered incorrectly with all those submodels visible,even some of them should be hidden.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#28
(2021-12-19, 22:18)Milan Vančura Wrote: Thank you for the reply, Matthew. To make thing easier, hopefully, I summarized the problem of transparent colors as a github project issue where I included render results and more details.

About buffer exchange: it would be GREAT if you found a way how to support it in your plugin because it affects the completed model, too - not only the step-by-step animation. So every model using buffer exchange is rendered incorrectly with all those submodels visible,even some of them should be hidden.


I'm looking into the material. The difference between Eevee and Cycles is very noticeable.

Are you willing to share a file with an example of buffer exchange? It will help with implementation.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#30
(2021-12-20, 0:55)Matthew Morrison Wrote: I'm looking into the material. The difference between Eevee and Cycles is very noticeable.

Are you willing to share a file with an example of buffer exchange? It will help with implementation.

Thank you for your help with materials, Matthew. The result is impressive - as I already told you on github. I added new issue for buffer exchange command support, with a link to LPub3D page with ideas and with my file as an example.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#29
(2021-12-19, 22:18)Milan Vančura Wrote: About buffer exchange: it would be GREAT if you found a way how to support it in your plugin because it affects the completed model, too - not only the step-by-step animation. So every model using buffer exchange is rendered incorrectly with all those submodels visible,even some of them should be hidden.

Biggest drawback with buffer exchange, if you haven't heard me say it before. ;-) Because it writes multiple type 1 lines for the same part(s) in a model, so pretty much any editor or other utility that deals with models needs to be adapted to support it.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#24
I look forward to trying my hand at modeling some new parts in Blender. I have a long-term goal of maybe doing some of the HO-scale vehicles from the 50s-60s; they are necessary to make complete models of some early official sets.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#25
(2021-12-16, 21:43)N. W. Perry Wrote: I look forward to trying my hand at modeling some new parts in Blender. I have a long-term goal of maybe doing some of the HO-scale vehicles from the 50s-60s; they are necessary to make complete models of some early official sets.
Do you have any resources or specifications for those parts? That sounds like an interesting project.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#26
(2021-12-17, 4:28)Matthew Morrison Wrote: Do you have any resources or specifications for those parts? That sounds like an interesting project.

Only the numerous websites and Flickr accounts about vintage Lego, but you can get quite good photos of many of them. However, I'm also considering the idea of buying a few broken specimens (so that they're cheap, but also so that I can see how the subparts go together).
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#31
It would be much more helpful for everybody if you would model the missing parts in LDRAW and add them
to our library instead of just doing them in Blender.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#32
Hi Matthew,

I was looking into a way of exporting Ldraw models from Blender and found your plugin. It works very well and has some great ideas. 

Anyway I have started working on a different version that only works for parts and subparts. This will be a batch exporter and will be a panel in Blender. So basically I want an importer and exporter that is as non-destructive as possible. Keeping the headers and all references intact. I also want it to be able to export with subfile references and also "protecting" parts from official and unoffical libraries. 

So this will not be the same as you plugin, but a different version that might be useful for parts authoring. My first mission is to be able to make patterns with it.

I have not made anything available online yet and I first wanted to give you a heads up about it. I hope it's ok that I borrow your code for this. I will of course give you credit for it. I also wanted to know if you would be willing to help me understand your code better so this could become as good a plugin as possible. And hopefully serve the Ldraw community with yet another tool to do parts.

Best regards, 
Fredrik
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#33
(2022-02-23, 10:02)Fredrik Hareide Wrote: Hi Matthew,

I was looking into a way of exporting Ldraw models from Blender and found your plugin. It works very well and has some great ideas. 

Anyway I have started working on a different version that only works for parts and subparts. This will be a batch exporter and will be a panel in Blender. So basically I want an importer and exporter that is as non-destructive as possible. Keeping the headers and all references intact. I also want it to be able to export with subfile references and also "protecting" parts from official and unoffical libraries. 

So this will not be the same as you plugin, but a different version that might be useful for parts authoring. My first mission is to be able to make patterns with it.

I have not made anything available online yet and I first wanted to give you a heads up about it. I hope it's ok that I borrow your code for this. I will of course give you credit for it. I also wanted to know if you would be willing to help me understand your code better so this could become as good a plugin as possible. And hopefully serve the Ldraw community with yet another tool to do parts.

Best regards, 
Fredrik

I'm happy to know I've inspired you! I can't wait to see what you come up with.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#34
Hi

where can I download a zip file?

P.S. I found it under CODE.
There is not the Source code but the ZIP Download.

Regards Thomas
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#35
(2022-03-12, 8:48)HaNNoveraNer Wrote: Hi

where can I download a zip file?

P.S. I found it under CODE.
There is not the Source code but the ZIP Download.

Regards Thomas

I've added a Releases link to the right for the future.

My most recent update includes BFC support, Stud.io decal support, and various bugfixes. Decal support is not fully implemented, but works for most applications. Please, check it out!
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#36
Just found this plug in and installed it in the latest Blender 3.1 but I am not getting any geometry on import. 

Do I need to install 2.83 to get this to work?
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#37
(2022-04-26, 12:40)Cam's Bricks Wrote: Just found this plug in and installed it in the latest Blender 3.1 but I am not getting any geometry on import. 

Do I need to install 2.83 to get this to work?

You probably forgot to add the ldraw_export_polygons = 1 property to your geometry. He requires that to export anything. You can read more under "exporting" in the readme on github

https://github.com/cuddlyogre/ExportLDraw
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#38
Cam's BricksJust found this plug in and installed it in the latest Blender 3.1 but I am not getting any geometry on import. 
[quote pid="45923" dateline="1650976826"]

Do I need to install 2.83 to get this to work?
[/quote]
 
That usually means it can't find the ldraw folder.  I'm still working on a good way to warn the user when it can't be found.

Make sure the ldraw path is correct in the import screen. If you are still having trouble, click "Window > Toggle System Console" and tell me what it says in there.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#39
(2022-04-26, 13:17)Matthew Morrison Wrote: That usually means it can't find the ldraw folder.  I'm still working on a good way to warn the user when it can't be found.

Make sure the ldraw path is correct in the import screen. If you are still having trouble, click "Window > Toggle System Console" and tell me what it says in there.

OK I got it loaded. I only had my complete.zip in my parts folder so unpacking that worked. 

How do I add other custom parts? I have the official and the unofficial but I have an additional library of custom parts for my models. 

Is there support to set a list of library locations? 

Also does the ldrawunf need to be in the ldraw folder to work? ie \ldraw\ldrawunf or will it recognize in the same top level folder.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#40
(2022-04-26, 13:28)Cam's Bricks Wrote: OK I got it loaded. I only had my complete.zip in my parts folder so unpacking that worked. 

How do I add other custom parts? I have the official and the unofficial but I have an additional library of custom parts for my models. 

Is there support to set a list of library locations? 

Also does the ldrawunf need to be in the ldraw folder to work? ie \ldraw\ldrawunf or will it recognize in the same top level folder.

Good to hear you got it working.

The LDConfig file has to be in the root of the ldraw folder. The unofficial library has to be in a folder named "Unofficial" in the ldraw root using the same directory structure as the official library.

I hadn't considered multiple library locations. I would have to figure out an interface for that, but it's not technically impossible.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#41
(2022-04-26, 14:43)Matthew Morrison Wrote: Good to hear you got it working.

The LDConfig file has to be in the root of the ldraw folder. The unofficial library has to be in a folder named "Unofficial" in the ldraw root using the same directory structure as the official library.

I hadn't considered multiple library locations. I would have to figure out an interface for that, but it's not technically impossible.

Would it be possible to just have a text file that could be added for additional library locations. "additional_library.txt" then each line is a new location. 

When you same same structure it has subfolders "p" and "parts"? 

Would that also be the same for additional libraries? I can work with all these little things just want to help if I can. 

As an aside, anyone have a suggestion for how to light a scene? I am getting over exposed colors when I try so I am sure I am doing something wrong.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#42
(2022-04-26, 15:00)Cam's Bricks Wrote: Would it be possible to just have a text file that could be added for additional library locations. "additional_library.txt" then each line is a new location. 

When you same same structure it has subfolders "p" and "parts"? 

Would that also be the same for additional libraries? I can work with all these little things just want to help if I can. 

As an aside, anyone have a suggestion for how to light a scene? I am getting over exposed colors when I try so I am sure I am doing something wrong.

>>Would it be possible to just have a text file that could be added for additional library locations. "additional_library.txt" then each line is a new location.
Certainly.

>>When you same same structure it has subfolders "p" and "parts"? 
Correct.

>>Would that also be the same for additional libraries? I can work with all these little things just want to help if I can. 
At import, just set the ldraw folder value to whichever library you want to use. You can even import multiple times in the same project from different ldraw paths.

>>As an aside, anyone have a suggestion for how to light a scene? I am getting over exposed colors when I try so I am sure I am doing something wrong.
Would you mind sharing a screenshot?
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#43
(2022-04-26, 16:15)Matthew Morrison Wrote: >>Would it be possible to just have a text file that could be added for additional library locations. "additional_library.txt" then each line is a new location.
Certainly.

>>When you same same structure it has subfolders "p" and "parts"? 
Correct.

>>Would that also be the same for additional libraries? I can work with all these little things just want to help if I can. 
At import, just set the ldraw folder value to whichever library you want to use. You can even import multiple times in the same project from different ldraw paths.

>>As an aside, anyone have a suggestion for how to light a scene? I am getting over exposed colors when I try so I am sure I am doing something wrong.
Would you mind sharing a screenshot?

I talk about some of what I did here:
https://forums.ldraw.org/thread-23926-po...l#pid45835

I also have this render in cycles that was done based on the settings in the last render of that post:
[Image: Bi7RKO4.png]

Then using a similar light setup I get this using your default materials except changing the spectra to 0.25.
[Image: 977YzvJ.png]

I will see about getting some different models that I can share the blender files for soon.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#44
cant export get this error (v2022-04-01-00)

Python: KeyError: 'bpy_prop_collection.get(key, ...): key must be a string or tuple, not NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\*\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\ExportLDraw-2022-04-01-00\operator_export.py", line 124, in execute
    ldraw_export.do_export(bpy.path.abspath(self.filepath))
  File "C:\Users\*\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\ExportLDraw-2022-04-01-00\ldraw_export.py", line 49, in do_export
    text = bpy.data.texts.get(filename)
SystemError: <built-in method get of bpy_prop_collection object at 0x00000252AC2A6970> returned a result with an exception set

location: <unknown location>:-1
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#45
(2022-05-13, 3:57)Sam Potter Wrote: cant export get this error (v2022-04-01-00)

Python: KeyError: 'bpy_prop_collection.get(key, ...): key must be a string or tuple, not NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\*\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\ExportLDraw-2022-04-01-00\operator_export.py", line 124, in execute
    ldraw_export.do_export(bpy.path.abspath(self.filepath))
  File "C:\Users\*\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\ExportLDraw-2022-04-01-00\ldraw_export.py", line 49, in do_export
    text = bpy.data.texts.get(filename)
SystemError: <built-in method get of bpy_prop_collection object at 0x00000252AC2A6970> returned a result with an exception set

location: <unknown location>:-1

Are you able to share the file you are getting this error with?
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#46
(2022-05-14, 20:31)Matthew Morrison Wrote: Are you able to share the file you are getting this error with?
try exporting the cube, error. try exporting the Lego part (which I imported with the addon) nothing export. another bug, the import scale doesn't work, no matter the number, it import at scale "0.020" (fyi if trying to scale to real life, set scale to "0.0004" ).
fyi version 2022-03-18-02 works

p.s can you add a "Custom Properties" with the "PartDescription", for imported parts

thanks for this addon


Attached Files
.zip   export dosnt work.zip (Size: 225.64 KB / Downloads: 2)
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#47
(2022-05-13, 3:57)Sam Potter Wrote: cant export get this error (v2022-04-01-00)

Python: KeyError: 'bpy_prop_collection.get(key, ...): key must be a string or tuple, not NoneType'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\*\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\ExportLDraw-2022-04-01-00\operator_export.py", line 124, in execute
    ldraw_export.do_export(bpy.path.abspath(self.filepath))
  File "C:\Users\*\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\ExportLDraw-2022-04-01-00\ldraw_export.py", line 49, in do_export
    text = bpy.data.texts.get(filename)
SystemError: <built-in method get of bpy_prop_collection object at 0x00000252AC2A6970> returned a result with an exception set

location: <unknown location>:-1

Hi, I am having the same problem. It gives me the same error with any file I try to export
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#48
(2022-07-29, 17:22)Francesca Casaretti Wrote: Hi, I am having the same problem. It gives me the same error with any file I try to export

Hello! Sorry again for the delay. I don't reliably get thread notifications.

I have pushed a new release. Please let me know if it fixes the problems you are having.

https://github.com/cuddlyogre/ExportLDra...2-07-29-00
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#49
The error is the same with the last version, at line 49 in ldraw_export.py. It happens when no custom property is defined (ldraw_filename, ldraw_export_polygons...). When I create the custom property ldraw_export_polygons as integer 1 in the Objet tab, the error disappears but no file is exported. Next try: I create the custom property ldraw_filename, I asign the value "partname.dat", for example, and I also create in Scripting workspace a new file with that name and no content. Then the part is exported successfully.

I thought that ldraw_export_polygons=1 meant ldraw_filename is not required. Huh Instead changing ldraw_export_polygons to 0 makes the error reappear when ldraw_filename and the file in Scripting are missing. This behaviour is expected.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#50
(2022-07-29, 21:36)Jose Alfonso Wrote: The error is the same with the last version, at line 49 in ldraw_export.py. It happens when no custom property is defined (ldraw_filename, ldraw_export_polygons...). When I create the custom property ldraw_export_polygons as integer 1 in the Objet tab, the error disappears but no file is exported. Next try: I create the custom property ldraw_filename, I asign the value "partname.dat", for example, and I also create in Scripting workspace a new file with that name and no content. Then the part is exported successfully.

I thought that ldraw_export_polygons=1 meant ldraw_filename is not required. Huh Instead changing ldraw_export_polygons to 0 makes the error reappear when ldraw_filename and the file in Scripting are missing. This behaviour is expected.

That is odd. I'll take a look this weekend and see if I can fix it.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#51
I forgot to say that I used Blender 3.2.1.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#52
(2022-07-30, 8:03)Jose Alfonso Wrote: I forgot to say that I used Blender 3.2.1.

Try now. That python error was a logic error on my part. I've added an LDraw panel to simplify export. I will add more detailed instructions soon.

https://github.com/cuddlyogre/ExportLDra...2-07-31-00
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#53
(2022-07-31, 22:40)Matthew Morrison Wrote: Try now. That python error was a logic error on my part. I've added an LDraw panel to simplify export. I will add more detailed instructions soon.

https://github.com/cuddlyogre/ExportLDra...2-07-31-00

When I enable the new script:

Code:
addon_utils.disable: ExportLDraw-2022-07-31-00 not disabled
Modules Installed (ExportLDraw-2022-07-31-00) from 'C:\\Users\\JA\\Documents\\ExportLDraw-2022-07-31-00.zip' into 'C:\\Users\\JA\\AppData\\Roaming\\Blender Foundation\\Blender\\2.83\\scripts\\addons'
[Errno 2] No such file or directory: 'C:\\Users\\JA\\AppData\\Roaming\\Blender Foundation\\Blender\\2.83\\scripts\\addons\\ExportLDraw-2022-07-31-00\\config\\ImportOptions.json'
Traceback (most recent call last):
  File "C:\Program Files\blender-2.83\2.83\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "C:\Users\JA\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\ExportLDraw-2022-07-31-00\__init__.py", line 56, in <module>
    _modules_loaded = [_namespace[name] for name in _modules]
  File "C:\Users\JA\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\ExportLDraw-2022-07-31-00\__init__.py", line 56, in <listcomp>
    _modules_loaded = [_namespace[name] for name in _modules]
KeyError: 'operator_panel_ldraw'
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#54
(2022-08-01, 8:31)Jose Alfonso Wrote: When I enable the new script:

Code:
addon_utils.disable: ExportLDraw-2022-07-31-00 not disabled
Modules Installed (ExportLDraw-2022-07-31-00) from 'C:\\Users\\JA\\Documents\\ExportLDraw-2022-07-31-00.zip' into 'C:\\Users\\JA\\AppData\\Roaming\\Blender Foundation\\Blender\\2.83\\scripts\\addons'
[Errno 2] No such file or directory: 'C:\\Users\\JA\\AppData\\Roaming\\Blender Foundation\\Blender\\2.83\\scripts\\addons\\ExportLDraw-2022-07-31-00\\config\\ImportOptions.json'
Traceback (most recent call last):
  File "C:\Program Files\blender-2.83\2.83\scripts\modules\addon_utils.py", line 351, in enable
    mod = __import__(module_name)
  File "C:\Users\JA\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\ExportLDraw-2022-07-31-00\__init__.py", line 56, in <module>
    _modules_loaded = [_namespace[name] for name in _modules]
  File "C:\Users\JA\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\ExportLDraw-2022-07-31-00\__init__.py", line 56, in <listcomp>
    _modules_loaded = [_namespace[name] for name in _modules]
KeyError: 'operator_panel_ldraw'

I accidentally pushed a release that was missing a file. Please download the most current release again and tell me if you are still getting the error.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#55
(2022-08-01, 9:11)Matthew Morrison Wrote: I accidentally pushed a release that was missing a file. Please download the most current release again and tell me if you are still getting the error.

It works. Cool In the LDraw panel I have checked "Export polygons" to export a part. Blender system console still shows an error about "config\\ImportOptions.json". And when exporting it just says "list index out of range" before the text "Export complete".

I miss the lines type 2 and 5 in the exported part. For type 2 I will use the edges of two faces whose normals are more than 30º apart (same value as EdgeSplit Modifier). Type 5 would be the rest of the edges: the two first points are from the edge and the other two are the other vertex of the faces (triangle) or just choose between two (quadrilateral).
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#56
(2022-08-01, 16:01)Jose Alfonso Wrote: It works. Cool In the LDraw panel I have checked "Export polygons" to export a part. Blender system console still shows an error about "config\\ImportOptions.json". And when exporting it just says "list index out of range" before the text "Export complete".

I miss the lines type 2 and 5 in the exported part. For type 2 I will use the edges of two faces whose normals are more than 30º apart (same value as EdgeSplit Modifier). Type 5 would be the rest of the edges: the two first points are from the edge and the other two are the other vertex of the faces (triangle) or just choose between two (quadrilateral).

If you mark an edge sharp, it will export as line type 2. I'll see if I can make it work automatically like you suggested.

There is no line type 5 handling at the moment, mostly because Blender doesn't have any good way to display them. I'll try what you suggested with them too.
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#57
I export the monkey-head.blender, but the ldr file only have 140byte. Partdesigner can open the ldr file, but there's nothing in it.

please tell me where's wrong. thx
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#58
(2022-09-26, 15:53)Ming Zhang Wrote: I export the monkey-head.blender, but the ldr file only have 140byte. Partdesigner can open the ldr file, but there's nothing in it.

please tell me where's wrong. thx

It sounds like you’re not exporting as geometry. 

 Would you mind sharing the blend file you’re working with? Or share a screenshot of your export settings?
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#59
(2022-07-29, 21:36)Jose Alfonso Wrote: The error is the same with the last version, at line 49 in ldraw_export.py. It happens when no custom property is defined (ldraw_filename, ldraw_export_polygons...). When I create the custom property ldraw_export_polygons as integer 1 in the Objet tab, the error disappears but no file is exported. Next try: I create the custom property ldraw_filename, I asign the value "partname.dat", for example, and I also create in Scripting workspace a new file with that name and no content. Then the part is exported successfully.

I thought that ldraw_export_polygons=1 meant ldraw_filename is not required. Huh Instead changing ldraw_export_polygons to 0 makes the error reappear when ldraw_filename and the file in Scripting are missing. This behaviour is expected.

So can this export a model as a .ldr file or only single parts and if it can what setup is required? I'm asking because the README file didn't seem to say how only that you could export but didn't say exactly what! I would appreciate any information you can provide me!
Reply
RE: New Blender Importer/Exporter for Blender 2.82
#60
(2022-10-05, 13:07)willson Wrote: So can this export a model as a .ldr file or only single parts and if it can what setup is required? I'm asking because the README file didn't seem to say how only that you could export but didn't say exactly what! I would appreciate any information you can provide me!

It’s possible to export ldr files and parts, but the workflow is a bit unrefined. I’ll put together a video explaining how to do common tasks and post a link here when it’s done.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)