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
Integrate Std_MeasureDistance into unified measurement facility #13810
base: main
Are you sure you want to change the base?
Conversation
If I'm not mistaken the old command added a document object in the tree which was saved with the document, what happens when opening old files that have these objects? should be looking into some sort of migration code? @wwmayer do you know how we can migrate old objects to a new object type? is it worth it in this case? |
A message will be printed that the object couldn't be restored.
A migration is not easily possible because there is no mechanism that the document could ask to create an alternative object if the MeasureDistance cannot be instantiated. |
Could we also keep the old object around and migrate it in the onDocumentRestored method similar to how it's documented here: https://wiki.freecad.org/Scripted_objects_migration ? |
No, this will cause serious problems: The class MeasureDistance is part of the core system and it would directly import an extension module that is considered bad practise. Lower level modules must not directly depend anyhow on higher level modules as this breaks the design. |
the question is now is it worth trying to support those objects? is anybody using them? |
I guess it's used rather rarely. But nevertheless with this trick the object can be restored. Add the following code snippets to Mod/Measure/MeasureDistance.h/cpp:
and
In order to read in the properties P1 and P2 MeasureDistance must override handleChangedPropertyName:
|
@hlorus are you adding the snippets above? |
Yeah sure, soonish |
Alrigth, i've added the snippets in a new commit and it seems to work well. For some reason the newly created measurements are not visible tho. |
I have observed this too but couldn't spot the code block where the view provider fails to show the label. However, if you set the Element links, save the project and reload it the label is shown. But anyway, it at least shows the distance in the tree view and this is still better than nothing. |
76fba0e
to
72d7844
Compare
* Toponaming: bring in missing code fragments in Sketcher * Toponaming: Fix infinite recursion, remove debug cruft, rough in fillet test * Bring in missing code; fix chamfers * Toponaming: Add code for fillets and test
…reeCAD into replace_measuredistance
I found the reason why it wasn't displaying and added a commit. |
@hlorus maybe off-topic but in the context menu in the 3D view there is still the entries from the old tools. These entries could be removed entirely I don't think a command for the new tool should go there: |
Currently the Std_MeasureDistance is still present as it's functionality wasn't completly covered by UMF's MeasureDistance. This was because the UMF version would only measure between actual geometry elements rather than the locations where the user is clicking.
This PR adds a new measure type "MeasureDistanceDetached" to UMF which allows to measure a distance between two locations on the surface of objects.
Also the old command "Std_MeasureDistance" along with the feature "App/MeasureDistance.h" and it's viewprovider "Gui/MeasureDistance.h" get removed here.
Closes #13712