Hi Nicolas,

You probably should go through the doxygen documentation & pdf's that come
with the source distribution or documentation distribution:
http://www.opencascade.org/getocc/download/loadocc/

That provides pretty decent documentation.

Now, wrt splitting at a surface parameter; from the top of my head, getting
an iso curve from your surface parameter and using this to split your
surface is probably the easiest:


from OCC.Utils.Construct import *
box = make_box(1,1,1)
from OCC.Utils.Topology import Topo
# get a face
f = Topo(box).faces().next()
from OCC.KBE.face import Face
# PythonOCC's KBE module is a pretty nice compact API
F = Face(f)
# find the domain of the surface
F.domain()
# build a curve where you want to split the face
F.iso_curve(0, 0.5)
tt=F.iso_curve(0, 0.5)
# make a BRep from a curve
split_edge = make_edge(tt.Line()
# use that to split
split_srf = splitter(F, split_edge)

I'm assuming away that the orientation of the split_edge is relevant.
I've copied some of the important function for your convenience.

-jelle


def splitter(shape, profile):
    '''split a *shape* using a *profile*
    :returns the splitted shape
    '''
    try:
        from OCC.GEOMAlgo import GEOMAlgo_Splitter
    except ImportError:
        msg = "GEOM wrapper is necesary to access advanced constructs"
        warnings.warn(msg)
        return None
    splitter = GEOMAlgo_Splitter()
    splitter.AddShape(shape)
    splitter.AddTool(profile)
    splitter.Perform()
    splitter_shape = splitter.Shape()
    return splitter_shape


    def iso_curve(self, u_or_v, param):
        """
        get the iso curve from a u,v + parameter
        :param u_or_v:
        :param param:
        :return:
        """
        uv = 0 if u_or_v == 'u' else 1
        # TODO: REFACTOR, part of the Face class now...
        iso = Adaptor3d_IsoCurve(self.adaptor_handle.GetHandle(), uv, param)
        return iso




On Wed, Sep 26, 2012 at 12:58 AM, Nicolas Rousselon <
nico.rousse...@gmail.com> wrote:

> Hello,
>
> Newbie here. Thanks to the tutorials/samples; I've managed to import Step
> files, create primitives, export them in stl.
> My next step is to split my imported surface in two pieces in the
> parametric space (say along a line u=0.5).
> A bit tricky for me to find out where to start, searching through google
> and the api help, I found a few things:
> BSplineSurfaceKnotSplitting_Splitting<http://api.pythonocc.org/OCC._GeomConvert-module.html#GeomConvert_BSplineSurfaceKnotSplitting_Splitting>
> ShapeUpgrade_SplitSurfaceArea<http://api.pythonocc.org/_ShapeUpgrade%27-module.html#new_Handle_ShapeUpgrade_SplitSurfaceArea>
>
> but still not close to figuring out where to proceed.
> Any ideas?
>
> Regards,
>
> Nicolas
>
> _______________________________________________
> Pythonocc-users mailing list
> Pythonocc-users@gna.org
> https://mail.gna.org/listinfo/pythonocc-users
>
>
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to