Core: fixes #8119: Make axis values in Property view persistent
This commit is contained in:
@@ -803,7 +803,7 @@ void PropertyPlacement::Save (Base::Writer &writer) const
|
||||
<< "\" Q3=\"" << _cPos.getRotation()[3] << "\"";
|
||||
Vector3d axis;
|
||||
double rfAngle;
|
||||
_cPos.getRotation().getValue(axis, rfAngle);
|
||||
_cPos.getRotation().getRawValue(axis, rfAngle);
|
||||
writer.Stream() << " A=\"" << rfAngle
|
||||
<< "\" Ox=\"" << axis.x
|
||||
<< "\" Oy=\"" << axis.y
|
||||
@@ -1190,7 +1190,7 @@ void PropertyRotation::Save (Base::Writer &writer) const
|
||||
{
|
||||
Vector3d axis;
|
||||
double rfAngle;
|
||||
_rot.getValue(axis, rfAngle);
|
||||
_rot.getRawValue(axis, rfAngle);
|
||||
|
||||
writer.Stream() << writer.ind() << "<PropertyRotation";
|
||||
writer.Stream() << " A=\"" << rfAngle << "\""
|
||||
|
||||
@@ -258,6 +258,28 @@ class DocumentBasicCases(unittest.TestCase):
|
||||
cpy = self.Doc.copyObject(obj)
|
||||
self.assertListEqual(obj.PlmList, cpy.PlmList)
|
||||
|
||||
def testRawAxis(self):
|
||||
obj = self.Doc.addObject("App::FeaturePython","Label")
|
||||
obj.addProperty("App::PropertyPlacement", "Plm")
|
||||
obj.addProperty("App::PropertyRotation", "Rot")
|
||||
obj.Plm.Rotation.Axis = (1,2,3)
|
||||
obj.Rot.Axis = (3,2,1)
|
||||
|
||||
# saving and restoring
|
||||
SaveName = tempfile.gettempdir() + os.sep + "CreateTest.FCStd"
|
||||
self.Doc.saveAs(SaveName)
|
||||
FreeCAD.closeDocument("CreateTest")
|
||||
self.Doc = FreeCAD.open(SaveName)
|
||||
obj = self.Doc.ActiveObject
|
||||
|
||||
self.assertEqual(obj.Plm.Rotation.RawAxis.x, 1)
|
||||
self.assertEqual(obj.Plm.Rotation.RawAxis.y, 2)
|
||||
self.assertEqual(obj.Plm.Rotation.RawAxis.z, 3)
|
||||
|
||||
self.assertEqual(obj.Rot.RawAxis.x, 3)
|
||||
self.assertEqual(obj.Rot.RawAxis.y, 2)
|
||||
self.assertEqual(obj.Rot.RawAxis.z, 1)
|
||||
|
||||
def testAddRemove(self):
|
||||
L1 = self.Doc.addObject("App::FeatureTest","Label_1")
|
||||
# must delete object
|
||||
|
||||
Reference in New Issue
Block a user