SVG export from LDCAD?


SVG export from LDCAD?
#1
Hello.

I often work on making graphics around LEGO activities (book covers, tickets... also prints on bricks etc.). For this purpose it would be very handy to be able to get SVG output from LDCAD. AFAIK, there should be an indirect way using Blender, shouldn't it? Does anybody tested this path already? And/or is there an easier way?

Thanks a lot, Milan.
Reply
RE: SVG export from LDCAD?
#2
(2020-02-25, 12:30)Milan Vančura Wrote: I often work on making graphics around LEGO activities (book covers, tickets... also prints on bricks etc.). For this purpose it would be very handy to be able to get SVG output from LDCAD. AFAIK, there should be an indirect way using Blender, shouldn't it? Does anybody tested this path already? And/or is there an easier way?

Two things. First of all, "LDCad" is the name of a specific program. It's unclear if you are asking for an SVG output feature to be added to that program, or if you would like some LDraw-compatible program to support SVG output.

Secondly, LDView can do this, but it is bad enough that I never moved the feature out of experimental mode. It is disabled by default.

https://news.lugnet.com/cad/dev/?n=11145

Note: nothing has really changed in the almost nine years that have passed since the above post, although computers have gotten faster. The following reply to the above post contains instructions for enabling the feature:

https://news.lugnet.com/cad/dev/?n=11159
Reply
RE: SVG export from LDCAD?
#3
(2020-02-26, 5:24)Travis Cobbs Wrote: Two things. First of all, "LDCad" is the name of a specific program. It's unclear if you are asking for an SVG output feature to be added to that program, or if you would like some LDraw-compatible program to support SVG output.
Thanks for the answer, Travis! Yes, I meant "some LDraw-compatible way", with additional info that I use LDCAD for modelling so if there is any specific function which can be used for that - like the export to blender format. I didn't know LDView can do it, thanks for the suggestion, I check it.
Reply
RE: SVG export from LDCAD?
#4
(2020-02-26, 11:35)Milan Vančura Wrote: Thanks for the answer, Travis! Yes, I meant "some LDraw-compatible way", with additional info that I use LDCAD for modelling so if there is any specific function which can be used for that - like the export to blender format. I didn't know LDView can do it, thanks for the suggestion, I check it.

Export to blender is on my 1.7 feature list, see also:
https://forums.ldraw.org/thread-23915.html

Blender's recent support of USD seems to be a door opener.

Just looking for info etc as I can probably reuse big chunks of the POV export code.

Any additional pointers from experienced blender users will be very much appreciated.
Reply
RE: SVG export from LDCAD?
#5
(2020-02-26, 5:24)Travis Cobbs Wrote: Note: nothing has really changed in the almost nine years that have passed since the above post, although computers have gotten faster. The following reply to the above post contains instructions for enabling the feature:

https://news.lugnet.com/cad/dev/?n=11159
Hi Travis. Unfortunately, I wasn't able to test this. Neither the cmdline option nor the same parameter in the config file made any change in Save snapshot behavior. Although I compiled LDView from source (current version from git) and I checked the commit with this feature is there (commit 75f35e318db0c2d8d06384613da145d98668e194).

So all I have is a picture you posted as an example. Watching that, this feature is probably too experimental for any practical usage now - but, on the other hand, if you could merge adjacent triangles of the same color and (optionally) turn off gradients simulation on studs, the result SVG must be significantly smaller and easier to render for any application, am I right? I only don't know how much effort it is, these two improvements... Maybe it's tooo much for such feature...
Reply
RE: SVG export from LDCAD?
#6
(2020-02-28, 12:49)Milan Vančura Wrote: Hi Travis. Unfortunately, I wasn't able to test this. Neither the cmdline option nor the same parameter in the config file made any change in Save snapshot behavior. Although I compiled LDView from source (current version from git) and I checked the commit with this feature is there (commit 75f35e318db0c2d8d06384613da145d98668e194).

So all I have is a picture you posted as an example. Watching that, this feature is probably too experimental for any practical usage now - but, on the other hand, if you could merge adjacent triangles of the same color and (optionally) turn off gradients simulation on studs, the result SVG must be significantly smaller and easier to render for any application, am I right? I only don't know how much effort it is, these two improvements... Maybe it's tooo much for such feature...

After enabling the feature, you didn't see EPS, SVG, and PDF as possible file types in the save dialog? Are you sure you spelled it right, and (on the command line) included the = before the 1? I'm pretty sure it still works.

As for improvements in the output, I use a 3rd-party library to convert my OpenGL commands, and I have no real control over it. I don't see it improving.
Reply
RE: SVG export from LDCAD?
#7
(2020-02-28, 12:49)Milan Vančura Wrote: Hi Travis. Unfortunately, I wasn't able to test this. Neither the cmdline option nor the same parameter in the config file made any change in Save snapshot behavior. Although I compiled LDView from source (current version from git) and I checked the commit with this feature is there (commit 75f35e318db0c2d8d06384613da145d98668e194).

So all I have is a picture you posted as an example. Watching that, this feature is probably too experimental for any practical usage now - but, on the other hand, if you could merge adjacent triangles of the same color and (optionally) turn off gradients simulation on studs, the result SVG must be significantly smaller and easier to render for any application, am I right? I only don't know how much effort it is, these two improvements... Maybe it's tooo much for such feature...

I just tested it and it works but it is very slow and creates very large files, so there are not a lot of advantages right now compared to simply creating very large bitmap renders.

Blender has a SVG export add-on, but there has not been a good "path" between LDraw and Blender and vice versa so far.

It is possible that the other non-LDraw tools (I do not recall their names right now since I have been out of the loop for a long while) may have a better "path" to and from Blender.
Reply
RE: SVG export from LDCAD?
#8
(2020-02-28, 23:17)Travis Cobbs Wrote: After enabling the feature, you didn't see EPS, SVG, and PDF as possible file types in the save dialog? Are you sure you spelled it right, and (on the command line) included the = before the 1? I'm pretty sure it still works.

As for improvements in the output, I use a 3rd-party library to convert my OpenGL commands, and I have no real control over it. I don't see it improving.
Exactly. After enabling the feature, I see the same options in Save snapshot dialog. I checked the spelling (even in sources) etc... The option name string is even in the compiled binary. But the effect is none.
Maybe it is because of my Linux Debian 10??

In the end it doesn't matter, probably and unfortunately. Because as you wrote you cannot improve the algorithm, this is a dead end anyway, isn't it? Unfortunately...

But thanks a lot and if you wish me to debug LDView on Linux, tell me and I help you as much as I can.
Reply
RE: SVG export from LDCAD?
#9
(2020-02-29, 21:49)Milan Vančura Wrote: Exactly. After enabling the feature, I see the same options in Save snapshot dialog. I checked the spelling (even in sources) etc... The option name string is even in the compiled binary. But the effect is none.
Maybe it is because of my Linux Debian 10??

In the end it doesn't matter, probably and unfortunately. Because as you wrote you cannot improve the algorithm, this is a dead end anyway, isn't it? Unfortunately...

But thanks a lot and if you wish me to debug LDView on Linux, tell me and I help you as much as I can.

This feature may not be supported by the Qt version.
Reply
RE: SVG export from LDCAD?
#10
(2020-02-29, 1:57)Michael Horvath Wrote: Blender has a SVG export add-on, but there has not been a good "path" between LDraw and Blender and vice versa so far.
As far as I know, Blender has a Wavefront OBJ import feature. If you like to give LDInspector a try, I would appreciate feedback for the LDInspector-integrated ldr/mpd-to-OBJ converter - this would be a one-way-path for ldr/mpd => obj => Blender.
Reply
RE: SVG export from LDCAD?
#11
(2020-03-01, 13:40)Stefan Frenz Wrote: As far as I know, Blender has a Wavefront OBJ import feature. If you like to give LDInspector a try, I would appreciate feedback for the LDInspector-integrated ldr/mpd-to-OBJ converter - this would be a one-way-path for ldr/mpd => obj => Blender.

I am not creating models for the OMR, so I am not sure LDInspector would be appropriate. MPDCenter for instance spawned hundreds of popup error messages such that it was totally unusable with Datsville.
Reply
RE: SVG export from LDCAD?
#12
(2020-03-02, 0:49)Michael Horvath Wrote: Datsville.
I searched a bit, but couldn't find a ldr/mpd file to test (I got something 2000-2014, sourceforge- and github-links seem to be removed, other links required an account). Can you please provide a link or a file? So I would try the conversion...
Reply
RE: SVG export from LDCAD?
#13
(2020-03-02, 8:51)Stefan Frenz Wrote: I searched a bit, but couldn't find a ldr/mpd file to test (I got something 2000-2014, sourceforge- and github-links seem to be removed, other links required an account). Can you please provide a link or a file? So I would try the conversion...

Yeah, I closed the GitHub project. I felt dumb working by myself on what was supposed to be a collaborative project. I can PM you a download link.
Reply
RE: SVG export from LDCAD?
#14
(2020-03-02, 14:55)Michael Horvath Wrote: I can PM you a download link.
Thanks for providing the current version. The rendering works fine even for non-OMR-compliant files - even with mirrored parts or references to other files that are mpds or ldrs (and not parts), with two little more lines of code even if they are not in the LDraw-typical directory structure. Also the Wavefront-OBJ-export works.

But the generated OBJ files are large. Very large. So on my (some years old) machine Blender imports those files only after loooooong minutes of waiting. For a single model this might be ok, but I doubt that it will work for the complete city...


Attached Files Thumbnail(s)
   
Reply
RE: SVG export from LDCAD?
#15
(2020-03-03, 10:48)Stefan Frenz Wrote: Also the Wavefront-OBJ-export works.

Apparently, Windows 10 has a model viewer built in! Anyway, it looks pretty good, except the transparent parts are not transparent.

I still have to determine exactly how much more RAM a Wavefront version of Datsville would require. (I am concerned less about hard drive space.)
Reply
RE: SVG export from LDCAD?
#16
(2020-03-03, 13:40)Michael Horvath Wrote: Windows 10 has a model viewer built in!
Good to know - having Linux I tested with g3dviewer. Wink

(2020-03-03, 13:40)Michael Horvath Wrote: except the transparent parts are not transparent
Hm, I export with "d" material option, but indeed g3dviewer does not show the transparent materials transparently - neither with "d" nor with "Tr" material option. Sad

To check your viewer, could you replace "d ...." with "Tr ...." in the material file and report? It's defined to be inverse transparency (d=1-Tr) and some viewers only use one of them. Or if you have a Wavefront OBJ file with working transparency, I would adopt the transparency definition therein.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)