Dear colleagues!
The MEP side needs a LOT of attention in dynamo! MEP is not only about spaces and parameters and Revit is not only about form-finding!
Dynamo needs access to connectors! Dynamo needs access to manipulating pipes (ducts) directly – creating, connecting, disconnecting, creating fittings etc.
These are the keys to bring Revit on a new MEP level – it opens up a whole lot of new possibilities for people who are working with the MEP side of Revit.
Could anyone fluid enough in Python look into accessing connectors, pipes etc. in the API?
I have tried, but my API and Python skills are non-existant and absolutely no time to research these things.
Best regards, Michail
2 Likes
Michail,
Is that a job posting? I can send you my credentials and salary requirements if you are interested.
3 Likes
Konrad
I appreciate your point, but for someone like you, it would take maybe one hour to get something useful from API. For me it would take weeks to get something useful, which I gladly would spend if I had the possibility. There are a lot of helping going on in this forum – some of this time could be diverted to expanding the Dynamo toolbox, which is rather more effective in the long run.
With this post I hope to turn peoples attention more to the MEP side of Revit.
Regards
Everyone starts somewhere. Please show some effort, ask smart questions and I am sure that people around here will help you with your MEP problems just like they would with geometry related ones. I don’t see a reason why you have to perform this ritual of pouting and foot stomping “because no one is working on YOUR problems”. Please, start a new thread with an actual question. It will get you further than what you are doing here. I promise.
2 Likes
Konrad
You misunderstand. I am merely trying to attract attention to an underdeveloped area of Dynamo.
A specific question: How to access ConnectorManager and ConnectorSets with Python of a selected element?
Regards
Easy,
You can use this as a base and try the ConnectorSets yourself. It will be a good practice.
3 Likes
Thank you! Very interesting!
Konrad
I am using ConnectorManager.Connectors to call connectors but am getting ConnectorSets… how to get to Connectors?
Konrad Thank you very much. You showed me in the right direction and I finally figured out how to get to this information in the Connectors.
1 Like
Any idea on how to build a list of lists in the for loop? I am doing it in a very awkward way, I think.
result = []
origin = []
try:
errorReport = None
conset = ProcessList(GetManager, curves)
for i in conset:
result.append(origin)
origin = []
for k in i:
origin.append(k.Origin)
Couple of things:
Look for something called “Dynamo- Python migration to 0.7.0”. It’s an old post on Dynamo website about how to wrap and unwrap geometry from Revit to Design Script and back. You need to convert these points from Revit’s XYZ() to Dynamo’s Point.ByCoordinates()
Also, I am not sure what you mean by building a list of lists. Can you include a desired output?
Konrad
Thanks for pointing to the migration guide – made it a lot easier to convert XYZ to Points.
And I figured out how to apply a function to a list of lists in a better way.
def ProcessList(_func, _list):
return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )
def Unwrap(item):
return UnwrapElement(item)
def GetCons(item):
return item.ConnectorManager.Connectors
def GetData(item):
return item.Origin.ToPoint()
if isinstance(IN[0], list):
items = ProcessList(Unwrap, IN[0])
else:
items = [Unwrap(IN[0])]
output = []
try:
errorReport = None
conset = ProcessList(GetCons, items)
for i in conset:
output.append(ProcessList(GetData, i))
Looks like, after all it didn’t take months of research and some impossible Python gymnastics. Like I said originally, all it takes is some effort, and asking right questions. The more you try and fail, the more you learn and sooner or later you will be the go to Dynamo + MEP guy.
1 Like
Thanks Konrad,
Thats exactly how it is, although I already asked this question once and it was ignored, so I had to make a more attention grabbing post to actually get someones attention. Thanks again!
Hi Michail and Konrad,
First of all, thanks a lot for this post. I really believe this is what Revit MEP will be able to do in a short period of time, automatization of routing and connection of ducts, pipes, electrical conduits etc. This is really exciting to me and that’s why I started to learn more dynamo and phyton focusing in the MEP side mostly:) Right now this is what I’m working on:
*Figure 1: Working flow scenario
As you can see in Figure 1, I’m trying to connect some ducts where the end point of a duct overlap with the starting point of the next, except the duct which is in the middle of this small layout of ducts. So if the ducts are connected should look like the right side of this image. My first approach has been to find the coordinates of the ducts connectors (following the same method that you did here) to afterwards trying to connect them to the closest connector or duct instances as it works in revit, so the duct fitting can be placed according the routing preferences of our ducts. In order to avoid duct connectors that we don’t really want to get connected to any other duct like in Figure1, my idea was to constraint these connection process by a numerical tolerance. So if the distance from one connector to the closest connector or duct is to big, the condition is false and the connection will not be executed.
However unfortunately, I got stuck in the first step of getting the coordinates of the ducts connectors as it is seen in Figure 2. In the second python script, I got the following error: "AtributeError: ‘ConectorManager’ object has not attribute. I don’t know what the problem can be since my phyton and revit API skills are not really high.
*Figure 2: Dynamo workflow.
Also, I don’t really know once that I will get the coordinates of the ducts connectors, if is possible and feasible to script the workflow that I described before. That’s why, I would really appreciate some suggestions or help if you are really interested in finding a solution to this workflow as same as me
Furthermore, I would like to mention as well that I thought in a second approach completely different for this workflow for connection of ducts. My other idea was to try connecting the ducts by triming them one to another as you can do whithin revit. So the ducts can be connected and the duct fitting is placed automatically as well. However, I couldn’t find any node that it could help me with this idea.
Looking forward of hearing from you and keep learning more about this exciting tool.
Thanks in advanced.
1 Like
Hi Alejandro, I think we are on the same idea
I try to collocate a fitting in duct end with coordinates that I know, but I don’t undestand how does it work dynamo with duct/pipe fittings.
Dynamo collocate the fitting in the point, but the elements don’t connect. The connectors don´t work.
I try to work with the script to Konrad and Michail, but script origin don’t run.
I’m absolutely convinced that dynamo, Revit and the forum are a powerful tool.
Thanks for all
Hi everyone,
I’ve been trying to find a method to connect ducts as I explained before in my post here. However I haven’t succeeded yet.
So far, I’m still stuck in getting the connectors from the ConnectorSets but Michail seems to have succeeded This is the error that I got with my python script:
Moreover, I found in this link (https://github.com/jeremytammik/tbc/blob/16b26ab1f0c4641a11ee3e9a49adac0c7ab3b447/a/0366_cable_tray_fitting.htm) in line 219 what could be the next step for make the connection of ducts works by using dynamo. Basically this script written in C# what it does is to hook up the duct connectors between each others by using the following call: m_document.Create.NewElbowFitting(connectors[2], baseConn2)
Also it’s mentioned in this source that “The duct connectors are retrieved through their MEPSystem property and its connector manager, which returns the connector set” This is basically with Michail has done. So as you can see in theory it could be possible to connect mep objects by using dynamo
Does anyone know what I’m doing wrong in my python script for getting the connectors and how afterwards could be implemented this C# code into phyton to connect the duct connectors by creating a new elbow fitting?
Thanks a lot in advanced. I’m sure that this forum and dynamo is capable to achieve this approach.
Best regards,
Alejandro
Hi guys,
I’m trying to connect 2 connectors located in the same position by using the “Connector.ConnectTo Method” from revit API. (http://revitapisearch.com/html/04ee99c9-f411-aabe-7b87-013a6f9adb1d.htm)
So far my python script looks like this below, however is not working in “line 33”
Probably I haven’t defined correctly the definition of this method into python because I wasn’t sure how to translate from c# to python the syntax example from the revit API.
Thanks in advanced. I would really appreciate some help Best regards,
1 Like
This is interesting… I think being able to create connected, working systems with dynamo will open up a lot o possibilities. Theres lots of other potentially useful methods in the API like make T/Elbow and all the placeholder stuff. Looks like the connectors dont even need to be on the same point, just in the same plane and Revit will do the rest. Im also not so good with Python but I think you probably need to unwrap the connector inputs and if you are inputting a list you need a loop to process all the items. I usually start by copying a well structured example (Like the get connectors one above) and then modifying the functions with the method I want, saves having to learn how to invent the wheel myself :P) Good luck, I am going to try and get this working as well.
Hi @Alejandro_Mata, I’ve seen your presentation at AU2016 and follow this thread for a while. Have you managed to do the task? I’ve been trying around the same idea of just “triming” the pipes between each other but with no results.
Any help will be appreciated.
Thanks in advance!