Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How is this effort going? #2

Open
forresto opened this issue Feb 9, 2017 · 15 comments
Open

How is this effort going? #2

forresto opened this issue Feb 9, 2017 · 15 comments

Comments

@forresto
Copy link

forresto commented Feb 9, 2017

No description provided.

@PixnBits
Copy link
Owner

PixnBits commented Mar 16, 2017

Stalled a bit due to work schedule, but looking to pick this back up in earnest. My 3D printer is great, but after some SolidWorks experience I'm missing parametric modeling for hobbyists. (And can't justify $1.5K for licensing :-P) I've wanted this sort of thing for years.

@forresto
Copy link
Author

I wonder if the new wasm stuff could just compile the c version.

@PixnBits
Copy link
Owner

PixnBits commented Apr 20, 2017

I hope so, that'd be great!
Having minimal experience with LLVM and other C compilation magic it'd be a painful road for me so very open to efforts from others on that strategy

@PixnBits
Copy link
Owner

PixnBits commented Jul 26, 2017

Starting to get very basic solver functions working 🎉
Lots of deps chained together (so there was a lot of boilerplate? to get hammered out first):P Will port methods as they're needed, biggest challenge at this point is knowing how SolveSpace adds geometry and thus constraints to the sketch/system. I've been recording what I can determine in the porting knowledge doc, any insights welcome (esp. via PR)

@Evil-Spirit
Copy link

You shouldn't port all the SolveSpace's code, you can only port Solver part without entities or groups or even id's. Solver can be so simple. Then you can just write your own simple entites and editor for them using js and so on.

@PixnBits
Copy link
Owner

PixnBits commented Jul 26, 2017

That's good news!
Not being experienced with either C++ or SolveSpace's internals I wasn't sure what the minimum was for the solver 😅 The library page isn't too helpful in describing the API so I'm unsure of how to add constraints, equations, etc. in the optimal way. Not trying to be critical (docs are hard, there's so much to be thankful for in solvespace!), just me fumbling around.
Do you by chance know how to add, say, two lines of lengths with a point at the origin and perpendicular to each other? That may be a bad example; better, simpler, etc are welcome.

@PixnBits
Copy link
Owner

PixnBits commented Jul 27, 2017

(FWIW this is my first time looking at Jacobian etc solvers, I'm not well versed in the theory (yet) (probably obvious from a previous attempt 😅 before I found solvespace))

Now solving for 7 - 3:

  • it appears SK (Sketch) is a global in solvespace, removing globals I have a Sketch instance as a member of a System instance (so system.sketch from new System()), maybe that should be reversed?
  • have to manually add (solution) params to the sketch? (instead of being added as equations are added to the system? maybe this is an artifact/issue of the bullet item above?)
    • presumably these params hold the values of the solutions to the system oops, was looking in the wrong spot or saw the wrong number or can't Math. looks like system.mat.Z or system.mat.X contains the solutions/answers?
    • why 2 solution holders for only one equation? (and one calculated solution) premise (above) was incorrect

@Evil-Spirit
Copy link

Evil-Spirit commented Jul 28, 2017

@PixnBits,
The solver can be spit on two parts:

  1. Solver itself (System + Param + Expr + ExprParser). This is enough for creating system, adding prams and equations to it, solve it and so on. You shouldn't use any id's and lists here. You can abstract it completely.
  2. Geometic equations for constraints. I think for simple things you can write it yourself.

@PixnBits
Copy link
Owner

Thanks @Evil-Spirit !
Looks like System could be a child property/variable of Sketch but that System isn't dependent on Sketch. Oop. A bit of refactoring to do on my part (i.e. from const system = new System(); system.sketch; to const sketch = new Sketch(); sketch.system;).
I think most of System is completed, but I'm curious of the form of expressions solvespace puts into a System to find solutions, so I'll probably go deeper there just to get a feel.

@Evil-Spirit
Copy link

All what you should to do - is throw away all about sketch from Sytem. Then you can just fill system every time you need to update your sketch: transfrom your xyz params into Param, then fill equations using this params for every constraint, if System.Solve will be OKAY, you should copy back correspondent Params to your xyz vector. That's simple.

@Evil-Spirit
Copy link

Evil-Spirit commented Jul 28, 2017

System can be abstracted from geometry completely, you can solve any problems using this (don't forget to choose good params inital values)

@ceremcem
Copy link

I'm also interested in this work. Is there a way to help?

@PixnBits
Copy link
Owner

Sorry, I severely overestimated the time I'd have to work on this last year :(
I've put some recent effort into the feature/minimal branch. I think my original port of System.js was before I had a groove of recording the original source header and implementation file and lines, and discarded some areas including optimizations (like solving by substitution).
I started the feature/minimal_re-ported-System branch to see how hard it would be to re-port; turns out I don't think it will be. (The branch is pushed here only so I don't lose the effort, it's not an example of "polished code")
For helping...that's a good question. Adding more scenarios to the tests would be useful?

@ceremcem
Copy link

Adding more scenarios to the tests would be useful?

Absolutely. However, I think adding test cases is more chance to spot the target while using the library. Anyway, I'll do my best when I'm on it.

AFAIK, there are 3 main components in a 3D CAD application: Constraint solver (eg. solvespace), geometric model calculator library (eg. occt), visualizer (eg. threejs). Do you have any such combination plans to make node-solvespace usable in an environment?

@Evil-Spirit
Copy link

If you are looking for web-based CAD please consider my project https://github.com/NoteCAD/NoteCAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants