PDA

View Full Version : How does Instance.Transformed work?



Revitator
2007-05-30, 08:31 AM
Hi. This will be one of those obvious questions, but here goes:

How do you get the transformed geometry of an Instance geometry object? I can see that the Instance class has SymbolGeometry, Transform, and Transformed properties. I had thought that you'd use the Transformed property (passing in the Transform property as the argument), and then extract the transformed SymbolGeometry from the result. But that doesn't seem to do the trick. Here's the code:

Public Shared Sub ParseInstance(ByVal myInstance As Autodesk.Revit.Geometry.Instance, ByVal myColor As Autodesk.Revit.Color)
Debug.Print("==ParseInstance")
PrintTransform(myInstance.Transform)

Dim myInstanceTransformed As Autodesk.Revit.Geometry.Instance = myInstance.Transformed(myInstance.Transform)
Dim myElementTransformed As Autodesk.Revit.Geometry.Element = myInstanceTransformed.SymbolGeometry
Dim myElement As Autodesk.Revit.Geometry.Element = myInstance.SymbolGeometry

ParseElement(myElementTransformed)
Debug.Print("==End ParseInstance")
End Sub

You can see that I have a PrintTransform method that just debug.prints the properties(basis and origin) of the Transform, so I can see that the Transform isn't just an identity transform. But is seems at though the geometry in myElementTransformed is identical to that in myElement.

I'm obviously missing something: I'd welcome any clues, or even a pointer to a working example?

Revitator
2007-06-07, 10:25 AM
I never did figure out how Instance.Transformed works.

My workaround was to parse out the underlying geometry, and directly transform the individual vertices using the instance's Transform (using code similar to that in Mathtools.cs (PathReinforcement sample) and GeomUtil.cs (Reinforcement sample).

Hope that helps someone.