Hi!
This hack is actually quite old, it's just that today I felt a desire to discuss it.
In Lattice, I have a tool to extract subelements (like Draft FaceBinder and PartDesign ShapeBinder). Some of you may know that. It's called "SubLink"
But what you probably don't know is that I included a small hack to make links to subelements slightly more robust. This is done by counting elements from the end instead of from start, for elements that have indexes closer to the end. Simply speaking, if you select the face with the highest number (say, face 3215 of 3215), that link will remain pointing to the "last" face, when number of faces in shape changes.
Showcase where the tool works almost perfectly:
1. PartDesign Gear
2. PartDesign Pad
3. Extract subelements with Lattice SubLink: top face, for example.
4. change the number of teeth.
Regular links fail miserably. But the hacked link remains reasonable.
The thing is, this hack feels easy to apply to whole FreeCAD. All that needs to be done, I think, is make TopoShape's getSubElement (or however it's called) support reverse counting (negative indexes), and make selection automatically put in the negative index if appropriate. The first is trivial, but the second requires Selection to know, how many elements of the type are available, which may be a tricky problem.
Hack of the day: make links more robust for almost free
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Hack of the day: make links more robust for almost free
Last edited by DeepSOIC on Wed Jun 22, 2016 9:25 pm, edited 1 time in total.
Reason: fixed title
Reason: fixed title
Re: Hack of the day: make links more robust for almost free
Hi,
This looks very interesting. More robust links on the cheap gotta be better than what we have right now. But I'm just an end user so I can't know what it would imply internally...
This looks very interesting. More robust links on the cheap gotta be better than what we have right now. But I'm just an end user so I can't know what it would imply internally...
Re: Hack of the day: make links more robust for almost free
As a general rule i don't feel we can build robust models based on underlying geometry with changing topology. Therefore i would rather introduce some stable geometry first (Fuse) in such case and build on that:
Re: Hack of the day: make links more robust for almost free
Nice idea:D @DeepSOIC
The less probability of renaming an already existing face the better I guess.
The less probability of renaming an already existing face the better I guess.
Need help? Feel free to ask, but please read the guidelines first
Re: Hack of the day: make links more robust for almost free
FWIW, I agree with Triplus. That's a clever workaround, but I'd be a bit leery of implementing too many of those instead of fixing the underlying topology problem. -Ian-