With this patch the error message is changed to a bit more informative form:
Code: Select all
Part::Extrusion: Link(s) to object(s) 'Sketch' go out of the allowed scope 'Extrude'. Instead, the linked object(s) reside within 'Body'.
Code: Select all
Part::Extrusion: Link(s) to object(s) 'Sketch' go out of the allowed scope 'Extrude'. Instead, the linked object(s) reside within 'Body'.
did you consider the case were this list might become too long to be readable if displayed like this? IIRC there was a change for something of this sort not long ago.aapo wrote: ↑Tue Jan 18, 2022 6:37 pm It says 'link(s)' and 'object(s)' because the computation is based on the scope (Part-compatible shape object named 'Extrude' in the example), and it is possible that there are many out-of-scope objecs within 'Extrude', in which case they are all listed space-separated. The same goes for the list of the non-allowed scopes (in this case, 'Body').
I did, but I'm not sure if my conclusions are correct. My (perhaps naive) assumption is that the number of objects is limited by the number of invalid 'features' linked to the scope-object, e.g. Sketches linked to a Body, and if I understood the code correctly, the invalid feature-objects should each be listed just once (even if they are used multiple times, as result.erase(std::unique(...)) is used in getScopedObjectsFromLinks()). It seems to me, that the only way to flood-fill the report view is to get the error triggered by an object having hundred of auto-generated invalid-linked child objects, but I couldn't think of such situations. And I dread to think of a person who manually adds hundreds of invalid features into a single container.adrianinsaval wrote: ↑Tue Jan 18, 2022 10:13 pm did you consider the case were this list might become too long to be readable if displayed like this? IIRC there was a change for something of this sort not long ago.
Many thanks! As you said, it is a simple change. I find it very helpful.aapo wrote: ↑Tue Jan 18, 2022 6:37 pm I made pull request https://github.com/FreeCAD/FreeCAD/pull/5394 to add the extra information to the error message. Although it's a simple change, it's in the core, so I'm not too confident it'll be accepted straight away, but please test!
I second this. It's not a dialog that gets too big or similar. So if many mistakes are made then many messages are shown. I wouldn't limit the length. Someone may want to process it automatically?
I believe in practice there will be at most a few objects per error message, most likely just one, so the idea is to be on the safe side if there'll be something completely unexpected. The "tons of warnings" in the thread title refers to this warning being triggered for every affected container object (scope) displaying the warning after every recompute. So, if you'll have a lot of invalid objects, you'll get a lot of warnings - but this is unchanged, and exactly the same as the original implementation. Now you'll just get a little bit of helpful information per warning: What are the name(s) of the object(s) that are in the "wrong" places, and what are these "wrong places". But still tons of warnings!
I think the right place it's always the place where the object (Sketch) is grouped into, so into the Body... because this means that it it's located in the parent object LCS... while Extrude does not provide a "place". The same would happen with 2 Body objects, the sketch could be located just in one of the two, and this is its right context.
Indeed, and the idea of the enhanced error message is to offer the user more hints about what exactly went wrong, if the user tries to use the Sketch out of its right context, i.e. for an operation inside the wrong Body.