CAM: Fix creating Helix on Prototype
For the "Op Defaults" from the setup sheet the operations get created with a `OpPrototype` instead of a real document object. This prototype provides only a small subset of FreeCAD's document object API. When a new Job is created via the GUI, each registered operation is created with such a dummy to populate the setup sheet panel. And if such an operation uses document APIs not provided by the prototype, the enire job creation fails, see #17871. Unfortunately we don't have tests for the GUI part, where all the operations are regsitered and thus the integration with all of them could be verified, this I just created a local test for the helix, where the actual issue was reported -- this can be verified with headlessly.
This commit is contained in:
@@ -25,6 +25,7 @@ import pathlib
|
||||
import Draft
|
||||
import FreeCAD
|
||||
import Path
|
||||
import Path.Base.SetupSheetOpPrototype as PathSetupSheetOpPrototype
|
||||
import Path.Main.Job as PathJob
|
||||
import Path.Op.Helix as PathHelix
|
||||
import CAMTests.PathTestUtils as PathTestUtils
|
||||
@@ -55,6 +56,12 @@ class TestPathHelix(PathTestUtils.PathTestBase):
|
||||
op = PathHelix.Create("Helix")
|
||||
op.Proxy.execute(op)
|
||||
|
||||
def testCreateWithPrototype(self):
|
||||
"""Verify a Helix can be created on a SetupSheet's prototype instead of a real document object"""
|
||||
|
||||
ptt = PathSetupSheetOpPrototype.OpPrototype("Helix")
|
||||
op = PathHelix.Create("OpPrototype.Helix", ptt)
|
||||
|
||||
def test01(self):
|
||||
"""Verify Helix generates proper holes from model"""
|
||||
|
||||
|
||||
@@ -224,6 +224,9 @@ class OpPrototype(object):
|
||||
def setEditorMode(self, name, mode):
|
||||
self.properties[name].setEditorMode(mode)
|
||||
|
||||
def setPropertyStatus(self, name, status):
|
||||
pass
|
||||
|
||||
def getProperty(self, name):
|
||||
return self.properties[name]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user