Rhino common AddThickPipe

Hi All,

I am having problems in getting the Rhino Common Add Thick Pipe command to run on my data.
The script is basically just this one command so nothing worthwhile uploading at this stage.

In the screenshot below you will see my values the length of the curve is leng, the external radius at end 1 is Config Values ‘dim2’ at end 2 it is ‘dim4’ , the internal radius at end 1 is Config Values ‘dim3’ and at end 2 ‘dim5’.

I have created a curve from (0,0,0) to (0,leng,0) called ‘axis’ so with this data I want to create a pipe which has different wall thickness at each end it is not constant.

I can do this in the manual ‘Pipe’ command in Rhino with the Thickness option selected as it asks for two radii / diameters for each end of the curve easy. If the Rhino common command does not allow this can anyone show me how to use Rhino Command in Rhino syntax to run the ‘Pipe’ command with the thickness option selected.

The first parameter after your rail curve should be a list as well. You are giving just a single float, at least according the error message. Also the first parameter has to be a curve, you are passing in a GUID.

You need (in order): a curve, a list of railradii parameters (floats), a list of radii for the first wall, a list of radii for the second wall, a bool controlling the local bending, a member from the PipeCapMode enum, a bool controlling fitting to rail, a float for absolute tolerance and a float for angle tolerance in radians.

That is 9 parameters, you give only 6.

Pretty much as the method documentation says…

Hi Nathan,

Thank you for the info but I found the help file confusing as a novice programmer, there are very few examples in rhino common to help, something like below would be very beneficial to newbies like me.

This is my final code and now works.

Roger



        # Create the axis curve (a straight line along the Y-axis)
        start = Rhino.Geometry.Point3d(0, 0, 0)
        end = Rhino.Geometry.Point3d(0, leng, 0)
        axis = Rhino.Geometry.LineCurve(start, end)

        # Define normalized parameters for the start and end of the curve
        railRadiiParameters = List[float]([0.0, 1.0])  # Start (0.0) and end (1.0)

        # Define radii for the first wall (internal radii)
        radii0 = List[float]([Irad1, Irad3])

        # Define radii for the second wall (external radii)
        radii1 = List[float]([Erad2, Erad4])

        # Create the thick pipe
        pipe = Rhino.Geometry.Brep.CreateThickPipe(
            axis,                          # Rail curve
            railRadiiParameters,   # Normalized parameters for radii changes
            radii0,                        # Radii for the first wall
            radii1,                        # Radii for the second wall
            True,                         # Local blending (False for global blending)
            Rhino.Geometry.PipeCapMode.Flat,  # End cap mode
            True,                          # Fit rail (True for single surface)
            sc.doc.ModelAbsoluteTolerance,  # Absolute tolerance
            sc.doc.ModelAngleToleranceRadians  # Angle tolerance
        )

        # Add the pipe to the document
        if pipe:
            for brep in pipe:
                sc.doc.Objects.AddBrep(brep)
            sc.doc.Views.Redraw()
            print("Pipe created successfully.")
        else:
            print("Failed to create pipe.")


        print("End of Concentric Reducers")

Where you do List[float](...) you can just do [ ... ]railRadiiParameters = [0.0, 1.0]

Other than that it looks good.

And note that you can add as many parameters and radii as you want. As long as you ensure that the three lists are always the same length, example: