Sweep a spline (pipe script)

On 04/02/2017 at 08:53, xxxxxxxx wrote:

Hello -

I'm in need of a script that can instantly sweep a spline with a circle. This is something like a script I found a long time ago called pipoficator. For some reason it won't work right with the new R18. Any chance I can get help with this? Thanks so much.

Greg

On 06/02/2017 at 16:07, xxxxxxxx wrote:

Coded in 5 min and I guess the code it's self explanatory but if you want more information feel free to ask 😉

import c4d
  
def main() :
    spline = op
    
    test_spline = spline.GetRealSpline()
    if not test_spline:
        return
    
    doc.StartUndo()
    sweep = c4d.BaseObject(c4d.Osweep)
    
    doc.AddUndo(c4d.UNDOTYPE_NEW, sweep)
    sweep.InsertAfter(spline)
    
    doc.AddUndo(c4d.UNDOTYPE_HIERARCHY_PSR, spline)
    spline.InsertUnder(sweep)
    
    circle = c4d.BaseObject(c4d.Osplinecircle)
    circle[c4d.PRIM_CIRCLE_RADIUS] = 10 #change the radius of the circle here
  
    doc.AddUndo(c4d.UNDOTYPE_NEW, circle)
    circle.InsertUnder(sweep)
    
    doc.EndUndo()
    c4d.EventAdd()
    
if __name__=='__main__':
    main()

On 06/02/2017 at 23:25, xxxxxxxx wrote:

I think, there's a small bug when adding the last undo step. There it probably should be circle instead of sweep.

On 07/02/2017 at 08:37, xxxxxxxx wrote:

Thanks I corrected it 🙂

On 07/02/2017 at 18:22, xxxxxxxx wrote:

gr4ph0s!!!! Thank you so much!!! You are awesome for doing that so quickly. Works great!

On 07/02/2017 at 18:23, xxxxxxxx wrote:

Andreas Block, thank you for your help as well!

On 07/02/2017 at 23:42, xxxxxxxx wrote:

Hi Greg,
I've not done much here. But, please, just Andreas is enough.