Fabrication Valves in Space Location Schedule

Trying to find a way to schedule pipe valves in the corresponding spaces that they are placed in. I’m also using fabrication parts. The problem is that the valves are in the MEP Fabrication Pipework category. That category also includes the pipe, fittings and accessories. I was able to select the elements that are need in the schedule (Valves) by using Select Model Elements. The script attached works when its Pipe Accessories but not MEP Pipework. Any ideas on how to get fabrication parts to schedule in the spaces they are located in?

SELECTED ELEMENT TO SPACE LOCATION.dyn (40.1 KB)

There is a GetSpaceAtPoint Method (XYZ) Revit API method

https://www.revitapidocs.com/2020/73543682-0f14-1b49-a881-d694aa17192b.htm

1 Like

that doesn’t help. I’m looking to make the script work.

Since they don’t have locations I think you will need to get some part of their geometry, and pull a point from that. Try Element.Curves, and if that works List.FirstItem and then Curve.PointAtParameter. If that doesn’t work Element.Faces, List.FirstItem, Surface.PointAtParameter.

With either of the points, the API call noted above will be the best way to pull the associated space.

how do I work the API GetSpaceAtPoint into the script

That’s a bigger dive into Python and the Revit API. Look into the various primers and review source codes from similar documents, and let us know where you get. If you’re still stuck on Friday I’ll try and push something out but I’m too booked up to take on such a coding issue earlier in the week.

I was able to get the valves to get the location but the location is wrong. how can we get the right space

VALVE LOCATIONS.dyn (27.5 KB)