PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by realthunder »

DeepSOIC wrote: Sat Nov 23, 2019 1:19 am except oftentimes that is exactly what I want to do.
And you can have it with 'LinkTransform' property. When set to True, it follows the linked object's placement, and use its own placement as an additional offset.

And I don't quite understand that "deeply into the history" part. Say, box, cylinder, fusion, sphere, cut. Assume, all primitives are claimed (say, they are in a Part). So, I expand cut, it shows fusion(link) and sphere(link). I expand fusion(link), and move box. Then, fusion should get updated as well. As fusion may be again re-used, this means I may have inadvertently screwed something up. So I don't quite see the benefit of automatic screening away the motion of operands, it gets too unintuitive too quickly, doesn't it? I'd rather create the links manually if I deem they are needed.
The fact that the user choose to reuse a feature means that he is expecting it to be the same shape everywhere it is used, with changes synchronized (but not placement in many cases), which is guaranteed by Link. If the user actually wants to specialize some instance, then he cannot reuse the feature or Link. I don't see any new problem here. There are other types of object for specialization purpose, a dumb copy for one. Or, with my SubShapeBinder, it even has a property Mode to let user choose whether to auto sync the change of the linked object. Or maybe replace the mutating object with another fusion containing the original object, or a PartDesign body with the original feature as base.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by DeepSOIC »

realthunder wrote: Sat Nov 23, 2019 12:32 am I think you don't understand here. This thing is mostly used to override nested child color or visibility, not the immediate child, although it can do, too. This is an important feature for assembly that the STEP standard specifically mentioned.
Yes I don't :lol:
Can you explain in plain logic, what determines the visibility of an object?
Let's say:

Code: Select all

Part
    Part001
        object
Old behavior: on screen = Part.Visibility and Part001.Visibility and object.Visibility
(+gets additional complications when Body-like containers are involved, the inconsistency of properties controlling that sucks, but that's another topic)
new behavior: ??

Code: Select all

Part
    Part001
        object
Part002
    Link to Part001
Visibility of original (unmoved) object: <same as above>
Visibility of linked (likely, moved) object:
Old behavior: Part002.Visibility and Link.visibility and object.visibility (not quite sure, actually, may be wrong)
New behavior: ??
chrisb
Veteran
Posts: 53933
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by chrisb »

DeepSOIC wrote: Sat Nov 23, 2019 12:34 pm Old behavior: Part002.Visibility and Link.visibility and object.visibility (not quite sure, actually, may be wrong)
You are right with the guess that you are wrong: The visibility depends only on Part002 and Link, not on the link's source. This is identical to the behaviour of a clone.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by realthunder »

DeepSOIC wrote: Sat Nov 23, 2019 12:34 pm Yes I don't :lol:
Can you explain in plain logic, what determines the visibility of an object?
Let's say:

Code: Select all

Part
    Part001
        object
Old behavior: on screen = Part.Visibility and Part001.Visibility and object.Visibility
(+gets additional complications when Body-like containers are involved, the inconsistency of properties controlling that sucks, but that's another topic)
new behavior: ??

Code: Select all

Part
    Part001
        object
Part002
    Link to Part001
Visibility of original (unmoved) object: <same as above>
Visibility of linked (likely, moved) object:
Old behavior: Part002.Visibility and Link.visibility and object.visibility (not quite sure, actually, may be wrong)
New behavior: ??
This is a good example actually. Part can now override the visibility or color of object inside Part001. It can hide 'object', but only with the instance in the context of Part,Part001.object. Part002.Link.object is not affected.
vis-override.gif
vis-override.gif (925.33 KiB) Viewed 4916 times

If you make a Link to Part, then the Link will show exactly the same as Part. If you add both Part002 and Part to another Part003, then one will show object, and the other won't.

Link (and LinkGroup) always has this visibility/color override thing implemented. Because it is basically the same as the selection disambiguation problem. With the exact same 'object' coin node, we need to show selection highlight (essential a different color) in one group but not in the other.

hmm... the bulk of this PR is supposed to offer a solution to all this visibility toggling complexity. But it can't show object hidden with this override feature. I'll fix that soon.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by easyw-fc »

realthunder wrote: Fri Nov 22, 2019 12:14 pm PR link: https://github.com/FreeCAD/FreeCAD/pull/2723
First, STEP import now uses App::Part by default.
A new option 'Use legacy importer' allows to switch back to old STEP importer before the merge.
@realthunder, I'm testing your PR and I have some glitches:
1) Could you please try to export this demo file to STEP? Selecting the main Part container I get a crash with the following log
(no issues on FC daily)
demo.FCStd
(150.91 KiB) Downloaded 116 times

Code: Select all

connect failed: No such file or directory
<Import> ImportOCAF2.cpp(1390): Local_CS_387 set default color
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f365a1cef20]
#1  0x7f3627ef8e50 in Transfer_TransientListBinder::NbTransients() const from /usr/lib/x86_64-linux-gnu/libTKXSBase.so.11+0
#2  /usr/lib/x86_64-linux-gnu/libTKXDESTEP.so.11(+0x2f4a0) [0x7f361bc274a0]
#3  /usr/lib/x86_64-linux-gnu/libTKXDESTEP.so.11(+0x2fe86) [0x7f361bc27e86]
#4  0x7f361bc28e3d in STEPCAFControl_Writer::WriteColors(Handle_XSControl_WorkSession const&, TDF_LabelSequence const&) from /usr/lib/x86_64-linux-gnu/libTKXDESTEP.so.11+0x88d
#5  0x7f361bc290be in STEPCAFControl_Writer::WriteColors(Handle_XSControl_WorkSession const&, TDF_LabelSequence const&) from /usr/lib/x86_64-linux-gnu/libTKXDESTEP.so.11+0xb0e
#6  0x7f361bc33d3f in STEPCAFControl_Writer::Transfer(STEPControl_Writer&, TDF_LabelSequence const&, STEPControl_StepModelType, char const*, bool) from /usr/lib/x86_64-linux-gnu/libTKXDESTEP.so.11+0x84f
#7  0x7f361bc3419b in STEPCAFControl_Writer::Transfer(Handle_TDocStd_Document const&, STEPControl_StepModelType, char const*) from /usr/lib/x86_64-linux-gnu/libTKXDESTEP.so.11+0x7b
#8  0x7f3608a11e5d in ImportGui::Module::exporter(Py::Tuple const&, Py::Dict const&) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/Mod/Import/ImportGui.so+0xa49
#9  0x7f3608a21445 in Py::ExtensionModule<ImportGui::Module>::invoke_method_keyword(void*, Py::Tuple const&, Py::Dict const&) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/Mod/Import/ImportGui.so+0x9d
#10  /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADBase.so(method_keyword_call_handler+0x15c) [0x7f365ca13e89]
#11  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyCFunction_FastCallDict+0x20a) [0x7f365c4307ca]
#12  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17c44c) [0x7f365c39944c]
#13  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(_PyEval_EvalFrameDefault+0x4ec3) [0x7f365c39f563]
#14  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(+0x17bc6f) [0x7f365c398c6f]
#15  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyEval_EvalCodeEx+0x3e) [0x7f365c39972e]
#16  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyEval_EvalCode+0x1b) [0x7f365c39a4ab]
#17  /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0(PyRun_StringFlags+0x8b) [0x7f365c36bb0b]
#18  0x7f365ca4f068 in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADBase.so+0xf0
#19  0x7f365ee73fcd in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0xd9
#20  0x7f365ecfd605 in Gui::Application::exportTo(char const*, char const*, char const*) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0x48d
#21  0x7f365ee8bdc1 in StdCmdExport::activated(int) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0x5ad
#22  0x7f365ee72a52 in Gui::Command::invoke(int, Gui::Command::TriggerSource) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0x358
#23  0x7f365ee63cf8 in Gui::Action::onActivated() from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0x26
#24  /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so(+0x10112ab) [0x7f365ee692ab]
#25  0x7f365addb645 in QMetaObject::activate(QObject*, int, int, void**) from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x865
#26  0x7f365bb24122 in QAction::triggered(bool) from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x42
#27  0x7f365bb2680c in QAction::activate(QAction::ActionEvent) from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0xcc
#28  0x7f365bb270d5 in QAction::event(QEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x35
#29  0x7f365bb2a83c in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x9c
#30  0x7f365bb32104 in QApplication::notify(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x2a4
#31  0x7f365ee3524e in Gui::GUIApplication::notify(QObject*, QEvent*) from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0x10e
#32  0x7f365adac9c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x118
#33  0x7f365b39c417 in QShortcutMap::dispatchEvent(QKeyEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x117
#34  0x7f365b39c4ea in QShortcutMap::tryShortcut(QKeyEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x5a
#35  0x7f365b34ac63 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x173
#36  0x7f365b36aff7 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x87
#37  0x7f365b370035 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x115
#38  0x7f365b3472eb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0xab
#39  /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5(+0x9f260) [0x7f364b655260]
#40  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x2e7) [0x7f36556f5417]
#41  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4c650) [0x7f36556f5650]
#42  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x2c) [0x7f36556f56dc]
#43  0x7f365ae0597f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x5f
#44  0x7f365adaa9fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x13a
#45  0x7f365adb3aa4 in QCoreApplication::exec() from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x94
#46  0x7f365ed0605a in Gui::Application::runApplication() from /home/mau/Downloads/FreeCAD-rt-GroupMod/freecad-build/lib/libFreeCADGui.so+0x2530
#47  /home/mau/Downloads/FC-rt(main+0xb36) [0x564907bca9fd]
#48  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f365a1b1b97]
#49  /home/mau/Downloads/FC-rt(_start+0x2a) [0x564907bc9cca]
2) If I try to export the attached STEP file (previously generated by FC daily) again to STEP, selecting the main Part container, I get the following error log
(no issues on FC daily)
d.step
(674.1 KiB) Downloaded 117 times

Code: Select all

connect failed: No such file or directory
<Import> ImportOCAF2.cpp(632): free shape count 17
<Import> ImportOCAF2.cpp(401): Local_CS_387 has empty shape
<Import> AppImportGuiPy.cpp(530): file read time: 1.56648s
<Import> AppImportGuiPy.cpp(531): import time: 0.651202s
<Import> AppImportGuiPy.cpp(532): total time: 2.21768s
Traceback (most recent call last):
  File "<string>", line 4, in <module>
<class 'Base.FreeCADError'>: TCollection_Array1::Create
3) When I load the attached STEP file from a manufacturer, I don't have issues w FC daily, but I get a big sphere under the main switch using your branch
(no issues on FC daily)
WE_434331013822.step
-
stp-settings.png
stp-settings.png (94.74 KiB) Viewed 4750 times
step-comparison.png
step-comparison.png (154.56 KiB) Viewed 4742 times
-
I'm attaching my full FC info (FC built from your branch https://github.com/realthunder/FreeCAD/tree/GroupMod)

Code: Select all

OS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18920 (Git)
Build type: Unknown
Branch: GroupMod
Hash: 2d1b79892db5df4848e6bc611c9f37ddd92a046b
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 6.9.1.oce-0.18
Locale: English/UnitedStates (en_US)
Please feel free to ask if you need more details.
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by easyw-fc »

realthunder wrote: ping
@realthunder
It seems that all the oddity were related to my old building chain...
with the right components (OCC7.3) I cannot replicate any issue...
Sorry for the noise
Here the details for a FC build working correctly:

Code: Select all

OS: Linux Mint 19.3 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18920 (Git)
Build type: Unknown
Branch: GroupMod
Hash: 2d1b79892db5df4848e6bc611c9f37ddd92a046b
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by realthunder »

easyw-fc wrote: Sat Dec 28, 2019 12:18 am It seems that all the oddity were related to my old building chain...
with the right components (OCC7.3) I cannot replicate any issue...
Sorry for the noise
No problem. The GroupMod branch is frozen right now. I have splitted it into three patch set. The first two has already been submitted as PR here and here, the second one being more relevant to group behavior changes and STEP import/export. The third one is mostly visualization/selection enhancement, and will have to wait till the second PR gets merged. If you like, you can either test against the second PR, or my GroupModTest branch, which will be the future third PR.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by easyw-fc »

realthunder wrote: Sat Dec 28, 2019 12:40 am If you like, you can either test against the second PR, or my GroupModTest branch, which will be the future third PR.
Hi @realthunder,
I've made some test on your GroupModTest branch and I think STEP import & export are doing very well :D
I have tested some STEP comparing the results both with CADAssistant and DSM and everything seems much aligned.

1) I found a little issue trying to load a STEP model exported directly from KiCAD... I just found that the Line color of the imported STEP model were not aligned to what I can see in the other sw... (the pin-headers have the borders colored in white instead of black as in other sw).
Here the STEP file and the screenshoots...
links-multi-1-k.step
(632.56 KiB) Downloaded 106 times
FC GroupModeTest:
-
STEP-GMT-import.png
STEP-GMT-import.png (66.2 KiB) Viewed 4646 times
-
CADAssistant:
-
STEP-CADA-import.png
STEP-CADA-import.png (32.65 KiB) Viewed 4646 times
-
2) an other small issue is that it seems the option to hide/show the progress bar when loading a step file is not take in account (that is the same behavior in the actual FC 0.19 main branch).

Here my settings:
-
STEP-settings.png
STEP-settings.png (82.87 KiB) Viewed 4646 times
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by realthunder »

easyw-fc wrote: Sun Dec 29, 2019 10:07 pm 1) I found a little issue trying to load a STEP model exported directly from KiCAD... I just found that the Line color of the imported STEP model were not aligned to what I can see in the other sw... (the pin-headers have the borders colored in white instead of black as in other sw).
Problem fixed. I just amended PR number two, and rebased GroupModTest for the fix as well.

2) an other small issue is that it seems the option to hide/show the progress bar when loading a step file is not take in account (that is the same behavior in the actual FC 0.19 main branch).
I can't reproduce this one. There are two stages of STEP importing. And the option only controls whether or not to show the progress bar in the second stage. In the first stage, all processing is done inside OCCT, and none in FC, so the progress bar does not really affect performance. The second stage happens in FC mostly, and will trigger GUI update a lot, so may affect performance, hence the option.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
easyw-fc
Veteran
Posts: 3630
Joined: Thu Jul 09, 2015 9:34 am

Re: PR #2723: Plain/Geo group behavior change and related 3D visualization/selection enhancement

Post by easyw-fc »

realthunder wrote: Mon Dec 30, 2019 9:18 am 1) Problem fixed. I just amended PR number two, and rebased GroupModTest for the fix as well.
Tested and confirmed as fixed.

realthunder wrote: Mon Dec 30, 2019 9:18 am 2) I can't reproduce this one. There are two stages of STEP importing. And the option only controls whether or not to show the progress bar in the second stage. In the first stage, all processing is done inside OCCT, and none in FC, so the progress bar does not really affect performance. The second stage happens in FC mostly, and will trigger GUI update a lot, so may affect performance, hence the option.
Thanks for clarification. Confirmed as fixed then.

May I ask you if you could have a look at this ticket:
https://forum.freecadweb.org/viewtopic. ... 10#p327445
to add import and export LCS within STP files?

original STEP file with 3 LCS (from NX)
model2.stp
(369.86 KiB) Downloaded 117 times
desired FC file when imported as STEP
exportwithnamedplanes-fc.FCStd
(13.71 KiB) Downloaded 110 times
That would add an other great feature to FC STEP import/export compatibility.
Post Reply