Springs.Element.SetLocation Not Working

Hello all,

I am trying to use Springs.Element.SetLocation to move a Reference Point in a conceptual mass. You can see my graph in the attached picture. I think I have everything set up correctly but the RP does not move.

Also I know that in 1.2 there is a new built in node for moving Revit objects but I am stuck with 1.1 for now :frowning:

Hi @Steven_Hansen

Element.SetLocation nodes expect points as location currently your feeding vectors.

Kulkul,

I tried setting the Set Location with a point instead of a vector but it still does not work. I can see the dynamo point moving but the Revit point is still in same spot.

What type of element are you trying to move?

A Reference Point in a Conceptual Mass.

Iā€™m having similar issues. Afraid i donā€™t work much in the massing environment so I wonā€™t be of much help here. Maybe try re-building the mass by importing points, filtering the one you want to move out of the list, adding the new point, and recreating the geometry?

The problem is I am trying to control the geometry indefinitely. Right now if I close out of Revit Dynamo losses all association with the model. Then when I try and update it I need to start all over again.

This might be happening because the point is hosted on a line or a plane and youā€™re trying to move it off its associated plane. In that case Revit will just ignore the command.

Dimitar Thanks for the reply,

Reference points can move off of the plane though. They are hosted but should be able to move anywhere. In any cased though it wont move in any direction even across the planes surface. Any thoughts?

Thanks,
Steven

Had a thought last night about this and ran a little experiment on my lunch break. I thought that it might have been due to Revit preventing people from editing an in-place mass without opening the ā€œedit in-placeā€ command. Dynamo wonā€™t run much of anything for me when I start that command. Sadly itā€™s also non-responsive when I was in an conceptual mass family.

So i tried wiring in an element.location node to the reference point and found some odd results - namely iā€™m getting a FALSE result for ā€œHas Locationā€

This occurs even though the location is clearly listed in the watch node for the element and it clearly has a point as we can create geometry for and by itā€¦ I would water that these problems are linked. Sadly my python and API knowledge arenā€™t advanced enough for me to confirm in the time I had available, and likely are nowhere near far enough along to fix the issue at hand.

1 Like

Thanks for the effort @jacob.small. You have made more progress than I have. I will keep looking though and report back when / if I find something.

Had a quick look and yes, reference points do not have a location property. Instead they are controlled by a coordinateSystem/Position property that can be set through the apiā€¦gotta love Revit :slight_smile:

http://www.revitapidocs.com/2017/4f540b05-f562-8a72-37ef-834d45cea027.htm

8 Likes

@Dimitar_Venkov youā€™re the man!

1 Like

hi guys can you share the python script if you already made for this ( I want to move a reference point in massing environment)
or let me know if there is any node for like set element location by coordinate system

Hallo Dimitar , could you please share the solution for the Element location , i would be very appropriated.

Yes Could You Please share script with us

Hi,

This (very basic, youā€™ll want lots of error catching) code works for meā€¦

test

#credit & thanks to everyone
import clr
clr.AddReference(ā€œRevitServicesā€)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

pointsList = UnwrapElement(IN[0])
zValuesList = IN[1]

locations = []

TransactionManager.Instance.EnsureInTransaction(doc)

for point, newZLocation in zip(pointsList, zValuesList):
	locationX = point.Position.X
	locationY = point.Position.Y
	newLocation = XYZ(locationX, locationY, newZLocation)
	point.Position = newLocation

TransactionManager.Instance.TransactionTaskDone()


OUT = pointsList

Cheers,

Mark

1 Like

but İs ıt jus for z value ?And I also wolud like to change values for every single one bye one

Hey,

I tried to give an example code which shows you how to do thingsā€¦ you can customise it as you like, e.g. if you want to input X values as well, you can just make a new input

xValuesList = IN[2]

then you can amend your zipā€¦

for point, newZLocation in zip(pointsList, zValuesList, xValuesList)

and use your X valuesā€¦
newLocation = XYZ(newXLocation, locationY, newZLocation)

Cheers,

Mark

Edit: I think that you can feed a list of points and use .ToXYZ() to convert them to a Revit element

1 Like

Like this?

# thanks ALL esp Konrad & Dimitar!

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

pointsList = UnwrapElement(IN[0])
newLocations = UnwrapElement(IN[1])

TransactionManager.Instance.EnsureInTransaction(doc)

for point, newLocation in zip(pointsList, newLocations):
	point.Position = newLocation.ToXyz()

TransactionManager.Instance.TransactionTaskDone()


OUT = pointsList

1 Like