I did my best (I'm a programming novice) to understand the code and to improve the IFC export for slabs.
ATM for every slab all contour edges are exported as IFCSTRUCTURALCURVEMEMBER except the last closing one (see forum thread https://forum.freecadweb.org/viewtopic.php?f=39&t=54286).
This changes aim to also add the last closing edge for slabs.
In a few locations, python objects are used without checking if they
exist and are non-null, which throws missing attribute exceptions. The
fix is to simply check first.
the PR fixes the following things:
- change the way centerlines between 2 lines are calculated. The current implementation leads to many bugs and even crashes (e.g. when the 2 selected lines are parallel ones of a square). There are different forum threads from the last 1.5 years.
The new endpoint line sorting is the one described here: https://forum.freecadweb.org/viewtopic.php?f=35&start=20&t=44255&sid=989a668890f954c13ef81e4a04ee6912#p501179
- as consequence the erroneous and misleading line end flipping can go and is removed (only used internally)
- when creating a new centerline, you see it immediately
- when creating a new or editing an existing centerline and press Cancel, the creation/editing is aborted
- fix crash when the 2 selected lines are bot horizontal and one tries to create a vertical centerline
- fix crash when changing the orientation of an existing centerline and the result would be invalid
- cleanup the code a bit
When drawing a section view, first a list of objects to draw is made.
Starting with the objects selected by the section plane, any groups or
group-like objects are recursively expanded. The resulting list contains
all contained objects, but also the expanded groups themselves (due to
Draft.get_group_contents with addgroups set).
This list of objects is then further categorized and processed. In this
categorization, there was already an exception for DocumentObjectGroup
instances, which were omitted from the resulting `nonspaces` list
(presumably since there is no point in drawing the groups themselves
when their contents are already in the list).
However, any groups that only contain flat objects would be caught by
`looksLikeDraf()` and added to the `drafts` list, before this exception
could ignore them.
This causes these groups to be processed by Draft.get_svg, which does so
by calling itself recursively on the group contents. Effectively, this
means that the contents of such groups is drawn on the section view
twice. Even more, since Draft.get_svg does not do a visibility check
like Arch.getSVG does, this causes invisible objects to show up when not
intended.
This commit fixes this by moving the DocumentObjectGroup exception a bit
further up, so all these objects should be dropped.
An alternative fix might be to pass addgroups=False to
Draft.get_group_contents (in getSectionData), but that also prevents
group-like objects (Building, BuildingPart, Space, Site) from being
returned, but those likely need to be returned so they can be sectioned
if needed (though if just spaces are needed, then
Draft.get_group_contents also have a spaces argument to return just
those).