News for hackers. Stuff that matters.

hannobraun

Re:Truck: CAD Kernel in Rust on Thursday March 09, 2023 @04:28AM (#35079642)
(I'm the author of Fornjot.)

> I wouldn't be suprised if the author of fornjot had similar feelings if they ever considered that approach.

Yeah, I don't think I have it in me to work on a non-trivial project in C++ :)

(Not saying that's the wrong thing to do, in general. I'm not the one to do it, is all.)

> fornjot is a hobby project.

This is not correct! Fornjot started as a hobby, but it has been my main focus since the start of 2022. I rely on my sponsors to support that work. Since around March/April 2022 I've been earning enough from sponsorships to cover my costs.

> So the fact that they start from scratch and may take years is not a deterrent. Rather its part of the appeal, I would assume. ;)

It's true that Fornjot is enormously ambitious. But I also think lots of people (chiefly those from the professional CAD world) are kind of missing the point on what it would take for the project to be successful.

OpenSCAD exists and has a user base. Roughly matching its feature set and incrementally improving from there, could already make Fornjot useful to a lot of people. I certainly don't plan to stop there, but I'm just saying, there's an incremental path here. It's not just "100 man-years for an industrial-grade CAD kernel or bust".

Ah, sorry! I missed that bit in the README and got confused :)
Hey, author of Fornjot here.

Rust was chosen as a modeling language for two reasons:

1. Since the whole project is written in Rust, it was the most straight-forward choice. No dealing with bindings to another language or a scripting language runtime for the time being. 2. To provide an interesting alternative. I suspect that there can be a nice niche for Rust, creating infrastructure for writing models (e.g. libraries for generating screw threads, that kind of stuff).

I don't think that Rust is a great language for defining CAD models. Long-term, I suspect that the preferred choice for Fornjot will be something else. But for the time being, this decision allows me to focus on the CAD kernel.

> There also seems to be a goal overlap between Fornjot and DieselCAD

Do you have a link for DieselCAD? Searching on Google only got me car results.

Re:Fornjot – The world needs another CAD program on Monday August 01, 2022 @05:43AM (#32303798)
Code-first CAD is the way to go for some users and some use cases. I personally won't make any stronger claim than that, nor will I accept any sweeping claims to the opposite.

The average guy can keep doing what they're doing. Fornjot will not take GUI-based CAD away from them.

Re:Fornjot – The world needs another CAD program on Monday August 01, 2022 @05:40AM (#32303783)
Hey, creator of Fornjot here. I had experimented with f-rep for years before switching to b-rep for the current iteration of Fornjot. I came to the conclusion that f-rep, while neat, is too limited for what I intend to do. I came to a similar conclusion regarding the mesh-based approach of CGAL.

I've written more about that here: https://www.fornjot.app/blog/why-fornjot-is-using-boundary-r...

Re:Fornjot – The world needs another CAD program on Monday August 01, 2022 @05:37AM (#32303763)
FreeCAD is GUI-based though, not code-first like Fornjot. A better comparison would be CadQuery (https://cadquery.readthedocs.io/en/latest/intro.html) or Cascade Studio (https://zalo.github.io/CascadeStudio/), both of which are code-first and based on the same CAD kernel as FreeCAD.
Re:Fornjot – The world needs another CAD program on Tuesday March 29, 2022 @09:09AM (#30842055)
I will definitely keep reading and learning, as well as gaining practical implementation experience. We'll have to see how that goes, and what the solution will end up being.

> Another direction you could take is to define just the API, and use the opencascade kernel (like FreeCAD) until the rest of your code is ready.

A CAD kernel is the central dependency for any CAD program, and I feel that it would be wrong to just use one and accept its limitations. I need to be able to take ownership, to work on it directly. OpenCASCADE is a huge pile of C++ code, which is the opposite of all that. (Not saying it's wrong to use in general, just that I'm the wrong guy to work on a huge pile of C++ code.)

I've considered using Truck[1], but decided not to do that for now. I really want to see what I can come up with. If that doesn't work out, at least I'll be in a much better decision to decide what other option would be best.

[1] https://github.com/ricosjp/truck

Re:Fornjot – The world needs another CAD program on Tuesday March 29, 2022 @08:29AM (#30841614)
> How do you solve that in "code CAD"? I mean referring to a geometry that's a result of some previous operations, not one that you manually created.

I've written down some preliminary thoughts here: https://github.com/hannobraun/Fornjot/issues/101#issuecommen...

And let me emphasize, these are just preliminary thoughts. I can see cases where what I wrote there won't work, and I'm sure there are many more problematic cases I haven't thought of yet.

There's still a lot of work to do before any of that even becomes relevant for Fornjot. I'll keep thinking about it in the background, but I don't expect to come up with a meaningful solution before I had a chance to really dive into the topic.

CadQuery has its own approach, which I have yet to study in detail: https://cadquery.readthedocs.io/en/latest/selectors.html

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @12:30PM (#30832286)
I have a concept in mind, but have no idea yet whether it's going to work out: My idea is to require relationships between geometric objects to always be explicit.

For example, you're not allowed to define a point that happens to lie on a surface. You must instead explicitly define the point in terms of the surface. By extruding from a sketch that lies in the surface, or by saying "extrude until the shape hits the surface", or by specifying some kind of constraint.

I hope that it is practical to design CAD models in a way, such that these relationships are always explicit, and I hope that this will enable the CAD kernel to not have to rely on messy floating point stuff comparisons. But as I said, not no idea if it's going to work out like that.

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @12:12PM (#30832058)
No idea :)

I know I want it, and that's about the extent of the design work. There's loads of more basic capabilities to add, before it makes sense to tackle constraints.

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @09:27AM (#30830306)
Hey, creator of Fornjot here.

> Shouldn't this be a separate project?

Maybe. Not right now, I think. Not much of a point, as long as I'm the one doing most of the work.

The kernel is available now as a separate library though, that can be used independently. If it attracts its own set of users and contributors, it might make sense to have a separate website and repository.

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @08:38AM (#30829863)
Hey, creator of Fornjot here.

Support for architecture use cases is currently listed on Fornjot's feature wishlist: https://github.com/hannobraun/Fornjot/discussions/146

As is noted there, I lack any expertise in this field, and it's largely unclear what specifically would be required to support it. Feedback is very welcome!

> isn't it kind of similar to OpenSCAD?

Yes, OpenSCAD is one example (the most prominent, I think) of the Code-CAD approach.

The Fornjot FAQ addresses OpenSCAD: https://www.fornjot.app/faq/

Second question. (Sorry, there isn't a way to link to specific questions in the FAQ yet. I've made a note to add that.)

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @08:09AM (#30829607)
Hey, creator of Fornjot here.

> I do question whether Rust is the write choice for defining models,

You're not the only one :-)

As I've written in reply to other comments (here and elsewhere), it was just the easiest option to start with, given that the rest of the project is also written in Rust. Fornjot is architected to be language-agnostic, so we're not bound to Rust on the modeling side.

> but it does seem like a cool project.

Thank you!

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @08:06AM (#30829580)
Hey, creator of Fornjot here.

Fornjot is written in Rust, so starting with Rust as the modeling language was the most straight-forward option. I do agree that Rust is not ideal for this use case.

Fornjot is architected to be language-agnostic. Long-term, I hope there will be a selection of interoperable options for the modeling language.

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @08:01AM (#30829556)
I agree that a geometric constraint solver is very valuable. Having one built-in is a goal for Fornjot. We're not nearly there, though!
Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @07:58AM (#30829532)
I've been reading Boundary Representation Modelling Techniques by Ian Stroud. Not the most approachable book, and I haven't read nearly all of it, but I already found it very valuable.
Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @07:54AM (#30829508)
Hey, author of Fornjot here.

> The modeling language for Fornjot is Rust. To me, this seems like an akward language to write models in.

I fully agree! Given that Fornjot is written in Rust, starting with Rust as the modeling language was just the most straight-forward option.

But Fornjot is architected to be language-agnostic. Right now, it uses a plugin system based on dynamic linking, and you could plug anything in there that can generate C-ABI-compatible structs (the plan is to replace that with a system based on WASM).

In addition, I've started splitting Fornjot into self-contained libraries[1]. Once that effort is complete, there will be lots of ways to make Fornjot available to other languages.

That said, I think there's merit in having options when using Code-CAD, and Rust is certainly different enough from the typical alternatives to be valuable. I don't think it will ever be the best option for regular CAD modeling, but it might have a niche in infrastructure code that CAD models (written in other languages) use.

[1] https://github.com/hannobraun/Fornjot/issues/141

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @07:44AM (#30829439)
Hey, author of Fornjot here.

> I do wonder what kind of limitations the author ran into with OpenSCAD

Lack of bevels/chamfers, no way to refer to existing geometry (to sketch something on a face and extrude that, for example), no constraint-based modeling, weird and limited language. Those are a few off the top of my head.

I don't want to speak badly about OpenSCAD. It's obviously very useful to a lot of people, and I myself keep coming back to it for my own projects (Fornjot isn't ready to replace it). But there are many good reasons to want something else.

> and why they decided building a replacement code-CAD program was the best way to go.

What would the alternative be, in your mind? Trying to join the OpenSCAD project, saying "I want to change everything", would just be rude.

I don't want to fork a big C++ project either, as I don't know the language very well and have no interest in learning it. I'm also not convinced that starting with a fork of something would be better, in the long run. There's value in looking at the problem with fresh eyes.

Re:Fornjot – The world needs another CAD program on Monday March 28, 2022 @07:34AM (#30829379)
Hey, author of Fornjot here.

In addition to the article that agucova posted, OpenSCAD is also specifically called out in the FAQ: https://www.fornjot.app/faq/

Second question. (Sorry, there isn't a way to link to specific questions in the FAQ yet. I've made a note to add that.)

Re:Fornjot: A next-generation Code-CAD application on Friday March 11, 2022 @05:54AM (#30638446)
Interesting, thanks for elaborating!

I have had similar thoughts: Having a low-level representation that only makes sure that a geometric object you reference actually exists (and does other low-level validations), then have a wrapper around that, that provides higher-level operations and makes sure your model is also manifold.

This isn't thought out yet, just some stuff I've pondered. Thanks for providing more input to my thought process!

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @12:05PM (#30629274)
Some of that documentation exists in the issue tracker. But that vision is something I refine as I learn more about use cases and the problem space. So it's not like I can just write down the ideal state right now :-)
Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:34AM (#30626192)
Hey, author of Fornjot here.

Could you give a bit more detail on what you mean by that? The plan for Fornjot is to use WebAssembly as the intermediate representation for models: https://github.com/hannobraun/Fornjot/issues/71

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:33AM (#30626187)
Hey, author of Fornjot here.

Chamfered edges are definitely planned!

> edit: Models are defined as Rust code. > > Oh...

Not sure how to interpret that "Oh.." :-)

Rust is the only modeling language supported right now (give that the rest of the project was written in Rust, it was the easiest solution), but Fornjot is architected to be language-agnostic.

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:30AM (#30626165)
Fornjot is architected to be language-agnostic. Rust is just the easiest language to support, given that the rest of the project is written in it too.

I (author of Fornjot) don't have any near-term plans to add support for other languages, but I hope that people will start experimenting (and someone already has: https://github.com/WeirdConstructor/Fornjot/tree/wlambda_int...).

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:24AM (#30626124)
Exactly. All a model does, is build a C-ABI-compatible data structure. And even though Rust is currently the only language supported, Fornjot is architected to be language-agnostic.

I don't think Rust is the ideal language for this problem, but with Fornjot itself written in Rust, it was the easiest one to support. Gotta start somewhere.

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:20AM (#30626096)
Well, no. But it's what we currently have. As adamsvystun notes, I have to start somewhere.

Making models more convenient to define is planned (https://github.com/hannobraun/Fornjot/issues/72), support for other modeling languages is on the wishlist (https://github.com/hannobraun/Fornjot/discussions/146).

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:15AM (#30626064)
phkahler is probably referring to the milestone I'm currently working on: https://www.fornjot.app/blog/straight-edges-flat-faces-simpl...

Curves (currently only full circles) are supported, but the focus is on building a flat-faced/straight-edged MVP that support full CSG. It's possible that when this MVP is released, that curved edges/surfaces will be marked as experimental and not have full support for CSG, for example.

This is just a matter of priorities. Gotta start somewhere, then improve from there.

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:10AM (#30626024)
Hey, author of Fornjot here.

> Yes, I think he's being rather naive about that.

Oh yes, definitely :-)

Not in the sense that I think it's going to be easy, or anything like that. But I'm definitely (and consciously) focusing on the immediate next steps, while not really having a long-term plan. I do have enough of an idea of what I want to achieve, to know which direction to go in. And I'm doing that one step at a time.

This is definitely not the only way of tackling such a large problem. Someone else might approach this with a big vision and a solid plan, then use that to find the funding. I don't think either approach is inherently better, but the incremental approach is definitely a better fit for me.

> Starting with flat surfaces and straight lines is really ignoring the hard problems and will likely require a complete rewrite later. IMHO support for NURBS surfaces is a requirement for CAD and export/import of STEP files as well.

That's fair. And there are other valid criticisms as well, for example so far everything is single-threaded and CPU-based[1], which most likely won't do long term.

The thing is, I'm not capable of designing and then implementing a multi-threaded NURBS-based CAD kernel. I lack the expertise and experience. But what I can do, is design/implement this CAD kernel in an incremental way, step by step. One could argue, what's happening right now is the design process, and the implementation is just a useful side effect.

And we shouldn't forget, OpenSCAD exists and has its place. Something that's 80% as powerful, but has easy support for chamfers (and maybe some other goodies), would already be very useful to a lot of people. I'd rather focus on that and improve from there, than risk not getting anywhere, because I tried to tackle all the hard problems at once.

> Having said that, if he keeps going it will be a good thing.

Thanks! Maybe coupling the encouragement with criticism makes it more effective, not 100% sure :-)

---

[1] What I mean is, everything in the CAD kernel is CPU-based. The graphics are done using a GPU, of course.

Re:Fornjot: A next-generation Code-CAD application on Thursday March 10, 2022 @07:07AM (#30626006)
Hey, author of Fornjot here. Thank you for the encouraging words!

> I do believe there is a commercial market for this to - a cheaper and easer to use kernal to build cad products on would be very welcome, I could see the potatial for commercial investment in a open source kernal. I have a Mechanical/Industrial Design background as well as Software and often get tempted to try and build various CAD tool ideas I have, having a good modern foundation to build upon would be brilliant.

I'd love to get there one day! I've already been in contact with potential commercial users (well, one), but very understandably, they'd like to see more progress before taking a bet on such an early-stage project.

For now, I'm relying on sponsorship from the community. It's not enough to cover my living costs yet, but the growth is there. I'm optimistic that it will reach a sustainable level before I run out of money.

Re:Von Neumann Defense Force source code is now available on Monday November 28, 2016 @04:44PM (#13058699)
It's not very far along, unfortunately. While my vision stayed intact over the course of the project, the specifics changed, and I've changed my approach a few times. Every time that happened it basically reset the progress. I'd guess it would take me a few months at most to get to the same state, if I had to start from scratch. Someone with proper tools (like a game engine, which I didn't use) could be much faster.

What's there right now are basic 2D graphics, a user interface based on an in-game console (designed as a prototyping tool; we planned to replace it with a proper UI), some buggy beginnings of a mouse-based interface, networking code (client/server; the clients can see each other in the game), and some basic physics.

When you connect to the game, you start in orbit above a planet and can use the in-game console to execute commands that change your orbit. You can't really do much else other than fly around. So there's not really any game play or anything interesting to do, really.

If we had continued development from there, we could have started adding some real game play pretty much right away, but to get the basics right would have required a lot of iteration, and we would have been weighed down by all the technical infrastructure that was already there. Plus, none of that technical infrastructure was very polished, so it would have required a lot of updating and rework along the way.

So yeah, still years of work ahead, I suppose.

Older »