ElementTransformUtils vs Transform

ElementTransformUtils vs Transform

richyjohn
Observer Observer
1,179 Views
5 Replies
Message 1 of 6

ElementTransformUtils vs Transform

richyjohn
Observer
Observer

Hi,

 

What is the difference between ElementTransformUtils.MoveElement/RotateElement and Transform.CreateTranslation/CreateRotation?

 

and how to apply transform to family instance?

 

In which situation should Transform class be used?

1,180 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni

I will not be able to provide a complete exhaustive explanation. That would require a complete blog post, if not a book. I suggest you read about these topics in the existing documentation, e.g., the Revit developers guide in the online help:

  

https://help.autodesk.com/view/RVT/2023/ENU/?guid=Revit_API_Revit_API_Developers_Guide_html

  

Still, here is a brief explanation:

  

The Transform class represents an abstract geometrical entity, a transformation of the affine 3-space:

  

https://www.revitapidocs.com/2023/58dd01c8-b3fc-7142-e4f3-c524079a282d.htm

  

So, it has little to do with the real world, or the BIM that represents a real-world building.

  

The ElementTransformUtils class provides a collection of utilities allowing transformation of Revit database elements (e.g. move, rotate, mirror and copy):

  

https://www.revitapidocs.com/2023/82e737d5-fda4-bc10-6099-88999cd51300.htm

  

As such, it operates on BIM elements representing real-world objects, and thus is limited in its range of transformations to operations that make sense for a real-world object.

  

For instance, scaling makes no sense for most family instances, since that would change their dimensions and thus require a different family type.

  

I hope this helps.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 6

Yien_Chao
Advisor
Advisor

if you want to apply on a instance, just use ElementTransformUtils

 

check all the methods here : https://www.revitapidocs.com/2020.1/781ad017-5ee5-f44b-5db2-e8e1f883ae5d.htm

0 Likes
Message 4 of 6

richyjohn
Observer
Observer

Hi,

Thank you.

I understood ElementTransformUtils class.

If transform has little to do with the real world, or the BIM that represents a real-world building , then , where are we actually using it?

Don't we use transform class to modify elements present in the project?

I understood your scaling example, but to understand the difference better, do you have any other example?

Thank you @Yien_Chao  for the link.It was helpful.

Sorry, I am trying to understand how transform is different from ElementTransformUtils class.

Message 5 of 6

jeremy_tammik
Alumni
Alumni

Have you read up on this topic in the developer's guide? If not, please do. Afterwards, we can talk further. Maybe you can explain it to us. Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 6

mhannonQ65N2
Collaborator
Collaborator

I am not aware of any way to directly apply a Transform object (even if it isn't a scale) to an element.

However, it is possible to get a Transform object from an element. This Transform object describes the element's local coordinates, and you can use it to determine how other elements are positioned relative to it (e.g., the wall-light is 3 feet to the left of the door). You can also use Transform objects to do various other geometric calculations.

 

The Transform vs. ElementTransformUtils comparison is somewhat similar to Curve vs. ModelCurve. The former are used to do geometric calculations and the latter are used to make actual changes to the model.

0 Likes