I would like to receive the middlepoint of a wall or other element (to tag).
When I search for the middle I receive the middlepoint of the whole element.
I would like to receive the middle of only the part that is visible.
Thank you, between 2 messages I searched a little in the API
I was thinking of working in a system coordinate linked to the exterior face and using a recurring function (not my strong point at all) to divide the solid with the Geometry.Split node
It’s the complexity of the steps involved for something which ought to be simple that is a loser. Then again, without that complexity we wouldn’t be able to do a lot of what we take for granted.
import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import Wall,HostObjectUtils,ShellLayerType,UV
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
def accumu(lis):
total = 0
for x in lis:
total += x
yield total
wall=UnwrapElement(IN[0])
walltype=wall.WallType
cs=walltype.GetCompoundStructure()
ref=HostObjectUtils.GetSideFaces(wall,ShellLayerType.Exterior)
doc=wall.Document
faces=wall.GetGeometryObjectFromReference(ref[0])
ep=[0]
ep.extend(cs.GetWidth(i)*0.3048 for i in range(cs.LayerCount-1))
epc=list(accumu(ep))
OUT =faces.ToProtoType(),faces.ComputeNormal(UV()).Negate().ToVector(),epc
Script 2
import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import Element,Solid,Options
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
VT=UnwrapElement(IN[0])
doc=VT[0].Document
sol = []
options = Options()
options.ComputeReferences = True
def solidrech(v):
geoElement = v.get_Geometry(options)
for obj in geoElement:
return obj.GetInstanceGeometry()
OUT = [solidrech(v) for v in VT]
script 3
import sys
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import Solid,BooleanOperationsUtils,BooleanOperationsType
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
VT=UnwrapElement(IN[0])
OUT = [BooleanOperationsUtils.ExecuteBooleanOperation(VT[0],VT[i], BooleanOperationsType.Intersect).ToProtoType() for i in range(1,len(VT))]