View Issue Details

IDProjectCategoryView StatusLast Update
0003864ArchBugpublic2019-07-30 22:47
Reporterdanreb Assigned Toyorik  
PriorityurgentSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.18 
Summary0003864: Arch/BIM wall and roof subtraction : _Roof object as no attribute sub
DescriptionContext
--------
trying to subtract a roof from a wall in the BIM workbench sample project is attached and the following command can be executed to generate the error (watch the report view output)

# command to issue in the python consol to be able to reproduce the problem
FreeCAD.getDocument("AbrisCompostBois").getObject("Wall").Subtractions = [App.getDocument('AbrisCompostBois').getObject('Roof')]
Steps To ReproduceProblem
--------
in the tree view the wall is displayed whith an error picto and a tooltip message
" Wall : _Roof object as no attribute sub"

and the above command generates this output

    Traceback (most recent call last):
    File "/Users/bblockmans/miniconda/envs/freecad_py36/Mod/Arch/ArchWall.py", line 678, in execute
    base = self.processSubShapes(obj,base,pl)
    File "/Users/bblockmans/miniconda/envs/freecad_py36/Mod/Arch/ArchComponent.py", line 580, in processSubShapes
    f = o.Proxy.getSubVolume(o)
    File "/Users/bblockmans/miniconda/envs/freecad_py36/Mod/Arch/ArchRoof.py", line 677, in getSubVolume
    if self.sub:
    <class 'AttributeError'>: '_Roof' object has no attribute 'sub'
Additional Informationlinked to the forum topic https://forum.freecadweb.org/viewtopic.php?f=3&t=33702&p=282951#p282951

My temporary correction
------------------------

changed the code in Arch.roof (line 677)


    def getSubVolume(self,obj):

        "returns a volume to be subtracted"
        if obj.Base:
            if obj.Base.isDerivedFrom("Part::Feature"):
                if obj.Base.Shape.Solids:
                    return obj.Shape
                else :
                    if self.sub:
                        return self.sub
                    else :
                        self.execute(obj)
                        return self.sub
        return None

whith the following ( actually changing the "if self.sub:["whith the "if hasattr (self, "sub"):" hasattr method )


        "returns a volume to be subtracted"
        if obj.Base:
            if obj.Base.isDerivedFrom("Part::Feature"):
                if obj.Base.Shape.Solids:
                    return obj.Shape
                else :
                    if hasattr (self, "sub"):
                        return self.sub
                    else :
                        print (" Alert : object " + obj.Name + " has no attribute 'sub' " )
                        self.execute(obj)
                        return self.sub
        return None

But then the next error is trown when actually recomputing the active document

    App::Document::_RecomputeFeature(): Unknown exception in Feature "Wall" thrown

N.B.: while the error is generated the Walls appears as having being subtracted the volume of the roof. i.e. the errors now comes while recomputing the wall object.
TagsArch, BIM
FreeCAD Information

Activities

danreb

2019-02-26 04:39

reporter  

AbrisCompostBois.FCStd (70,792 bytes)

Kunda1

2019-03-08 19:54

administrator   ~0012868

bumping to 0.19

Kunda1

2019-04-06 19:44

administrator   ~0013014

@yorik can the changes proposed by OP be made in to a PR ?

yorik

2019-05-08 01:42

administrator   ~0013083

Sorry, forgot to look at this one... Your proposed changes seem fully correct @danreb however there seem to still be a problem happening, right? I'll have a look at your file ASAP

yorik

2019-05-08 01:48

administrator   ~0013084

Ok I was able to fix it fully! https://github.com/FreeCAD/FreeCAD/commit/b03aa051a4aa8ccdb9e16d0f52a297e4cb93a53d

Related Changesets

FreeCAD: master b03aa051

2019-05-07 22:47:15

Yorik van Havre

Details Diff
Arch: Fixed error in roof - Fixes 0003864 Affected Issues
0003864
mod - src/Mod/Arch/ArchRoof.py Diff File

FreeCAD: releases/FreeCAD-0-18 1fb7ed43

2019-05-08 01:47:15

Yorik van Havre

Details Diff
Arch: Fixed error in roof - Fixes 0003864 Affected Issues
0003864
mod - src/Mod/Arch/ArchRoof.py Diff File

Issue History

Date Modified Username Field Change
2019-02-26 04:39 danreb New Issue
2019-02-26 04:39 danreb Tag Attached: 0.18
2019-02-26 04:39 danreb Tag Attached: Arch
2019-02-26 04:39 danreb Tag Attached: BIM
2019-02-26 04:39 danreb File Added: AbrisCompostBois.FCStd
2019-02-26 10:40 Kunda1 Status new => confirmed
2019-02-26 10:43 Kunda1 Steps to Reproduce Updated
2019-02-26 10:44 Kunda1 Steps to Reproduce Updated
2019-02-27 18:07 wmayer Project FreeCAD => Arch
2019-03-08 19:54 Kunda1 Target Version => 0.19
2019-03-08 19:54 Kunda1 Note Added: 0012868
2019-03-08 19:55 Kunda1 Tag Detached: 0.18
2019-04-06 19:44 Kunda1 Note Added: 0013014
2019-05-08 01:42 yorik Note Added: 0013083
2019-05-08 01:48 yorik Note Added: 0013084
2019-05-08 01:48 yorik Assigned To => yorik
2019-05-08 01:48 yorik Status confirmed => closed
2019-05-08 01:48 yorik Resolution open => fixed
2019-05-08 01:48 yorik Fixed in Version => 0.19
2019-07-30 22:47 Kunda1 Changeset attached => FreeCAD releases/FreeCAD-0-18 1fb7ed43
2019-07-30 22:47 Kunda1 Changeset attached => FreeCAD master b03aa051