Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetTransform() does not include reflection into the transformation

6 REPLIES 6
Reply
Message 1 of 7
ABertzouanis9F98Y
594 Views, 6 Replies

GetTransform() does not include reflection into the transformation

Instance.GetTransform() method..

https://www.revitapidocs.com/2015/50aa275d-031e-ce19-9cfd-18a7a341ed19.htm

..does not include reflection (the family mirrored property https://www.revitapidocs.com/2015/20ab2f32-e3ca-8173-aac3-a03e998fd0ab.htm) into its transformation. Below a family instance which is mirrored and outputs the equivalent GetTansform() values..

 

 

Transformation Matrix2.PNG

 

Here is the python code:

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
data= UnwrapElement(IN[0])

output=[]
for i in data:
	output.append(i.Location.Point)
	output.append(i.GetTransform().BasisX)
	output.append(i.GetTransform().BasisY)
	output.append(i.GetTransform().BasisZ)
	output.append("")
OUT = output

 

 

6 REPLIES 6
Message 2 of 7

Yes, true. Afaik, that is expected and intentional.

 

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

@jeremy_tammik many thanks for your answer.

However, from a mathematical perspective it should not be expected. Below wikipedia's article that very clearly shows that element which is reflected on the x axis should have a different transformation matrix.

Transformation matrix - Wikipedia 

transformation Matrix3.PNG

 

Can you please share any explanation and why this intentional for Revit? Any link or further documentation would be much appreciated.

Regards,

Message 4 of 7

I found results that indicate Revit uses a combination of reflection and rotation for the various operations.

 

210524a.PNG

 

One thing that stands out is the difference between horizontal double flip control and mirror command about same axis (noted red). These operations are almost identical apart from the horizontal one that results in opposite facing and handed state. Graphically it appears the same but not according to facing/handed orientation.

 

It has been noted previously that single flip control is more like rotating rather than mirroring (it doesn't result in reflected geometry). We see by transform that it is reflected but facing/handed state is also set to true.

 

Generally I think of the facing/handed state as being an internal to the family state i.e. the internal geometry may be reflected but the family itself isn't (unless it is by transform).

 

You probably need to look at flip state/rotation and transform to get a definitive idea of the situation. These controls long ago I believe were introduced for doors, which side they are hung and swing direction. As they started being used for other things the ambiguities crept in i.e. double negative (same ultimate representation but two definitions for it).

Message 5 of 7
jeremy_tammik
in reply to: RPTHOMAS108

Thank you very much for this careful analysis and detailed explanation.

 

I added it to the blog for posterity and easier lookup, with several other recent answers of yours as well:

 

https://thebuildingcoder.typepad.com/blog/2021/05/flip-mirror-transform-and-transient-graphics.html

 

I wish I were able to provide the same depth and quality that your answers have!

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 6 of 7
RPTHOMAS108
in reply to: jeremy_tammik

Thanks Jeremy that means a lot coming from you.

 

I think everyone has probably fallen foul of these geometric aspects at some point. I recall we had a pile cap with four piles and we marked one of the corners so that we could identify the edges numerically in a clockwise order around this square cap (which had double symmetry). The idea was that we would have a table of parameters which noted the edge distances (edge of cap to edge of pile). What we didn't count on was the fact sometimes people mirrored these caps, so although the corner marker flipped from one side to the other as expected the numbering of edges was no longer clockwise. So numbered edge distances in table didn't correspond with what was counted clockwise from corner marker.

 

The question is why would someone mirror a symmetrical object? The answer was that this cap was one of many and there was a line of symmetry across the site. Therefore, they had filled half the site with pile caps and mirrored them for completion (perfectly acceptable). An important lesson from this is that the flip state of the symmetrical object was a hidden feature with subtle implications (when identifying parametric relationships).

Message 7 of 7
jeremy_tammik
in reply to: RPTHOMAS108

Wow, that is a very cool and chilling example. I added it to the post right away. That is the kind of experience that is really useful and hard to come by; all too often painfully.

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community