LDraw.org Discussion Forums

Full Version: [0.2.1] LDForge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Version 0.2.1 of LDForge is now out, fixing a bug causing LDForge to skip every 300th line of a given file. See release document and downloads here



LDForge is released under GPLv3 and CC-BY-SA (for icons). Repository: here, for bleeding-edge stuff.

Some things to note:
  • BFC red/green view, albeit present, isn't always right; it assumes everything is CCW and it fails to catch INVERTNEXT in subfiles. Also it has to draw everything twice so there's a bit of a performance hit.
  • The camera suffers of gimbal lock. I'm going to try address this for future versions.



So in some 2010 I had posted some ideas about this thing. Even though I've been quite wholly inactive, I've had this on the back burner for the past year. I've been learning a lot of programming things and I guess I'm a more mature person today.

Basically I've rewritten the entire thing, instead of Tcl, this thing is being written in C++/Qt/OpenGL. The only stuff I've kept were some OpenGL things I ported from the old renderer to make this actually capable of drawing things. While MLCAD had 4 camera windows, this thing has one single one with 7 modes which can be quickly changed to and from.

Features:
  • List view ala MLCAD with multi-selection. One object per line, one line per object. Items not colored main or edge color (16/24) have their color reflected in the list view for identifying.
  • Parse error recovery, if a line/object cannot be parsed properly it will be displayed as an errorneous object. This object can be selected and its contents edited and have it reparsed, so you can fix these errors within LDForge.
  • 6 camera modes plus a free-angle one.
  • Drawing mode that allows you to literally draw polygons and lines into the screen.
  • Object hiding
  • Select by color or type
  • Quick edge-lining, takes any number of polygons and creates edgelines around them
  • Ability to edit object's LDraw code directly
  • Inlining, plus deep inlining which grinds down to polygons only
  • Auto-coloring (sets color to the first found unused color), uncoloring (sets colors to main/edge color based on type)
  • Coordinate rounding, inverting, coordinate replacing, flipping, quad splitting
  • Screenshotting
  • Vertex object, generic radial primitive object
  • LDConfig.ldr parsing for color information
  • Ability to launch Philo's utilities and automatically merge in output
  • BFC red/green view (incomplete)
  • Wireframe mode, axis drawing
  • Image overlays for getting part data from pictures
Looks nice

Quote: I'm still a Linux user and to be painfully honest I haven't yet managed to compile Qt stuff on Windows yet.. I'll have to figure that out sometime down the line.

I highly recommend using MinGW, especially if you used to Linux. It's basically the essence of bash and gcc on windows. I use it with LDCad (wxWidgets instead of qt though)

I'm mainly on Windows but the only thing I have to do to compile a Linux version is boot up Ubuntu 10 or something open a terminal do svn update and type make Smile This is possible because the MinGW environment is so simular.

Alternative is visual studio but you might need to account for many (minor) compiler differences using tons of #ifdef's etc.
I am really appreciate what you are planning. I hope that will end up with a good tool for part authors. As far as I know currently there is only MLCad for doing visual part authoring on Windows.
I also have a tool like your on my to code list, but so far I have no experience in 3d (openGL or anything else) and therefore I would be happy to see this project done by someone else. Smile You can count on me if you need guys for testing Smile
Thanks guys Smile

Also, yay, it's a brick!
[Image: ldforge-4.png]
I'm excited too. The brick looks very good Smile

Tim
Looks good indeed, count on me for beta tests Wink
I'm glad to see there's interest for this. Smile

Also I just managed to structure inlining in a way that all immediate subfiles (i.e. subfiles the current open file references) are cached into memory for faster processing. I also honed out matrix multiplication and now this thing can properly render more complex parts too:

[Image: ldforge-5.png]
[Image: ldforge-6.png]

Yay for weekend coding.
Keep on Smile
LDConfig.ldr is now parsed and read properly so all colors are available. Working on BFC support now.
When do you think we can test on our systems Smile
When it's ready enough I guess. There's still a lot todo before it's actually usable for its intended purpose rather than looking at parts. Smile
Wher I can download LDForge?
It is still in early development, no releases just yet.
Update: undo/redo stuff done, object moving and 3d selection done, also I've added the quick color toolbar (configurable!). Also I've added this kind of generalized radial primitives (I call them just radials for short) - basically arbitrary circular primitives. The point is that if you need a 1/4 ring 14 in your part, you can just add it and model the part with that without having to deal with primitives that don't exist yet and stuff. They can then be easily resolved into subfile references when you're done with the part. Right now it can do circles, cylinders, discs, disc negatives, rings and cones.

There's still a good lot of things to do before it's actually usable for part editing but I've gotten a lot done recently.
Thanks for the update!!!
Man this has been blazing recently. I've done a lot during the past month. I've gotten a lot of editing stuff done as well as general usability and rendering stuff... including ability to switch between and use the 6 fixed cameras.

And just now I finally managed to get object drawing working:

[Image: planedraw-1.png]
[Image: planedraw-2.png]

This is a major accomplishment for me, even though it only works on the top-down camera for now! Tongue
At this point I guess I should start cleaning stuff out and fixing a few things for an alpha build.
I like to have one of your alpha builds Wink
[Image: ldforge-win7.png]

You guys cannot possibly comprehend how painful it was to get this built under Windows... Qt only added proper OpenGL w/ MinGW builds in a 5.1.0 beta - with what LDForge wouldn't run at all since the GL stuff took right out and crashed... so I had to take the hard route out and compile Qt on Windows. It took me three days in a row to figure this all out and building Qt alone took 2.5 hours.. but it works! .. about time. I was about to lose hope.

I've also fixed the issue with drawing and in the alpha it should be able to draw in all 6 cameras. I also took and added support for external programs so you can launch Philo's utilities we all know and love without having to switch the window and overlays to assist in getting geometry from part images.

At this point I just need to rebuild Qt again (the debug dlls I got are bout 500 megs...), clean up a few small things, package the dlls in and then tag the 0.1 alpha. With luck it should be up today or tomorrow. Smile
I once tried unsuccessfully to compile QT on Windows for LPub... So even if I don't understand the awful details, I can easily sympathize Wink
Quote:I also took and added support for external programs so you can launch Philo's utilities we all know and love without having to switch the window and overlays to assist in getting geometry from part images.
Excellent!!!
Quote:With luck it should be up today or tomorrow. Smile
Yeah!!!
Looking really good. I'm getting even more curious now.
I would love to test it.
---
----
Alright. It's been 3 years since I first concieved this.. if back then I was told I'd now be releasing this as a C++/Qt/OpenGL application 3 years from then, I don't think I would've believed a word. Smile

Version 0.1 Alpha is out: grab the Win32 binaries or the source archive (tar.gz format)

LDForge is released under GPLv3 and CC-BY-SA (for icons). Repository URL is https://bitbucket.org/Artakha/ldforge/ for bleeding-edge stuff.

Some things to note:
  • BFC red/green view, albeit present, isn't always right; it assumes everything is CCW and it fails to catch INVERTNEXT in subfiles. Also it has to draw everything twice so there's a bit of a performance hit.
  • Undo/redo stuff is disabled for now over stability issues, it's scheduled for a rewrite.
  • The camera suffers of gimbal lock. I'm going to try address this for future versions.
That's a progress bar !!!
Mmhhh...
When I launch it I get a "runtime error" with little information ("This application has requested to terminate it in an unusual way")
Sad
Anything special to do? (Win XP SP3 32 bits)
Hey,

sorry, but the same here (VM Win XP SP3 32Bit and VM Win7 SP1 32Bit):

Quote:Microsoft Visual C++ Runtime Library
Runtime Error!
Program: X:\YYY\ZZZ\ldforge.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Rolf
Strange.. yet ironic, I was exactly ancipitating something like this.

I'll try trigger this problem on some windows machines and try debug if I'm successful.
Turned out this was a packaging issue, a dll dependency managed to slip through..

Re-packaged: new zip here
It launches fine! Going to explore Wink
Great to hear! Have fun with the thing. Smile
Starts fine here too.
I'm gonna have some fun this weekend...;-)
Thanks
OK, wishes, problems I found or things that puzzle me... Many of them maybe already in your todo list, and for sure YOU define your priorities Wink All this in very random order...
- The configure button at 1st startup in the screen that asks for LDraw library does nothing for me.
- I'd like a shortcut and/or toolbar icon to enable/disable BFC view
- Open file seems to always start in LDForge folder. Should start in latest accessed folder imho...
- It seems that I can't open a file whose name or path contains accentuated characters (sorry, I'm French Wink
- Cut and paste between two instances of LDForge? Cut / Copy to place LDraw lines as text to paste into external text mode application?
- Better shading?
- A way to control the split of quad into triangles? what about the inverse joining operation?
- I can create vertices - What can I do with them?
- Edit object applied to vertices start from 0,0,0 instead of vertices coordinates
- What's the rationale behind "radial" concept?
- At one time, LDforge stopped to display anything, I had to restart it to be able to use it again. More if I can reproduce this...
- Ctrl+drag or Alt+drag to pan? Middle button drag is not very comfortable (hurts my finger!)
- I was able to use external apps on my Win7 computer, but it doesn't seem to work on my XP box (nothing happens).
- When I select something in main view, I'd like that the text view jumps to first (or last) line of selection.
- In flat views, I'd like a reminder of axis directions (eg. labels -x, +x, -z, +z in view corners)
- Snapping on existing geometry?

...stopping here at the moment...
Philippe Hurbain Wrote:- I'd like a shortcut and/or toolbar icon to enable/disable BFC view
- Open file seems to always start in LDForge folder. Should start in latest accessed folder imho...
- Ctrl+drag or Alt+drag to pan? Middle button drag is not very comfortable (hurts my finger!)
- In flat views, I'd like a reminder of axis directions (eg. labels -x, +x, -z, +z in view corners)
- When I select something in main view, I'd like that the text view jumps to first (or last) line of selection.
Yeah these could be done.

Philippe Hurbain Wrote:- The configure button at 1st startup in the screen that asks for LDraw library does nothing for me.
It's supposed to trigger that "check for LDraw path" thing, it triggers auto if you search for the directory but it doesn't happen if you type it in... that thing is planned to be just removed.

Philippe Hurbain Wrote:- It seems that I can't open a file whose name or path contains accentuated characters (sorry, I'm French Wink
hm. Never took accents into account.. I'll bet it's an issue with encodings.

Philippe Hurbain Wrote:- Cut and paste between two instances of LDForge? Cut / Copy to place LDraw lines as text to paste into external text mode application?
Hrm. Could consider this otherwise but why do you need two instances open? Multiple file support is on the list if it's about that. Exporting selection into text files is certainly doable though.

Philippe Hurbain Wrote:- Better shading?
The lighting sucks, I know. Tongue
The GL renderer's drawing method in general is kinda clunky and just uses display lists, but getting that to already work was quite the effort.. maybe there'll be better lighting/shading if and when I get to know more about more advanced GL techniques.. for now this'll have to do.

Philippe Hurbain Wrote:- A way to control the split of quad into triangles? what about the inverse joining operation?
Sure, whenever I figure how to interface it. For the inverse operation I guess Rectifier already does the job, though if that's not ideal I could try figure some algorithm..

Philippe Hurbain Wrote:- I can create vertices - What can I do with them?
I was planning on making them be drawn on the screen and allow them be snapped to while drawing.. at this point I'm not sure what I'll do with them.

Philippe Hurbain Wrote:- Edit object applied to vertices start from 0,0,0 instead of vertices coordinates

Philippe Hurbain Wrote:- What's the rationale behind "radial" concept?
The point of them was that you could have any sized ring or cone at hand, kind of a model the part now and worry about primitive relations later. Honestly, I've began to doubt their usefulness recently as well.

Philippe Hurbain Wrote:- At one time, LDforge stopped to display anything, I had to restart it to be able to use it again. More if I can reproduce this...
Not much I can do about that unless I get a way to reproduce it.

Philippe Hurbain Wrote:- I was able to use external apps on my Win7 computer, but it doesn't seem to work on my XP box (nothing happens).
Hm.. could it be possible that the paths under XP have accents and Win7 ones don't? I'd see that as the most likely culprit, if not, I'll have to somehow get my hands on an XP system..

Philippe Hurbain Wrote:- Snapping on existing geometry?
Yeah I'd want to do this too but there's more important things to take care of for now. Also I'm wondering what's the most efficient route to take to keep it from being too slow or consuming too much memory..

...stopping here at the moment...[/quote]
Quote:Hrm. Could consider this otherwise but why do you need two instances open? Multiple file support is on the list if it's about that.
Yes, that was the idea. So if you support multiple files, it's fine too. Support of text export is another (useful) thing.
Quote:Hm.. could it be possible that the paths under XP have accents and Win7 ones don't? I'd see that as the most likely culprit, if not, I'll have to somehow get my hands on an XP system..
No, path is pretty simple on both machines: L:\LDraw\Apps\LETGUI\coverer (it's C: on my Win7 one)
Quote:Not much I can do about that unless I get a way to reproduce it.
Sure Wink
Santeri Piippo Wrote:
Philippe Hurbain Wrote:- It seems that I can't open a file whose name or path contains accentuated characters (sorry, I'm French Wink

hm. Never took accents into account.. I'll bet it's an issue with encodings.

I had the same problem with LDCad, the problem is Linux uses UTF8 across the board, but many windows api's (like lowlevel file io) still use the local code page. So you probably have to convert strings before passing them to low level file io functions using 'wcstombs'. This is only needed for window versions. I use an asOSMBStr method in my string class that returns utf8 on linux and whatever the wcstombs returns on windows. You then use the method whenever you need to pass a filename to an api. It's one of the very few functions that needs a different implementation depending on platform.

If you use some kind of string/io library wrapper (NOT plain STD) this should be done automatically though, or maybe it's disabled by default.
I think the problem in question is that I'm passing the strings to the I/O functions directly, from the looks of it they should be converted to QByteArray first to resolve encoding problems. I can make the problem happen even on my Linux system.

EDIT: Hmm, maybe it's better to just drop C-style fopen() and friends completely and just use QFile...
Thought to drop an update, I've rewritten undo/redo handling at this point so in the next version it should be usable. There's also some usability updates plus ability to snap to existing vertices.

Right now I'm in the process of converting the codebase from 8-bit strings and Unix-style file management to Qt-style 16-bit strings and file management which should make things locale-aware. My (hazy) foresight tells me there will probably be a release before the end of June.
Another saturday project later... (mind my system style)

[Image: prims.png]

Yeah it's more savvy about primitives now.
Just a heads up, while a 0.2 release didn't happen yet, I've been doing a good lot of under-the-hood work.. hopefully I can tag another alpha build soon. Also I just moved the repo to Github, in case anyone's interested: https://github.com/slatenails/ldforge
Version 0.2 of LDForge is now released. Main flagship features are vertex snapping and rewritten (and actually usable) undo/redo management. Also, the radial type has been replaced with a simple primitive generator, along with a good load of features and bug fixes.

See full release document here, including full changelog and downloads.
Will test when I come back home after holidays Wink
Thanks!
Update: multiple open file support's mostly up and running, still needs some honing but the basic functionality is there. Smile
[Image: multifiles.png]
Also I'm working on redrawing the icons, hopefully I'll get them done for a 0.3 release as well. I'm trying to make them appear sharper than the current rather blurry ones though I still need to work on the shading and such to make them not appear bland.

Further, J.C. Tchang has updated his excellent LDForge manual, I've mirrored it on my Dropbox: https://dl.dropboxusercontent.com/u/6605...Manual.zip
Another weekend project done (already...), it can now download parts from the PT. For instance here, the entire EV3 brick Philo recently submitted. It checks through the dependencies and tries to download parts it fails to load.

[Image: ptdownload-1.png]
[Image: ptdownload.png]
As you can now get these binaries for Windows?
I myself have tried to compile on Qt, but I had a lot of mistakes and could not run.
Fyodor Kolov Wrote:As you can now get these binaries for Windows?
I myself have tried to compile on Qt, but I had a lot of mistakes and could not run.
Sorry for such late a reply, but I cannot really understand what you are saying. Anyway to compile you need Qt4/5 with desktop OpenGL. AFAIK only Qt 5.1.0 and up ships such binaries.

Anyway I've been busy adding some stability to the new features and hope to push another build soon enough. I tried converting the GL renderer to VAOs but ran into a few problems:
  • compiling LDraw object data to vertices is quite the job since there's both triangles and lines, as well as the pick scene and the BFC red/green scene around. need to find out proper optimization for that
  • since all polygons would get chopped down to triangles, the wireframe view would display seams within quadrilaterals

Perhaps I'll try again at some point. I'm certain though that switching to VAOs is necessary should proper BFC red/green view be desired, it's practically impossible with display lists.
It's been a while without any updates, been mainly testing things as well as trying to get VAO rendering done (it works but I seem to have some conflicts with Qt with it :/), as well as trying to get a better icon theme done, not to mention trying to get overlay images changed into background images (though again I run into conflicts with that)

Anyway LDForge's project file was created exactly one year ago, on sept 22:
Code:
# Automatically generated by qmake (2.01a) Sat Sep 22 17:29:49 2012

So it's sort of LDForge's first birthday, hooray for that. I hope to put out the 0.3 release even if the only big features that would come with it would be the multi-file support and PT downloading.
This one sure was a challenge to get working, I had to write my own ring finder algorithm, not to mention the hassle with the GUI... but it lives!

[Image: rings-1.png]
[Image: rings-2.png]
[Image: rings-3.png]
[Image: rings-4.png]
Quote:I had to write my own ring finder algorithm

I am searching for such an algorithm quite a while. Can you share your algorithm with us? So we can incorporate that into other applications as well.
https://github.com/slatenails/ldforge/bl...c.cpp#L307 -- within LDForge
http://pastebin.com/FPb5Cf7C -- before I integrated it into LDForge, works stand-alone.

This is my current one, although it's a little cheapstake for now. I'm still going to have to improve it so it can find more optimal solutions...
Thanks for sharing this with us. As I am not familar with the used languages I still have a question before I try to translate this for me (in VB.NT): Can your algorithm also work with decimals? Say outer diameter 23.5 and inner diameter 10.4 ? This is something I am often faced also in the past.
Pages: 1 2