[Ticket #4616] "Replace" -command

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: [Ticket #4616] "Replace" -command

Post by Pauvres_honteux »

DeepSOIC wrote: Sat Apr 21, 2018 2:03 pm Part-o-magic tool is open for testing.
https://forum.freecadweb.org/viewtopic. ... 20#p229081
And testing I did,
Replace_test_4.png
Replace_test_4.png (14.1 KiB) Viewed 981 times
with this result:

Code: Select all

Traceback (most recent call last):
  File "/home/abc/.FreeCAD/Mod/Part-o-magic/PartOMagic/Gui/AACommand.py", line 129, in Activated
    self.RunOrTest(b_run= True)
  File "/home/abc/.FreeCAD/Mod/Part-o-magic/PartOMagic/Gui/LinkTools/ReplaceObject.py", line 51, in RunOrTest
    msgBox("No regular replacable dependencies found, nothing uses {old}. Please pick wanted replacements manually in the dialog.".format(old= old.Label))
NameError: global name 'msgBox' is not defined
Done with:
replace_body_2.fcstd
(21.75 KiB) Downloaded 30 times
...and:
OS: "openSUSE Leap 42.2"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13516 (Git) AppImage
Build type: None
Branch: master
Hash: 7101d9a89d49ed718d42611a81f1097b723e5ad2
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.2.0
Last edited by Pauvres_honteux on Sun Jan 02, 2022 11:05 am, edited 1 time in total.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: [Feature request] "Replace" -command

Post by DeepSOIC »

Pauvres_honteux wrote: Sun Apr 22, 2018 12:52 pm And testing I did,
Thanks for testing. I fixed stupid mistake in code just now.

The replacement still fails. It works if you drag Body002 out of Part before replacement. I'll have to mess with it a bit more to make this work without having to manually drag Body002 out of Part. As I said, your example is very special because of how PD Boolean works.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: [Feature request] "Replace" -command

Post by DeepSOIC »

Done, should work on your case now. Sorry about me not bothering to test your example before inviting you to test :oops:
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: [Ticket #4616] "Replace" -command

Post by Pauvres_honteux »

Waow, that was fast!!! Still looking for all the pieces of my shattered jaw when it dropped! ;)

Ok, tried it (choose new[Body002] first, old [Body001] second) and got this:
.
Replace_test_5.png
Replace_test_5.png (51.3 KiB) Viewed 972 times
.
(choose old[Body001] first, new[Body002] second) and got this:
Replace_test_7.png
Replace_test_7.png (38.08 KiB) Viewed 972 times
.
but the resulting body is the same...
.
Replace_test_8.png
Replace_test_8.png (35.27 KiB) Viewed 972 times
.
and oddly enough I got this as well:
Replace_test_6.png
Replace_test_6.png (13.65 KiB) Viewed 972 times
Last edited by Pauvres_honteux on Sun Jan 02, 2022 11:06 am, edited 1 time in total.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: [Feature request] "Replace" -command

Post by DeepSOIC »

Recompute?
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: [Ticket #4616] "Replace" -command

Post by Pauvres_honteux »

Yesss! :D
Last edited by Pauvres_honteux on Sun Jan 02, 2022 11:06 am, edited 1 time in total.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Feature request] "Replace" -command

Post by NormandC »

I repeat my question since you obviously ignored it: why are you looking for an external replace command when you can quite simply edit the Boolean operation feature and replace the Body there???

:roll: :roll: :roll:
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: [Feature request] "Replace" -command

Post by DeepSOIC »

NormandC wrote: Sun Apr 22, 2018 5:46 pm I repeat my question since you obviously ignored it: why are you looking for an external replace command when you can quite simply edit the Boolean operation feature and replace the Body there???
I think he already explained it well in the first post. When one is replacing an object in a massive project, or in a big number of small projects, replace tool is wanted to not waste time searching for all uses and changing them manually. Example with bodies is just a trivial example.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: [Ticket #4616] "Replace" -command

Post by Pauvres_honteux »

From realthunders github page:
.
Replace command for points, lines, curves, planes, surfaces and bodies
Creation mode: set "Tip" on/for the feature/entity to be replaced. Right-click to select "Replace with..." Click on the new feature/entity. In the background (especially for bodies) check if the numbers of vertexes + edges + surface are the same and in the, roughly, same position. If any of the checks fails a popup window will show two sand-boxed 3D-viewports, one with the current feature/entity to be replaced and one with the new feature/entity.
In the left view-port one shall be presented with the vertexes, edges and surfaces that the replace-check couldn't find an good enough replacement for. They shall be numbered and colored in such a way they are easily seen and of such a size they are easy to click on.
The clicked feature/entity will then be replaced by whatever the user clicks on in the right 3D-viewport.
Both view-ports shall be linked in such a way that zooming, panning and rotating is 1:1.
Nothing will be sent to the tree before the user is happy with the result, which is shown in the right view-port, a sort of preview so to say. When the user is happy he/she clicks on the accept-button.
The whole model shall not, by default, be updated, to avoid unnecessary crashes.

and

Re-linking of features/entity's
Creation mode: an update of the model comes to a halt somewhere in the model, then the "Re-linking" window pops up doing the same thing as the above mentioned "sand-boxed dual 3D-viewport".
Last edited by Pauvres_honteux on Sun Jan 02, 2022 11:07 am, edited 1 time in total.
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: [Ticket #4616] "Replace" -command

Post by Pauvres_honteux »

Anyone with an interest in fixing these missing features?
Last edited by Pauvres_honteux on Sun Jan 02, 2022 11:07 am, edited 1 time in total.
Post Reply