View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001221 | FreeCAD | Feature | public | 2013-08-18 11:09 | 2013-08-25 07:32 |
Reporter | shoogen | Assigned To | wmayer | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Fixed in Version | 0.14 | ||||
Summary | 0001221: Add a function that can apply a Placement to a Shape like sh.transformGeometry(sh.Placement.toMatrix()) | ||||
Description | Definiton: A so-called "null placement" has the same effect as appling unity matrix. (No rotation nor translation) If a shape is to be used as a result of the execute funtion it needs to be free of any (shape) placement. Otherwise this introdruce trouble when the Features has a Placement as well. The result of bolean operations has a null placement. But some operations like refine shape may return a Shape with a placement (esp. for trivial input that can not simplified further). In order tu use this shape in parametric (python) feature the placement has to be applied to the actual Shape data. the only known workaround to the auther is call to fp.Shape=sh.transformGeometry(sh.Placement.toMatrix()) in execute() function. Though the transformation will in generaly not require the shape to be converted to BSpline representation, transformGeometry is notoroius for degrading the Shape in this way. There should be a way to obtained a shape with Placement allready applied to the internal datastructure without the danger of degrading the shape to a BSpline reperesentation. Suggesgestions: Maybe the fusion the shape (with placement) with an 'empty' solid can create the desired shape | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
An error caused by the current workaround is dicussed http://forum.freecadweb.org/viewtopic.php?f=3&t=4412&p=34698#p34691 Also discussed in http://forum.freecadweb.org/viewtopic.php?f=3&t=2196&hilit=transformGeometry&start=10#p19074 and https://sourceforge.net/apps/mantisbt/free-cad/view.php?id=699 |
|
Another solution would include to break up the connection of the placement of the Feature and the Shape. (in Part::Feature::onChanged(const App::Property* prop)) And introduce another layer inbetween those two. We could introduce this as another (kind of) feature. The Shape would have a second Placment (in its properties) wich is used to recalculate the shape's placment in case the Feature's placement is modified. |
|
the workaround with a useless boolean operation seems to work: fp.shape = sh.cut(Part.Compound([])) The question is if it makes send to avoid the actual boolean and just look what OCC does internally to apply the placement to the vertex data (without converting the data to BSplines) |
|
The class BRepTools_ReShape might offer the functionality you use which can be used with Shape.replaceShape() (which requires a list of tuples of shapes as argument). But look at https://sourceforge.net/p/free-cad/code/ci/48f8d67b509a61875ee32fb809c8a66c4cafe6fe/ and you'll see that this issue is solved now. |
|
Thanks Werner but there are other usecases. It seems to me that calling the Part.Solid(someshape) returns a Shape with no placement? |
|
As i don't know which Shape type I get. I don't want to check for them. I would like to have a Command that works with any Type. But this has low priority because the main other use case that i can think of is limited to wires. |
|
I had a look, how to change the placement of parts from the python console. For me it looks like, that the operation of the Part Workbench puts a handle to the real placement into the placement structure. The operations of the Partdesign Workbench put only a copy of the original placement into the placement structure. You can not change the placement of these parts from the placement menu. You can change the placement from the python console. But the parts are flipping back at app.recompute(). You can go down the feature tree for Partdesign parts. And the original feature allows to place the part from the menu. So for me there is the question, how can I get a handle to the placement of the first feature, as this would allow to place these parts from within python. |
|
i think that there is no such handle, but the placements a synchronized in the method Part::Feature::onChanged(const App::Property* prop) |
|
I found a way to move one step up in the feature tree: o = Gui.Selection.getSelectionEx()[0] >>> o.Object <Part::PartFeature> >>> o.ObjectName 'Pad' >>> o.Object.OutList.__len__() 1 >>> o.Object.OutList[0] <Sketcher::SketchObject> >>> sket = o.Object.OutList[0] >>> sket.Placement Placement [Pos=(0,0,0), Yaw-Pitch-Roll=(0,0,0)] >>> sket.Placement.move(FreeCAD.Vector(10,0,0)) >>> App.activeDocument().recompute() I could move a Partdesign Pad made from a sketch with the above commands. |
|
Here is the difference between a Partdesign-Part and a Part-Part. A Part-Part may have two objekts in the outlist: >>> o.Object.OutList [<Part::PartFeature>, <Part::PartFeature>] The consequence is a new "Null-Placement". A Partdesign-Part has only one object in the outlist. The placement is governed from the topmost feature with a "Null-Placement" |
|
http://www.opencascade.org/org/forum/thread_14993/?forum=3 The class BRepBuilderAPI_Transform has a parameter "copy" and setting it to true gives a transformed shape without a placement set. |
|
transformShape() now got a second parameter. This is of boolean type and optional (default=False). import Part m=App.Matrix() m.rotateX(0.5) m.rotateY(0.5) m.rotateZ(0.5) s=Part.makeBox(10,10,10) s.transformShape(m,True) s.Placement Part.show(s) t=Part.makeBox(10,10,10) t.transformShape(m) t.Placement Part.show(t) |
|
git show 1da39d0 |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-08-18 11:09 | shoogen | New Issue | |
2013-08-18 11:14 | shoogen | Note Added: 0003493 | |
2013-08-20 05:11 | shoogen | Note Added: 0003500 | |
2013-08-23 02:35 | shoogen | Note Added: 0003505 | |
2013-08-23 11:37 | wmayer | Note Added: 0003506 | |
2013-08-23 12:33 | shoogen | Note Added: 0003507 | |
2013-08-23 12:35 | shoogen | Note Edited: 0003507 | |
2013-08-23 14:34 | shoogen | Note Added: 0003508 | |
2013-08-23 14:39 | shoogen | Note Edited: 0003508 | |
2013-08-23 15:00 | ulrich1a | Note Added: 0003509 | |
2013-08-23 16:24 | shoogen | Note Added: 0003510 | |
2013-08-23 17:06 | ulrich1a | Note Added: 0003511 | |
2013-08-23 17:31 | ulrich1a | Note Added: 0003512 | |
2013-08-24 09:17 | wmayer | Note Added: 0003513 | |
2013-08-25 07:31 | wmayer | Note Added: 0003515 | |
2013-08-25 07:31 | wmayer | Status | new => assigned |
2013-08-25 07:31 | wmayer | Assigned To | => wmayer |
2013-08-25 07:32 | wmayer | Note Added: 0003516 | |
2013-08-25 07:32 | wmayer | Status | assigned => closed |
2013-08-25 07:32 | wmayer | Resolution | open => fixed |
2013-08-25 07:32 | wmayer | Fixed in Version | => 0.14 |