I am always happy to take a look at a real MEP issue, so this case caught my eye and prompted me to sit down and do some actual coding again for a change:
Question: How can I programmatically move the join of two ducts, effectively changing their end points?
I do not want to delete and re-enter them because they will normally be connected at the other end as well.
Answer: In general, when working on programmatic manipulation of duct system geometry, you have two options for driving the desired changes:
Define the ducts, and let Revit automatically insert the required fittings when you ask them to be connected.
Define the fittings, and let Revit automatically create the required ducts when you ask them to be connected.
This issue is a little bit different, in that all the required components are already present, and you just want to move them around relatively to another.
I took a look at it and implemented an add-in named MoveDuctJoin defining two separate external commands, because they illustrate the different options so clearly:
- CmdDisconnect – this command just moves one duct connector, so the link to the neighbouring duct is broken, causing a disconnect.
- CmdReconnect – this command moves the fitting between the two ducts. That keeps the system connected.
There's a lot more information available on The Building Coder blog.
This add-in may be downloaded from the Move Duct Join GitHub repository. Or download it with this direct download link.