Hi,
>>> ob = Gui.getDocument("Unnamed").getObject("Face")
>>> ob.Object.Shape.Placement
Placement ((0,0,0,1),(0,0,0))
>>> ob.Object.Shape.Matrix
Matrix ((1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1))
>>> ob.Object.Placement
Matrix ((1,0,0,4),(0,1,0,0),(0,0,1,0),(0,0,0,1))
Oops, how did this happen? The translation part of the object is (4,0,0) and of the shape it is (0,0,0). This seems to be wrong. BTW, the object placement returns a matrix here. I'll change that to return a placement. Please let me know how to reproduce this behaviour so that I can fix this.
1. TopLoc_Location - is it Placement object or Matrix? More precisely, can I scale object without transformation?
The implementation of this class is pretty complex. After having a look to its members it uses an array of gp_Trsf which consists of a 3x3 matrix, a translation vector and a scale factor. A gp_Trsf is comparable with our 4x4 matrix.
According to the OCC documentation scaling is possible but it doesn't seem to work very well. If you try to do a scaling over a matrix the value A44 must be <> 1 but it doesn't seem to have an effect when applying the matrix on the shape's TopLoc_Location. If you do it with transform(), i.e. a geometric modification it does something but not correctly either.
ob.Object.Shape.transform(Matrix) will transform Vertexes and Poles coordinates, but will leave ob.Object.Shape.Matrix unchanged. Is it correct?
Yes, this is correct. Note, you have two possibilities to change a shape: modify its placement (i.e. TopLoc_location) or modify directly its underlying geometry. The method transform() does the latter. I have fixed the documentation to make this clear. Maybe we should also rename the method to transformGeometry() to avoid any misunderstanings.
3. document Object could have different Placement then internal Shapes and To get world coordinates of the point Matrix for Object.Placement should be multiplied by Object.Shape.Matrix - is it cirrect? If Shape is Edge as part of the Wire - will correct calculations require 3 matrix multiplication and so on? Or ob.Object.Shape.Matrix, ob.Object.Shape.Edges[0].Matrix and ob.Object.Placement is the same matrix?
The object's placement and the shape placement must be identical. The above example demonstrates an error. And yes, to get the world coordinates of a vertex of a shape you must multiply it with Object.Shape.Matrix (or Object.Placement). And yes, if you have an edge that is part of a wire you must do further matrix multiplications. The matrix information of ob.Object.Shape.Edges[0].Matrix is
not part of ob.Object.Placement. This matrix is completely out of control of the object.
4. Gui.ActiveDocument.ActiveObject.Object and App.ActiveDocument.ActiveObject is the same Part object instance. Is it correct?
Yes, this is correct.
5. Is it possible to get assess to coin reflection of the Shape knowing its name from document? Yorik creating new object instance to make the ghost. Is it possible to avoid it and make copy of the visualization directly?
Assuming you want to access the Inventor node of a document object with name "MyName" you get it by:
iv=Gui.ActiveDocument.getObject("MyName").RootNode
to get a copy you can use the method copy()