Up to FreeCAD 0.12 it was possible to change the shape matrix of a PartFeature (and other properties).
In FreeCAD 0.13+ PartFeature.shape is immutable.
Because I am using FreeCAD without GUI, I transfer all geometry informations from shapes to my application. This is done by tessellation for all faces and reading all Edges e.g.
I need "local" geometry. Transformations are handled separate by transferring the shape Matrix.
In 0.12 I could:
- save the shape.Matrix
- reset shape.Matrix to an identity matrix
- .. tessellate e.g.
- restore the "old" matrix
the only way I see in 0.13+ is
- to work with a shape.copy() to reset the matrix
- to transform all vertex with the inverse matrix
Both option are very slow and not really nice.
Has someone a better solution?
Thanks for your help.
Jack-not-really
PartFeature.shape is immutable in 0.13+
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 14
- Joined: Fri Nov 15, 2013 5:30 pm
Re: PartFeature.shape is immutable in 0.13+
Instead of setting the matrix to the shape object you can set it to the part feature. This has exactly the same effect because in FreeCAD the placement of a part feature is always synchronized with the placement of its shape.
-
- Posts: 14
- Joined: Fri Nov 15, 2013 5:30 pm
Re: PartFeature.shape is immutable in 0.13+
Yes, I know. But "only" for the Placement. This works as long as the matrix is orthonormal. And it fires a onChange event for the placement. But never mind.wmayer wrote:Instead of setting the matrix to the shape object you can set it to the part feature. This has exactly the same effect because in FreeCAD the placement of a part feature is always synchronized with the placement of its shape.
This was discussed here several times. No reply needed. Thanks!
-
- Posts: 14
- Joined: Fri Nov 15, 2013 5:30 pm
Re: PartFeature.shape is immutable in 0.13+ addendum
I was wrong and sold again!
Code: Select all
shape=ShapeParent.Shape
ShapeParent.Placement=FreeCAD.Placement(FreeCAD.Matrix())
shape.Matrix will not be changed instead of ShapeParent.Shape.Matrix
Re: PartFeature.shape is immutable in 0.13+
Be careful!
Here you have a new reference to the underlying shape object.shape=ShapeParent.Shape
This can cause the part feature to recompute itself and thus creates a new shape object. The above reference points to the old shape which doesn't belong to the part feature any moreShapeParent.Placement=FreeCAD.Placement(FreeCAD.Matrix())