Find Intersection Points Between Mesh and Solid

Hi there,

Want to find the Solid.Centroid points for MEP pipes and walls. The pipes placed in the project as MEP fabrication elements are converted as mesh geometry using Element.Geometry node. This throws up an error while using Geometry.Intersect node. The screenshot added below for reference.

I tried @Joelmick 's method to convert mesh to solid, which is fabulously explained here on this post.

Unfortunately, this does not help me as for some reason, the new generated solids from the mesh gives XYZ as (0,0,0) screenshot attached below.

BiMorph nodes for checking intersection also fails to create result when MEP fabrication elements are involved.

Any suggestions are highly appreciated. Any solution type (dynamo nodes/ python code) is fine.

Hello,
you have two identical IDs in the first list,

check if your Mesh is closed maybe, the property exposed here must concern this state (but not absolutely certain)

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

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

import System
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument

Mesh_dyn=IN[0]
M_rvt=Mesh_dyn.ToRevitType()
M_is_close=M_rvt[0].IsClosed
OUT = M_rvt,M_is_close

the class used
Cordially
christian.stan

Hi @christian.stan,

Thank you for your response. It is probably one of the reason that because this specific MEP fabrication element is a pipe, it is not a closed mesh. I tried your code, thank you for that. I am still trying to convert the MEP fabrication pipe from mesh to solid and place this solid at the original position of the MEP pipe to run Geometry.Intersect node.

@GavinCrump Did mention in some posts on the forum about mesh elements being not so friendly in Dynamo when compared with Grasshopper or Rhino.

Makes me wonder what am try is possible or just an end dead?

1 Like

Hello, I’m not very familiar with this MEP pipe aspect, but don’t you rather convert (the geometry of the type, this one is well set to 0) than the instance?
I tried to support my words by making the parallel with columns


I don’t know if that will help you.
cordially
christian.stan

1 Like

Hi @christian.stan,

I am grateful for your interest in the query. Much appreciated and yes, you are correct. The thing is, the MEP fabrication families are often ‘mesh’ based not ‘solid’. So when I use Element.Geometry it give me a mesh element (screenshot attached above). This mesh element cannot be run with Geometry.Intersect node (I don’t know why), Geometry.Intersect works with solids. Hence, the problem of not being able to adequately convert mesh to solid.

Regards,

@H.S

1 Like

I have a different way of finding solution:

  1. Take both planes of wall
  2. Take geometry of pipe
  3. Convert it to Mesh (if solid, if not keep mesh)
  4. Intersect Mesh with plane (MeshToolkit)
  5. Get outer profile at both planes
  6. Extrude profiles to get solid
  7. Get centroid

It should be even faster than some geometry intersections. Haven’t tested it, but by logic it should work well.

2 Likes

Hello, smart, thank you for your feedback.

cordially
christian.stan

1 Like

After all the suggestions above and going through mutliple relevant posts on the forum the solution: Convert the mesh element to surface using Mesh.Faceindices and Mesh.VertexPositions and finally connect it to the PolyCurve.ByPoints. This will create a surface element which can then be connected to Solid.ByJoinedSurfaces.