Ok. I suppose I figured the right way of doing it from an example
here<http://www.pythonizer.org/pythoncascade/gallery/toptra5.htm>
.

The transform should be created like this:

xform = gp_GTrsf()
xform.SetVectorialPart(gp_Mat(
  1.5, 0, 0,
  0, 1, 0,
  0, 0, 1,
))
brep = BRepBuilderAPI_GTransform(shape, xform, False)

This creates results as expected, without any extra polygons.
--
Jayesh


On Sat, Nov 26, 2011 at 12:35 PM, Jayesh Salvi <jayeshsa...@gmail.com>wrote:

> Hi,
>
> I am trying to do scale a Shape only along selective dimensions and I see
> some unwanted polygons in the result. Here is a sample code to reproduce
> what I am seeing. It creates a cylinder and then scales it along X-axis.
> Then I export it as STL and view it in meshlab to find some extra polygons
> on the side. I am attaching the screenshot of stl. (source file also
> available 
> here<https://github.com/jayesh3/cadmium/blob/master/examples/pythonocc/scale-problem.py>
> )
>
>
> from OCC.BRepPrimAPI import BRepPrimAPI_MakeCylinder
>
> from OCC.BRepBuilderAPI import BRepBuilderAPI_GTransform
>
> from OCC.gp import gp_GTrsf, gp_Trsf
>
> from OCC.Precision import Precision_Angular, Precision_Confusion
>
> from OCC import StlAPI
>
>
>
> shape = BRepPrimAPI_MakeCylinder(20,40).Shape()
>
>
>
> xform = gp_Trsf()
>
> xform.SetValues(
>
>   1.5, 0, 0, 0,
>
>   0, 1, 0, 0,
>
>   0, 0, 1, 0,
>
>   Precision_Angular(), Precision_Confusion()
>
> );
>
> brep = BRepBuilderAPI_GTransform(shape, gp_GTrsf(xform), False)
>
> brep.Build()
>
> shape = brep.Shape()
>
>
>
>
>
> stl_writer = StlAPI.StlAPI_Writer()
>
> stl_writer.Write(shape, 'scaled-cylinder.stl')
>
>
>
> What am I doing wrong? Or is this a problem in OCC scaling algorithm?
>
> Thanks,
> --
> Jayesh
>
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to