Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Move pipe problems

1 REPLY 1
SOLVED
Reply
Message 1 of 2
beckhans
595 Views, 1 Reply

Move pipe problems

   I  want to change user selected pipe 's  offset (-50mm) by using Revit 2014 API. I write a loop as blow.

  

foreach (var element in sel.Elements)
                {
                    if (element is Pipe)
                    {

                        var s = element as Pipe;
                        var lCurve = s.Location as LocationCurve;
                        lCurve.Move(new XYZ(0, 0, -50 / 304.8));
                    }
}

 But when the code Run. The Real offset was -600mm.I debug the code and found when a pipe's offset changed,other pipes who connect to 

this pipe were also changed.Because User selected 12 pipes .So the offset were 12*-50=-600;

 Please give me some suggest to do this .

1 REPLY 1
Message 2 of 2
jeremytammik
in reply to: beckhans

Dear Beckhans,

 

I would suggest trying to use the ElementTransformUtils.MoveElements method and passing in all of the selected element ids in one single call instead of looping over them one by one.

 

I hope this helps.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community