here is the code i am using.
//create new pipe
public Pipe CreateNewPipe(Document document, XYZ p1, XYZ p2, PipeType pipeType)
{
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(PipeType));
//PipeType pipeType = collector.FirstElement() as PipeType;
Pipe pipe = null;
if (null != pipeType)
{
pipe = document.Create.NewPipe(p1, p2, pipeType);
set_pipe_offset(pipe);
set_pipe_diameter(pipe);
}
return pipe;
}
//set the default pipe diameter
Public void set_pipe_diameter(Pipe pp)
{
Parameter par_dia = pp.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);
par_dia.Set(m_para_diameter);
}
//set the default pipe offset
public void set_pipe_offset(Pipe pp)
{
Parameter par_offset = pp.get_Parameter(BuiltInParameter.RBS_OFFSET_PARAM);
par_offset.Set(m_offset);
}
for(int i=0; i<5; i++)
{
-----
m_pipes = CreateNewPipe(m_document, tmp_start, tmp_end,pipes[0].PipeType);
}
like this i am using the code. in CreateNewPipe() function i am calling the set_pipe_offset(Pipe pp) function.