fix bug in PropertyPlacementList::RestoreDocFile

This commit is contained in:
wmayer
2018-10-22 12:06:54 +02:00
parent 1243b2543e
commit 9bb360bb75
2 changed files with 11 additions and 1 deletions

View File

@@ -946,7 +946,7 @@ void PropertyPlacementList::RestoreDocFile(Base::Reader &reader)
if (reader.getFileVersion() > 0) {
for (std::vector<Base::Placement>::iterator it = values.begin(); it != values.end(); ++it) {
Base::Vector3d pos;
float q0, q1, q2, q3;
double q0, q1, q2, q3;
str >> pos.x >> pos.y >> pos.z >> q0 >> q1 >> q2 >> q3;
Base::Rotation rot(q0,q1,q2,q3);
it->setPosition(pos);

View File

@@ -164,6 +164,16 @@ class DocumentBasicCases(unittest.TestCase):
self.Doc.removeObject(obj.Name)
self.assertListEqual(grp.Group, [])
def testPlacementList(self):
obj = self.Doc.addObject("App::FeaturePython","Label")
obj.addProperty("App::PropertyPlacementList", "PlmList")
plm = FreeCAD.Placement()
plm.Base = (1,2,3)
plm.Rotation = (0,0,1,0)
obj.PlmList = [plm]
cpy = self.Doc.copyObject(obj)
self.assertListEqual(obj.PlmList, cpy.PlmList)
def testAddRemove(self):
L1 = self.Doc.addObject("App::FeatureTest","Label_1")
# must delete object