SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

How to use multi-rotation? (by Artem Zhidkov)
Dear Jonathan,

I'm using SLVS library to solve sketches. Trying to implement multi-rotation feature, I see that SolveSpace has same functionality (repeat rotating), which works well. I didn't find any API in SLVS to reproduce such functionality, so I've tried to create construction lines between center of rotation and each point to rotate. After that I set Angle and Equal length constraints for each point of initial entities and corresponding copy (please, see sample1.slvs). This method works for simple sketches, but more complex sketches failed.

The problem is that, if the initial shape has a lot of objects (10 and more) and I try to make more that 10 copies, SLVS while solving such system (about 500 parameters) reserves all memory and exits. As I found, there is a limitation on a number of unknowns used in single group, which is 1024. Number of unknowns in my system is less than limitation, but it leads crash anyway.

On the other way, I've studied how the repeat rotating works. It creates a separate group and allows to add some kind of constraints (please, see sample2.slvs). As I understood from the source code, the repeat rotating adds equations, where the angle of rotation is an unknown. Is there any way to use the same functionality on SLVS layer? I need to update the rotated objects if some constraints change their values.

Thanks in advance for your help,
Artem
Wed Aug 12 2015, 08:52:39, download attachment sample1.slvs
(no subject) (by Artem Zhidkov)
sample2.slvs is attached.
Wed Aug 12 2015, 08:53:08, download attachment sample2.slvs
(no subject) (by Jonathan Westhues)
The constraint solver doesn't need to see all the copies; it just needs to see the ones that are constrained. That's generally just one or two copies, though it could be more with certain constraints or construction geometry. After solving for the rotation of any one copy, you can calculate the rotation of all the others.

The application uses POINT_N_ROT_AA and NORMAL_N_ROT_AA, which as you note aren't exposed in that API. You could add that, analogously to the existing entity types. If you do, then note that the parameters (and some extra equations) to define that rotation are generated by the group, not any entities.
Wed Aug 12 2015, 09:58:34
(no subject) (by Artem Zhidkov)
Jonathan, thank you for comprehensive explanation. I will try all your suggestion.
Thu Aug 13 2015, 00:00:54
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2018 SolveSpace contributors. Most recent update Nov 22 2018.