Assuming you have loaded the Dynamo geometry library into Python (the standard Python template in Dynamo for Revit will do this for you), and you have defined your geometryVariable, xAmount, yAmount, and zAmount you can use this line to scale Dynamo geometry: scaledUp = Geometry.Scale(geometryVariable, xAmount, yAmount, zAmount)
Revit geometry scaling is a bit more complex, as it requires the use of a transform, which can be created via this method: ScaleBasis Method
Once you have created the transform object, you can then utilize it on the REvit geometry object. I believe this method should work for that: GetTransformed Method
Note that this will not manipulate existing elements; You’ll have a LOT more to do if that’s what you’re after.
This is one of the reasons I like the “nodes > design script > python” progression. The class.method(override1,override2) syntactic which is present in Design Script and the Dynamo node library is directly related to how you write it in Python. If you’re not sure of the DesignScript method, you can utilize node to code as well to really help facilitate the progression.
Because of this you need not worry so much about the constructors/methods/properties, and can instead focus on learning the context specific stuff in Python (ie: your for loop, or list comprehension which would be scaledUp = [Geometry.Scale(l, plane, 2,2,2) for l in geometryList]).
Spheres=IN[0]
Centers=IN[1]
outlist=[]
for Sphere, Center in zip(Spheres,Centers):
scaledsphere = Geometry.Scale(Sphere,Center,0.5,0.5,0.5)
outlist.append(scaledsphere)
OUT = outlist
happy to help
You can try getting your original solid’s centroid and set the Transform’s origin to it before creating the transformed version.
edit: Now I saw that you have done that
I can´t get it to work
It seems like this transforming is happening in a different coordinatesystem, because when i use the transform.origin method the new solid is landing far away.
The transform basis property says:
Defines the basis of the old coordinate system in the new coordinate system."
So maybe i dont have to only set the origin but also the coordinatesystem basis?
I tried my luck, but dont understand whats this index is about:
t = Transform.Identity
t = t.Basis(0, center)
t = t.ScaleBasis(2)
scaled = SolidUtils.CreateTransformed(x, t)
I also tried the scale.BasisAndOrigin Method but that didn´t help.
By making a second transform and creating another copy of my solid i managed to set an origin and now the solid won´t jump around anymore. But it is placed at 0,0,0 and i can´t get it to the position of the original solid…
x = UnwrapElement(IN[0])
t = Transform.Identity
t = t.ScaleBasis(4)
scale = SolidUtils.CreateTransformed(x, t)
y=scale.ComputeCentroid()
xvalue = -y.X
yvalue = -y.Y
zvalue = -y.Z
z = Transform.Identity
z.Origin = XYZ(xvalue,yvalue,zvalue)
scale2 = SolidUtils.CreateTransformed(scale, z)
OUT = scale2