MEP.Fittingbypointsandcurve - Multiple intersections of 1 duct + others

Hi All,

I’m sure some of you have been down this road before, and if the life of me i thought i saw this somewhere previously so apologies if it doubles up but.

I have been exploring the use of the MEP.Fittingbypointsandcurve node for mechanical service (ie placing void families to help structure & architectural trades)

I have gotten it to work for me for the most part but i am struggling to identify the issue that i am currently having.

TEST 1
-If 1 duct intersects the identified linked element catagory at one point it places the damper correctly.

TEST 2
-If 1 duct intersects the identified linked element catagory at two points it places the dampers but incorrectly places ducting (causing unconnected and incorrect ducting)

TEST 3
-if 1 duct intersects the identified linked element at two points and also there is any other ducts in the project intersecting other points i get a big ol mess of ducting everwhere.

i understand that i am a super noob here but please believe me when i say i have tried to find this answer elsewhere for the past 3 weeks and this really is my last avenue.

I have uploaded the files and families for you to pick apart :frowning:

xxxMH_Damper.rfa (324 KB)
SHARED STRUC.rvt (1.9 MB)
HOST MECH.rvt (492 KB)
DYNAMO WORKFLOW.dyn (61.5 KB)

did you get all intersection point on the same duct and group them together?? basically your intersection points should be grouped by duct curve, it should work all in all

you should have something like this



test.dyn (20.3 KB)
whereby the list of points are in of the same structure to number of ducts

1 Like

Ah Boom!

You. Are. A. Legend!

I Will mark as solved but when testing on a scaled project i had some trouble with this.
for which i will create another topic. for clarity here.

Did you try on a smaller scale project first? i think i know where is your issue, you might need to transform the solids first before creating it.

Yea, My test project came out great. but in fairness it was very small scale. (Picture for Reference)

The Structural Element is a linked model.

In the Larger scale test i took the structure from an entire building and drew 1 duct passing through several beams.
The thought being that if it worked there, that it would be a case of waiting a bit longer for it to load if i had more penetrations ect…

So ah… Whatchu mean transform the solids?

Having a quick try at that (placing Directshape.ByGeometry Node between Element.Geometry & List.Flatten) Yields nothing, Clearly i am misunderstanding here?

for your testing proj, is the structural model a link file as well??

Indeed it is.

okay… then are you familiar with python and revit api?? because if you are, i can direct you to the relevant codes and methodology needed.
I do not know how to translate it in dynamo nodes :smiley:

actually this graph works too, just need to clean away the empty list at Geometry.Intersect, can i see the result of the remaining half of the dynamo graph?

the warnings are not stopping the runs so technically it should work.

Certainly, ill just load the badboy up and crack a whip.

EDIT Graph Below

If it helps, here is a snip of my other screen after running the program.

well, the data structure is wrong for your case, try adding a list.filterbybool mask to remove the empty list for both the points and ducts. then feed it back in again.


EDIT: see picture for example

Ah geez…List.isEmpty.

You know how long a googled to find something that i could combine with a FilterbyBoolMask to rid myself of pesky empty list whilst maintaining list structure. oh my.

Sir. If you ever find yourself in New Zealand…

And per your previous comment about API and python, i have starting using the following resources to further my thirst for knowledge, but i am oh so new.
-Headfirst Python
-Edx

Also, after all our hard work, this is the result :rofl: i feel like i am back at step 1 :upside_down_face:

Perfect graph inputs with no outputs on the graph side & back to test 3 scenario from original post.

HAHAHA. FOL, but the rewards of having a desired output is describable.

let me try to whip up something for you tomorrow.

hello there @pyXam, hope you had a goodnight rest thinking about the possible cause of this. I myself had come out something for you, and you can further develop it yourself :slight_smile:

basically the workflow is like this:
image

and the results will look like what you need:
image

whereby the python script is used to generate points on the intersection. Here is the code of the python script:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import ToProtoType, ToRevitType geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

# Import DSCore nodes in Dynamo
clr.AddReference('DSCoreNodes')
import DSCore
from DSCore import *

# Import python library
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import os
import shutil
import math
# Import math library
from math import *

#Import Data and Time
from datetime import datetime
now = datetime.now()

#Import System Library
import System
from System.Collections.Generic import *
from System.IO import Directory, Path

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

def ToList(x):
	if isinstance(x,list):return UnwrapElement(x)
	else: return [UnwrapElement(x)]

linkfile = next(iter(ToList(IN[0])), None)
#get elements of multicategories
multiCat = List[BuiltInCategory]()
multiCat.Add(BuiltInCategory.OST_StructuralFraming)
#multiCat.Add(BuiltInCategory.OST_Floors)
multi_Catfilter = ElementMulticategoryFilter(multiCat)
multi_CatEles = FilteredElementCollector(linkfile.GetLinkDocument()).WherePasses(multi_Catfilter).WhereElementIsNotElementType().ToElementIds()
transform = linkfile.GetTransform()

ducts = ToList(IN[1])
ductIds = [p.Id for p in ducts]
ductIDS = List[ElementId](ductIds)

TransactionManager.Instance.EnsureInTransaction(doc)
newlist = []
for duct in ducts:
	templist = []
	IntSolidEle = []
	newsolid = next(iter(duct.get_Geometry(Options())), None)
	if not transform.AlmostEqual(Transform.Identity) : newsolid = SolidUtils.CreateTransformed(newsolid, transform.Inverse )
	IntSolidfilter = ElementIntersectsSolidFilter(newsolid)
	IntSolidEles = FilteredElementCollector(linkfile.GetLinkDocument()).WherePasses(IntSolidfilter).ToElements()
	IntSolidCurve = duct.Location.Curve
	for IntSolidEle in IntSolidEles: 
		link_solid = next(iter(IntSolidEle.get_Geometry(Options())), None)
		link_curve = IntSolidEle.Location.Curve
		IntPoint = IntSolidCurve.Project(link_curve.GetEndPoint(0)).XYZPoint
		templist.append(IntPoint.ToPoint())		
	newlist.append(templist)
TransactionManager.Instance.TransactionTaskDone()

OUT = newlist  

It should work as per your case now. I think the reason why it didnt work is because the points obtained using the solid centroid is not lying on the duct. Thats why you are having the issue. Of course you can add a few more nodes to query the parameter on the duct but it will be just like solving a problem to create another problem. So thats not efficient at all. Lets try that and see if it works for your case.

1 Like

Thanks! i was thinking about it but i thought it was having issues re-grouping the ducts in relation to the points.

EDIT*

I Applied all the principles from the previous lessons and managed to get it to work.
Now…to begin to understand the principles of python and unleash the power!!!

Thank you very much good sir!

sorry i had case similar than above the point i need to split element (Duct, Pipe) clashing or intersect with walls at this part is ok but when i am trying to place the MEP fitting it gives me error in Revit that element will be disconnected and moved for different location is there solution or reason for that.

Note: Its only pure MEP Model so i need to divide as per planning Zoning so i create Filled region and place walls based on the Filled Region Boundary with Thin Thickness to have more accuracy when placing the MEP Union and the rest as per the script but have that issue hope you can help

If i want to use the same case between Duct or Pipe vs Walls but all are live in the Model how i can use the same Python Script in my Case to avoid the disconnect of elements.

I think at some point i had this problem and found it to be an error in the family i has using.
By not allowing it to have instance parameters controlling the dimensions it messed up the flexibility of the insertion. If not that perhaps you could try attaching the script and family you are using so we can help further.