Geometry.Transform node in python and Revit API.?

Hi All,
How to implement Geometry.Transform node in python and Revit API.
image

Can you tell us what you’re trying to do here? This likely isn’t the path you need to be going down. Revit has very few actual geometry classes and this node is not a Revit node.

1 Like

I want to apply transform of a revit link to gemetry of a space that I am selecting from model.
see this image.

Ok, a few things… the geometry of an element is driven by the element. So you you can’t just modify the geometry. You have to modify the element. Spaces in particular are boundary driven, so you can’t just move a space either, you have to redefine it’s boundaries.

Again, we need more (specific) information about what you have and what you’re trying to accomplish. Is this just an issue with linked coordinates? That’s something completely different but potentially more straight forward.

I am trying to find clashes (Using ElementIntersectsSolidFilter ) between spaces in current model and doors in linked model.So If the linked model is not in its orgin to orgin position,then it will not give correct results.In order to solve this issue I believe we need to transform geometry of solid to link Model’s co-ordinate system.
I think the below method will work for creating a new transformed solid.
image
I will try this and update.Hope its clear now.

1 Like

@Nick_Boyts
Above method to transform the solid is working.but the door location is still in orgin to orgin location.
Is there any way to apply transform to doors and then do the clash detection?.


blue dots represent the location of doors when linked using orgin to orgin.

I think you went about it backwards. You would most likely want to move the linked objects to match the current model’s coordinates since that’s the coordinate system you would be using when marking clashes or making changes to the active model.

2 Likes

how can we do that?.
location 1 is the orgin to orgin location of link.
location 2 : location after manually moving the link.
when I run the script by keeping the link in location 2 revit API will still keep the door location in Location 1.
So the space solid will not intersect with any of the doors.

what I am asking is that how can we overcome the issue mentioned in the aove video.If its a point we can apply tranform to that point.but if its an element what can we do?

As I said, you cannot apply a transform to the element, only the representative (Dynamo) geometry. Revit reads the linked elements location based off the origin, but the link instance itself has a transform property. You can get the transform of the instance and use that to determine the new location of the elements.

This and other similar topics might be helpful. Linked Element geometry not in the correct place - #2 by Kulkul

1 Like

@Nick_Boyts is right, transforming the link instance wont help as the linked elements are always positioned in their origin-to-origin location in the Revit API context irrespective of any transformation made to their link instance owner.

You’re on the right track; extract the geometry from the linked element then use SolidUtils.CreateTransformed with the transform from the link instance and use the ElementIntersectsSolidFilter to find intersections. There are no other options. And steer clear of Dynamo’s ProtoGoemetry library from this as it will destroy performance; once you start making calls to the Revit API, stay there.

3 Likes

yes.we can get the new location of the elements.but location is not enough for clash detection.That’s where I am struggling.Is there any way to do clash detection between solids?

how can we use ElementIntersectsSolidFilter to do clash detection between two solids( say solid of space and door)?

If you mean between two Revit API solids no. You can only emulate it using BooleanOperationsUtils.ExecuteBooleanOperation() and then evaluate the result.

1 Like

I am not familiar with this method.Could you please explain more.
say I have two solid extracted using Element.Geometry as shown below.


Can we use BooleanOperationsUtils.ExecuteBooleanOperation() to find whether they are clashing.
If yes can you please write it in Python.?

  1. Read the Python primer it explains all the conversion methods between ProtoGeometry and Revit API geometry.
  2. BooleanOperationsUtils is explained on revitapi.docs..

The rest is up to you.

Thanks.I will go though it.

Any reason this isn’t possible?

  1. Geometry of an element can be queried in native Revit (assumed this is established) and kept in memory relative to it’s internal origin of the file.

  2. The link instance’s transform can be pulled via GetTotalTransform Method

  3. That geometry can be manipulated relative to the link instance’s transform via GetInstanceGeometry Method (Transform)

  4. The transformed geometry (still existing only in memory), can then be used for an ElementIntersects filter via ElementIntersectsFilter Class

  5. That filter can be applied to a filtered element collector to ensure you’re looking only at linked instances within an exhausting set

I get that this may not be efficient (the volume. of content in memory is concerning), but think it could be done…

1 Like

Another approach (for each door)
1/ get the location point of the door in the linked model
2/ make 2 new points on each side of the door, with the host wall direction (CrossProduct with Z and -Z)
3/ transform these 2 points with the inverse of the transformation of the link model
4/ find local space(s) from points with IsPointInSpace method

Thanks.Will try and update here.