View Issue Details

IDProjectCategoryView StatusLast Update
0003381PartBugpublic2018-05-28 14:58
Reporterker Assigned To 
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionfixed 
PlatformVirtual machineOSUbuntu 14.04.5 LTSOS Version14.04.5 LTS
Product Version0.17 
Fixed in Version0.18 
Summary0003381: CompoundFilter do not work in command line
DescriptionCompoundFilter does not work in Python script in non-GUI-mode.

The attached macro works OK running in the GUI, but when run with:
FreeCADCmd CompoundFilter_bug_example.FCMacro
in command line, it gives error:
Exception while processing file: CompoundFilter_bug_example.FCMacro ['NoneType' object has no attribute 'Proxy']

The problem is in the file Mod/Part/CompoundTools/CompoundFilter.py, in line 47.
After replacing that line with
------
if obj.ViewObject:
_ViewProviderCompoundFilter(obj.ViewObject)
------
the code works OK in command line, too. Maybe the correction is bad, bus still works.

My installation:
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13407 (Git)
Build type: Release
Branch: master
Hash: 2c2d781aa686b731f2a0e754dc30ebb76f3553e0
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)

Described in Developers corner (after my post is accepted by an admin).
Steps To ReproduceRun the attached macro in command line.
TagsApp::Part
FreeCAD Information

Activities

ker

2018-03-20 16:13

reporter  

CompoundFilter_bug_example.FCMacro (1,169 bytes)   
# Open new document
doc = App.newDocument("Beams")
#
# Generate geometry in Part module
import Part
beam_obj1 = doc.addObject('Part::Box', 'Beam1')
beam_obj1.Height = beam_obj1.Width = 10
beam_obj1.Length = 40

beam_obj2 = doc.addObject('Part::Box', 'Beam2')
beam_obj2.Height = beam_obj2.Width = 10
beam_obj2.Length = 30
beam_obj2.Placement.Base = FreeCAD.Vector(40,0,0)


# Combine the geometric objects to Compsolid
import BOPTools.SplitFeatures
beam_comp_obj = BOPTools.SplitFeatures.makeBooleanFragments(name= 'Beam_Compsolid')
beam_comp_obj.Objects = [beam_obj1,beam_obj2]
beam_comp_obj.Mode = "CompSolid"
beam_comp_obj.Proxy.execute(beam_comp_obj)
beam_comp_obj.purgeTouched()

#Generate a CompoundFilter from the Compsolid
import CompoundTools.CompoundFilter
beam_obj = CompoundTools.CompoundFilter.makeCompoundFilter(name = 'Beam')
beam_obj.Base = beam_comp_obj
beam_obj.FilterType = 'window-volume' #???
beam_obj.Proxy.execute(beam_obj) #???

App.ActiveDocument.recompute()

# If GUI available, see how our part looks like
if FreeCAD.GuiUp:
	import FreeCADGui
	FreeCADGui.ActiveDocument.activeView().viewAxonometric()
	FreeCADGui.SendMsgToActiveView("ViewFit")

ker

2018-03-21 16:19

reporter   ~0011050

https://forum.freecadweb.org/viewtopic.php?f=10&t=27593

wmayer

2018-05-28 14:58

administrator   ~0011290

https://github.com/FreeCAD/FreeCAD/commit/6781a8167fbe7a2fc508f60f85e34fddfc155927

Issue History

Date Modified Username Field Change
2018-03-20 16:13 ker New Issue
2018-03-20 16:13 ker File Added: CompoundFilter_bug_example.FCMacro
2018-03-20 16:13 ker Tag Attached: App::Part
2018-03-21 16:19 ker Note Added: 0011050
2018-05-28 14:58 wmayer Status new => closed
2018-05-28 14:58 wmayer Resolution open => fixed
2018-05-28 14:58 wmayer Fixed in Version => 0.18
2018-05-28 14:58 wmayer Note Added: 0011290