[Feature Request] Relative offset in Linear Pattern
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
[Feature Request] Relative offset in Linear Pattern
Hi folks
This feature request has already been brought up here
I also wanted this functionality in FreeCAD, so I made a fork and implemented it.
Posting here as there doesn't seem to be a feature request on github, and it'd be good to have some dialog with the devs/community before I submit a PR
It functions basically as you would expect: when editing a linear pattern, you can switch between 'Length' and 'Offset' mode. 'Length' evenly distributes occurrences along a length (ie. the way that linear pattern currently works), while 'Offset' spaces each occurrence by some offset value. Screenies below if I'm unclear.
Currently we can use expressions to achieve this behaviour, but I think having it built into linear pattern is more intuitive.
Feedback and constructive criticism are very welcome!
- sugol
This feature request has already been brought up here
I also wanted this functionality in FreeCAD, so I made a fork and implemented it.
Posting here as there doesn't seem to be a feature request on github, and it'd be good to have some dialog with the devs/community before I submit a PR
It functions basically as you would expect: when editing a linear pattern, you can switch between 'Length' and 'Offset' mode. 'Length' evenly distributes occurrences along a length (ie. the way that linear pattern currently works), while 'Offset' spaces each occurrence by some offset value. Screenies below if I'm unclear.
Currently we can use expressions to achieve this behaviour, but I think having it built into linear pattern is more intuitive.
Feedback and constructive criticism are very welcome!
- sugol
Re: [Feature Request] Relative offset in Linear Pattern
This feature request is done more often i have done it my self. I have tried to figure out myself i was able to do it.
I was able find the feature back but at that moment i was unable to compile myself and the work looks a bit to complicated (for my level of c++ )to just edit is and make a pull request.
If you interested just start looking here:
https://github.com/FreeCAD/FreeCAD/blob ... rPattern.h
https://github.com/FreeCAD/FreeCAD/blob ... attern.cpp
and
https://github.com/FreeCAD/FreeCAD/blob ... rameters.h
https://github.com/FreeCAD/FreeCAD/blob ... meters.cpp
https://github.com/FreeCAD/FreeCAD/blob ... ameters.ui
I was able find the feature back but at that moment i was unable to compile myself and the work looks a bit to complicated (for my level of c++ )to just edit is and make a pull request.
If you interested just start looking here:
https://github.com/FreeCAD/FreeCAD/blob ... rPattern.h
https://github.com/FreeCAD/FreeCAD/blob ... attern.cpp
and
https://github.com/FreeCAD/FreeCAD/blob ... rameters.h
https://github.com/FreeCAD/FreeCAD/blob ... meters.cpp
https://github.com/FreeCAD/FreeCAD/blob ... ameters.ui
Re: [Feature Request] Relative offset in Linear Pattern
I've already gone through those files and made the relevant changes in my fork (linked in original post)Jee-Bee wrote: If you interested just start looking here:
https://github.com/FreeCAD/FreeCAD/blob ... rPattern.h
https://github.com/FreeCAD/FreeCAD/blob ... attern.cpp
and
https://github.com/FreeCAD/FreeCAD/blob ... rameters.h
https://github.com/FreeCAD/FreeCAD/blob ... meters.cpp
https://github.com/FreeCAD/FreeCAD/blob ... ameters.ui
Re: [Feature Request] Relative offset in Linear Pattern
Looks like a good addition. Thanks for working on it!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Feature Request] Relative offset in Linear Pattern
No problem! I'll spend some more time getting the code cleaned up, and probably submit a PR when I have time in a couple of dayschrisb wrote:Looks like a good addition. Thanks for working on it!
- adrianinsaval
- Veteran
- Posts: 5551
- Joined: Thu Apr 05, 2018 5:15 pm
Re: [Feature Request] Relative offset in Linear Pattern
This would be a welcomed addition really, once you're happy with your implementation for linear pattern it would be nice to copy that for polar pattern too, considering that maybe there's a better word than offset that's applicable to angles too, separation? spacing?
I haven't looked at your code but consider using the same properties as before in the background or auto updating them to match so the pattern still works correctly if you open in an older version of FreeCAD, I know this isn't a priority but it would be nice and here it's possible to do it.
When you submit your PR keep in mind that we are currently in a feature freeze for 0.20 since it's close to release so this can only get merged once the 0.21 dev cycle starts.
I haven't looked at your code but consider using the same properties as before in the background or auto updating them to match so the pattern still works correctly if you open in an older version of FreeCAD, I know this isn't a priority but it would be nice and here it's possible to do it.
When you submit your PR keep in mind that we are currently in a feature freeze for 0.20 since it's close to release so this can only get merged once the 0.21 dev cycle starts.
Re: [Feature Request] Relative offset in Linear Pattern
I hadn't considered making this work with polar pattern too -- as you say we're in feature freeze for 0.20, so I'll probably spend some more time getting that working. 'Offset' was just the first thing that came to mind, separation/spacing is probably better terminology - maybe pitch?adrianinsaval wrote:once you're happy with your implementation for linear pattern it would be nice to copy that for polar pattern too, considering that maybe there's a better word than offset that's applicable to angles too, separation? spacing?
The way I've implemented this actually makes pretty minimal changes to the existing code (for now ) so all the old properties are still used; I opened up a test part made with my fork in 0.19 and the part itself is the same. That being said I haven't yet implemented synchronisation between the length and offset values, so the UI in 0.19 doesn't match the actual dimensions of the part. But yes, proper backwards-compatibility should definitely be the goal here.adrianinsaval wrote:consider using the same properties as before in the background or auto updating them to match so the pattern still works correctly if you open in an older version of FreeCAD
- adrianinsaval
- Veteran
- Posts: 5551
- Joined: Thu Apr 05, 2018 5:15 pm
Re: [Feature Request] Relative offset in Linear Pattern
well I should have said if you recompute in an older version, when you just open it there won't be any difference because the shape isn't recomputed
Re: [Feature Request] Relative offset in Linear Pattern
Are you aware of the Lattice2 workbench? Here is a basic tutorial describing the LinearArray feature: https://github.com/DeepSOIC/Lattice2/wi ... inearArray
Regards / Viele Grüße
Max
Max
Re: [Feature Request] Relative offset in Linear Pattern
I've created PR for this request based on the work of @sugol (hope that that's okay with you!): https://github.com/FreeCAD/FreeCAD/pull/10377