Access Transform of a DirectShape

Access Transform of a DirectShape

thomas.hain
Explorer Explorer
314 Views
3 Replies
Message 1 of 4

Access Transform of a DirectShape

thomas.hain
Explorer
Explorer

I've used DirectShape to create custom Mesh Geometry. DirectShape.Location allows to move and rotate. But you cant read the transformation back if the user placed that shape. This Location is not a LocationPoint.

According to this post:

 

https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/td-p/...

 

I've used the DirectShapeLibrary to create Instances of a DirectShapeType. This gives a GeometryInstance with a nice Transform property. Unfortunately the property is readonly. Would be nice to modify it without the restriction to Move and Rotate around one axis as above.

Another posibility to write Transform is Mesh.get_Transformed() and set it back Mesh.SetShape(). It is also the only way I've found to apply a "free" (non conformal) Transform, which is needed in my case e.g. to strech geometry. But you loose Transform info. Transform of the GeometryInstance is something different.

 

Is there a more consistent way to set/get Transform of a DirectShape? Am I missing something?

 

Cheers, Tom

0 Likes
315 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Free non-conformal transformations are not supported by the Revit API, because they might easily violate and corrupt the BIM. Similarly, you cannot simply scale a wall to increase its thickness. Instead, you apply a new wall type to it. This corresponds to the real world: you cannot easily scale a brick to change its size, or apply a non-conformal transform. Instead, you go off and buy a different brick to suit your purposes.

   

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

thomas.hain
Explorer
Explorer

Thank you Jeremy. Those physical restrictions make sense in BIM or CAD.

What I want to achieve is to visualize geometry from a custom external tool. I want to retain the structure, which is basically meshes with arbitrary matrices.
This woul'd make it easy to update only transforms that change external. Also the data coul'd be exported back without hurt.

It seems I have to recreate the meshes with transformed vertices each time. And the original transform needs to be stored separate somehow.

Just wanted to ask if there is something helpfull within the rich API I don't know yet.

0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni

Thank you Thomas for your understanding. Yes, I completely see your point. Unfortunately, the Revit API is not all that rich after all, and I am not aware of any easier solution than to recreate the meshes appropriately when needed.

   

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