Move adaptive points on already deployed adaptive components

Move adaptive points

This question is asked in the developer section. I found that code snippet on ProvingGround but it appears to be for PyRevit. Seems easy enough but I can’t figure out the data type. The error says it’s expecting familyinstance. How do i turn an element into familyinstance?
image
image
So the key is to NOT to re-deploy adaptive component but moving the existing.

Hi @visualizor,

You were almost there:

2 Likes

I vaguely remember this unwrap thing. Just didn’t know the syntax. Btw do you know why we have to put an unwrap method around the input? What does it do?

Um, as far as I remember, we have to do this to expose the actual Revit API object. When collecting Revit elements through Dynamo, these are are automatically wrapped to enable the Revit document and Dynamo to stay in sync.

You should read the documentation for a more thorough explanation :slight_smile:

forgetting to unwrap gets me every time! :confounded:I wish there was an easy way to tell if an object is a dynamo wrapper or Revit type. I’m beginning to think UnwrapElement() is the Dynamo equivalent of “Have you turned it off and on again?” in the IT world :joy:

Funny, I think that would be lacing and levels… ones advanced coding of an issue and one is noding(?) for an issue. They both do kinda the same and are often overlooked the first time a graph or code is run.
:stuck_out_tongue:

1 Like

thanks for the help!
one minor thing left is the unit. I used this method
image
except I substituted the “trans4” with “XYZ(0,0,-150)” hoping that the point will be dropped by150mm. But in the model Revit moved it by a lot more. Does dynamo not get unit system from the parent revit file?

Hi Will,

I’m afraid not when you handle elements using the API. Your input values will be read as imperial, so you need to do a conversion if you’re working in metric.

True, changing list depth often results in breaking changes in dynamo, requiring constant attention to levels and lacing. I miss the way the grasshopper datatree construct hides this by operating on items in a list, rather than the lists themselves. ie first item in a grasshopper list will be the first element in every sublist, regardless of how many levels the list has. This has surely gone off topic now though…

1 Like

Maybe it’s too late but I am posting my update for someone who see this in future.

The issue is related to unit if you are using SI unit system.
Revit internally calculate all figures in ft even if your revit unit is SI.
So there are two option possibly to use MoveElement method.

Opt 1
calculate vector by original points and new points in Dynamo and convert to ft in Python.
(You probably need to change the script if your point list depth is different.)

vec = []
unit = 0.00328084
for index,set in enumerate(vec_set):
	vec.append([])
	for v in set:
		x= v.X*unit
		y= v.Y*unit
		z= v.Z*unit
		vec[index].append(XYZ(x,y,z))

Opt 2
Use UnitUtils Class (revitapidocs.com)

I am still learning C#, So I used Opt1 and could manage the issue.