diff --git a/CompoundFilter2.py b/CompoundFilter2.py index fc96f2c..0d1dd13 100644 --- a/CompoundFilter2.py +++ b/CompoundFilter2.py @@ -47,7 +47,8 @@ def makeCompoundFilter(name): '''makeCompoundFilter(name): makes a CompoundFilter object.''' obj = App.ActiveDocument.addObject("Part::FeaturePython",name) _CompoundFilter(obj) - _ViewProviderCompoundFilter(obj.ViewObject) + if FreeCAD.GuiUp: + _ViewProviderCompoundFilter(obj.ViewObject) return obj class _CompoundFilter: diff --git a/FuseCompound2.py b/FuseCompound2.py index 5260ea8..27fd06d 100644 --- a/FuseCompound2.py +++ b/FuseCompound2.py @@ -35,7 +35,8 @@ def makeFuseCompound(name): obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) _FuseCompound(obj) obj.Refine = getParamRefine() - _ViewProviderFuseCompound(obj.ViewObject) + if FreeCAD.GuiUp: + _ViewProviderFuseCompound(obj.ViewObject) return obj class _FuseCompound: diff --git a/lattice2AttachablePlacement.py b/lattice2AttachablePlacement.py index a132adb..eca48fe 100644 --- a/lattice2AttachablePlacement.py +++ b/lattice2AttachablePlacement.py @@ -44,7 +44,8 @@ def makeAttachablePlacement(name): obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) obj.addExtension("Part::AttachExtensionPython", None) AttachablePlacement(obj) - ViewProviderAttachablePlacement(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderAttachablePlacement(obj.ViewObject) return obj class AttachablePlacement(lattice2BaseFeature.LatticeFeature): diff --git a/lattice2BaseFeature.py b/lattice2BaseFeature.py index 7e00ee5..f190630 100644 --- a/lattice2BaseFeature.py +++ b/lattice2BaseFeature.py @@ -53,10 +53,11 @@ def makeLatticeFeature(name, AppClass, ViewClass): '''makeLatticeFeature(name, AppClass, ViewClass = None): makes a document object for a LatticeFeature-derived object.''' obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) AppClass(obj) - if ViewClass: - vp = ViewClass(obj.ViewObject) - else: - vp = ViewProviderLatticeFeature(obj.ViewObject) + if FreeCAD.GuiUp: + if ViewClass: + vp = ViewClass(obj.ViewObject) + else: + vp = ViewProviderLatticeFeature(obj.ViewObject) return obj diff --git a/lattice2BoundBox.py b/lattice2BoundBox.py index da43546..eb74d5d 100644 --- a/lattice2BoundBox.py +++ b/lattice2BoundBox.py @@ -99,7 +99,8 @@ def makeBoundBox(name): '''makeBoundBox(name): makes a BoundBox object.''' obj = App.ActiveDocument.addObject("Part::FeaturePython",name) _BoundBox(obj) - _ViewProviderBoundBox(obj.ViewObject) + if FreeCAD.GuiUp: + _ViewProviderBoundBox(obj.ViewObject) return obj class _BoundBox: diff --git a/lattice2Downgrade.py b/lattice2Downgrade.py index 6f81000..bc2cbaf 100644 --- a/lattice2Downgrade.py +++ b/lattice2Downgrade.py @@ -51,7 +51,8 @@ def makeLatticeDowngrade(name): '''makeLatticeDowngrade(name): makes a latticeDowngrade object.''' obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) _latticeDowngrade(obj) - _ViewProviderLatticeDowngrade(obj.ViewObject) + if FreeCAD.GuiUp: + _ViewProviderLatticeDowngrade(obj.ViewObject) return obj diff --git a/lattice2Mirror.py b/lattice2Mirror.py index 7155e1a..c95f313 100644 --- a/lattice2Mirror.py +++ b/lattice2Mirror.py @@ -81,7 +81,8 @@ def makeLatticeMirror(name): '''makeLatticeMirror(name): makes a LatticeMirror object.''' obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) LatticeMirror(obj) - ViewProviderLatticeMirror(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderLatticeMirror(obj.ViewObject) return obj diff --git a/lattice2RecomputeLocker.py b/lattice2RecomputeLocker.py index ae54a91..726818e 100644 --- a/lattice2RecomputeLocker.py +++ b/lattice2RecomputeLocker.py @@ -89,7 +89,8 @@ def makeRecomputeLocker(name): '''makeRecomputeLocker(name): makes a RecomputeLocker document object.''' obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",name) LatticeRecomputeLocker(obj) - ViewProviderLatticeRecomputeLocker(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderLatticeRecomputeLocker(obj.ViewObject) return obj class LatticeRecomputeLocker: diff --git a/lattice2ShapeInfoFeature.py b/lattice2ShapeInfoFeature.py index 243a1aa..be80ad0 100644 --- a/lattice2ShapeInfoFeature.py +++ b/lattice2ShapeInfoFeature.py @@ -36,7 +36,8 @@ def makeShapeInfoFeature(name): '''makeShapeInfoFeature(name): makes a ShapeInfoFeature object.''' obj = App.ActiveDocument.addObject("App::FeaturePython",name) ShapeInfoFeature(obj) - ViewProviderShapeInfo(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderShapeInfo(obj.ViewObject) return obj diff --git a/lattice2ShapeString.py b/lattice2ShapeString.py index e73e58b..7e08fdb 100644 --- a/lattice2ShapeString.py +++ b/lattice2ShapeString.py @@ -74,7 +74,8 @@ def makeLatticeShapeString(name): '''makeBoundBox(name): makes a BoundBox object.''' obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) LatticeShapeString(obj) - ViewProviderLatticeShapeString(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderLatticeShapeString(obj.ViewObject) return obj class FoolFeatureDocumentObject: diff --git a/lattice2Slice.py b/lattice2Slice.py index 869bed5..3d5a594 100644 --- a/lattice2Slice.py +++ b/lattice2Slice.py @@ -34,7 +34,8 @@ def makeLatticeSlice(name): obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name) LatticeSlice(obj) obj.Refine = getParamRefine() - ViewProviderLatticeSlice(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderLatticeSlice(obj.ViewObject) return obj def float_fuzzy_equal(v1, v2, rel_tol): diff --git a/lattice2SubLink.py b/lattice2SubLink.py index 61d846a..c3d876d 100644 --- a/lattice2SubLink.py +++ b/lattice2SubLink.py @@ -40,7 +40,8 @@ def makeSubLink(name): '''makeSubLink(name): makes a SubLink object.''' obj = App.ActiveDocument.addObject("Part::FeaturePython",name) LatticeSubLink(obj) - ViewProviderSubLink(obj.ViewObject) + if FreeCAD.GuiUp: + ViewProviderSubLink(obj.ViewObject) return obj