How to set the pipe offset?

How to set the pipe offset?

Anonymous
Not applicable
2,923 Views
15 Replies
Message 1 of 16

How to set the pipe offset?

Anonymous
Not applicable

 

Please can anyone suggest me how to set the pipe offset..

I am creating new pipes. After creating the new pipe the offset changing to -1250mm.

How can i set the pipe offset value?

 

Thank you in advance..

0 Likes
Accepted solutions (1)
2,924 Views
15 Replies
Replies (15)
Message 2 of 16

ollikat
Collaborator
Collaborator
Accepted solution
Hi

I think the RBS_OFFSET_PARAM built-in parameter will do the trick.

I don't have any code example within reach, but probably you are familiar with setting element parameters(?).
0 Likes
Message 3 of 16

Anonymous
Not applicable

Hi i am using this RBS_OFFSET_PARAM in code to read the offset.

Successfully i can read the offset of the pipe. If i try to set the same offset for newly creating pipe then its failing.

 

I am trying like this.. as show below.

 

m_offset = pipes[0].get_Parameter(BuiltInParameter.RBS_OFFSET_PARAM).AsDouble();

Parameter  par_offset = pp.get_Parameter(BuiltInParameter.RBS_OFFSET_PARAM);

par_offset.Set(m_offset);

 

if i use like this i am getting error..

Could you please help me to solve this issue..

 

0 Likes
Message 4 of 16

Anonymous
Not applicable

The start offset is getting changed but the end offset remains in negative side only.

Or is there any api to create a pipe giving the inputs like pipetype, start, end, offset?


If so please suggest me..

0 Likes
Message 5 of 16

ollikat
Collaborator
Collaborator

Hi

Could you please tell more precisely, what kind of error you are getting? An exception or is so that the result just isn't what you expect? Also, what is the origin of the "pp" variable in the sample code you provided.

0 Likes
Message 6 of 16

Anonymous
Not applicable

i am getting error like "Sub transaction opned not getting closed" this.

The offset of the original pipe(PP variable) is 2750mm.

In the same location i am creating new pipes in a loop its taking -1250mm as offset.

I want to set the offset of the new pipes to original(2750mm).

 

0 Likes
Message 7 of 16

Anonymous
Not applicable

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.

 

0 Likes
Message 8 of 16

ollikat
Collaborator
Collaborator

Hi

 

Cannot see anything that would cause imminent problems in your code.

But the error you mentioned. If I recall correctly, that error comes in situation when an external command exits before transaction is properly finished (commit / rollback). So I started to doubt that maybe your code throws an exception somewhere and thus causes the command to exit. Although you should be able to see the exception also from the UI.

 

But still about the error. Is it a some message box appearing in the UI or is it an exception you get?

At which point of code execution this error comes? Have you debugged your code step by step?

0 Likes
Message 9 of 16

Anonymous
Not applicable

yes I debugged my code.

when it enters to set_pipe_offset() function 2/3 iteration is running after that a dialog box is appearing saying that transaction/ subtransaction opened is not closed..

0 Likes
Message 10 of 16

ollikat
Collaborator
Collaborator
Hmm...sounds strange. Are you using automatic or manual transaction mode?
0 Likes
Message 11 of 16

Anonymous
Not applicable

Hi,

 

I am using transaction mode as Manual..

Is there any other way to set the offset for the pipes..

0 Likes
Message 12 of 16

ollikat
Collaborator
Collaborator
Well...it's not about how you are setting the offset. The error clearly refers that there's some other problem with your implementation...but I can't figure out what it could be exactly.

I think you should check how you are managing the transaction(s). Try to do some changes and see if you can affect the behavior.
0 Likes
Message 13 of 16

Anonymous
Not applicable

Thank you very much, for the update.

I will figure it out..

0 Likes
Message 14 of 16

Anonymous
Not applicable

Hi it worked.. I Solved the issue..

 

Thank you very much....Smiley Indifferent

 

Is there anything to read the reference level of pipe?

If i create the pipe new over the existing pipe reference level is getting changed to BASEMENT 2 AMMENITIES..

i tried with  RBS_REFERENCE_LINING_TYPE its giving the value as 0..

Please give some suggestions.

 

 

 

0 Likes
Message 15 of 16

ollikat
Collaborator
Collaborator
Hi.

Nice to hear you managed to proceed.

Well...the Pipe object you create inherits from MEPCurve class, which has ReferenceLevel property. I think that's the one you'll need (?).
0 Likes
Message 16 of 16

Anonymous
Not applicable

yes.. i need to read that reference level..

0 Likes