Arrange sweep on surface via python



  • On 17/12/2017 at 14:02, xxxxxxxx wrote:

    Hi !

    I try to build a sweep that is following a spline that is projected on a mesh surface. The contour spline of the sweep should be placed exactly on the surface (see screenshot). The manual way would be (or maybe this already wrong?)  :

    1. select a few edges
    2. "edge to spline"
    3. create contour spline
    4. move the contour axis
    5. put path and contour under spline object

    Using any simple objects like a sphere or cone I get step 4) by moving the contour axis either in x or y direction (or both). But using a more detailed mesh with a projected spline this manual method is very inaccurate.

    How can I do this using python ?

    The starting point of the path spline seems to be the important one in order to calculate which of the contour spline axis has to be moved how much for placing the sweep exactly ON the edge. I tried to get the normal vector of that first path point in order to align the contour spline properly - but this is of no use since the spline axis have to be moved and not the spline itself.

    I'm totally lost here ... can anybody help ?

    Thanks !



  • On 18/12/2017 at 02:34, xxxxxxxx wrote:

    Hello,

    just some idea: instead of a sweep object you could use a loft object. The geometry created by the loft object is defined with multiple control shapes. Sou you could place such a control shape at every control point and align to the the point's normal vector.

    Another idea would be to construct the sweep control spline in a way that all spline points have a constant distance to the actual surface. That distance would be the radius of the cross section spline.

    Maybe you should ask your question on a user forum if you want to discuss modeling workflows.

    best wishes,
    Sebastian



  • On 18/12/2017 at 03:29, xxxxxxxx wrote:

    Hi Sebastian,

    thanks for your answer.

    I also considered your 2 alternative solutions:

    - I was a little worried about the loft-way since I thought the (high) number of control shapes when using large and detailled path splines might stress the memory far more than using a sweep.

    - the second solution is also feasible but modifying the path spline is more complicated than modifying the contour spline since for each spline point the corresponding normal vector is needed in order to push the point away from the surface. It gets more complicated when I want to taper the sweep since each path point has to be moved dependent from the position on the path.

    In other words: my hope was that I only missed some essential point in changing the sweep's contour spline axis via python in order to get the result in the screenshot and that this solution is quicker and less memory consuming than the other two ... but unless someone posts a solution for the sweep method I will go the loft-way.

    I would like to implement this as a part of a plugin so I was only interested in the way to get this done by script. So I thought this forum might be the best place to ask.

    Thanks a lot again for your help and best wishes,
    Jens



  • On 18/12/2017 at 09:38, xxxxxxxx wrote:

    Hello,

    as far as I can see you will need the normal for a given point in all cases. One way to get the normal for an arbitrary point on a polygon surface could be to use GeRayCollider. But that depends on how your workflow should look like.

    best wishes,
    Sebastian


Log in to reply