Relocate curve of a curve element

revit
springnodes

#1

I was attempting to relocate some beams trying to follow this LocationCurve method:

<span class="highlight-keyword">void</span> MoveUsingCurveParam(Autodesk.Revit.ApplicationServices.Application application, Wall wall)
{
    LocationCurve wallLine = wall.Location <span class="highlight-keyword">as</span> LocationCurve;
    XYZ p1 = XYZ.Zero;
    XYZ p2 = <span class="highlight-keyword">new</span> XYZ(<span class="highlight-number">10</span>, <span class="highlight-number">20</span>, <span class="highlight-number">0</span>);
    Line newWallLine = application.Create.NewLineBound(p1, p2);

    <span class="highlight-comment">// Change the wall line to a new line.</span>
    wallLine.Curve = newWallLine;
}


So I implemented a small python node to the best of my abilities but whenever I try to switch the old curves to the new curves, I get the following error:

Traceback (most recent call last):
  File "<string>", line 33, in <module>
TypeError: expected Curve, got Line

Any idea how I could make this work? I've attached the definition below.

relocate


#2

I realize this is an old post, but did you ever figure this out? I’m running into the same issue attempting to relocate some beams.


#3

I think that this code was missing a simple cast from Line, to Curve. Since Line is implemented from base class (Curve) it should just take a cast.


#4

Hi Jared,

You’ll find the node “Element.SetLocation” inside the spring nodes package.


#5

Hahaha, of course you figured it out. :slight_smile:


#6

Awesome. Thanks!

Yea, had forgotten to convert my lines ToRevitType()