Solved: Arch Rebar: some properties should be added only if the graphical interface is enabled

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Solved: Arch Rebar: some properties should be added only if the graphical interface is enabled

Post by vocx »

I've been testing some things in Draft and Arch, and I realized that the Arch Rebar command produces some errors when running the TestArch tests, but only with the terminal version. The reason is that the code tries to access the view provider of the object without checking if it exists.

Code: Select all

freecadcmd -t TestArch

Code: Select all

testAdd (TestArch.ArchTest) ... ok
testAxis (TestArch.ArchTest) ... ok
testBuilding (TestArch.ArchTest) ... ok
testFloor (TestArch.ArchTest) ... ok
testFrame (TestArch.ArchTest) ... ok
testRebar (TestArch.ArchTest) ... Traceback (most recent call last):
  File "/usr/share/freecad-daily/Mod/Arch/ArchRebar.py", line 391, in execute
    if obj.ViewObject.RebarShape == "Stirrup":
<class 'AttributeError'>: 'NoneType' object has no attribute 'RebarShape'
1.05e-07 <App> Document.cpp(3462): Failed to recompute ArchTest#Rebar: 'NoneType' object has no attribute 'RebarShape'
Recompute failed! Please check report view.
ok
testRemove (TestArch.ArchTest) ... ok
testRoof (TestArch.ArchTest) ... ok
testSection (TestArch.ArchTest) ... ok
testSite (TestArch.ArchTest) ... ok
testSpace (TestArch.ArchTest) ... ok
testStairs (TestArch.ArchTest) ... ok
testStructure (TestArch.ArchTest) ... ok
testWall (TestArch.ArchTest) ... ok
testWindow (TestArch.ArchTest) ... ok

----------------------------------------------------------------------
Ran 15 tests in 0.613s

OK
FreeCAD 0.19, Libs: 0.19R18733 (Git)

My fix is in pull request #2718.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply