Overlooking the error (as always)

Hi guys,

I keep running into an error with this script and i can’t find the problem.
-some background
I’m working on a parking, where all floor are heavily edited with extra points
I created some Electrical Fixtures (2200) from a DWG file and placed them on the Levels (6)
Now i want to give them an offset to raise them so they touch the above concrete floor
I calculated the height they must be raised (in Z-Axis) by Raybounce
Some of my elements won’t respond, and i can’t find the problem.




distanceTo.dyn (34.2 KB)test.rvt (1.1 MB)

Hi Marcel, it’s been a long time!


I noticed that for whatever reason the raybouncing is hitting the same element you shoot the ray from and that’s why you only have one point there - they are coincident.
If you hide the electric fixtures in the view where you do the raybouncing everything works fine:

I’ve seen a raybouncing node in one of the packages that itself has an option to ignore certain categories, but I don’t remember where it was.

1 Like

image
I also noticed that the ones that are already in place jump to the top face of the floor, since that’s where the ray bounces from. You will need to implement some sort of a check for those

1 Like

Thnx @viktor_kuzev
I tried, no luck.
My Rays don’t hit anything in most cases.
In my main model(115 Mb) that i can’t upload here, it goes astray.
Would you use the same method? Or have other ideas how to get a step further?
Note.
Can’t use face based families here, afterwards i will split the model into Electrical model/Arch model.
Also Element.Faces or Element.Geometry will run forever on those floors

Instead of raybouncing you could use element geometry and Point.Project. Slower sure, but it may help ID and fix the problem.

1 Like

Thank you @JacobSmall
Is there another way i can have Element.Geometry for these floors?
Did i see something like converting into Topology in the past?

1 Like

Hi Marcel…have you tried element solids

@sovitek
Yes, same error there Søren

Warning: Element.get_Solids operation failed.
Value cannot be null.
Parameter name: revitCurve

hmmm…just a guess…have tried this one here from clockwork…just a guess;)

@sovitek
tried it, with all/individual boolean inputs reversed, same Null

you have 3 tries left :slight_smile:

2 Likes

hehehe :wink:

1 Like

Can you post a simplified RVT with just one of the failing floors? May require using the APIs (Dynamo and Revit) to construct the shape directly, but without seeing what the fail point is it’s impossible to know for sure.

Does ‘select face’ work perchance? Not that I would recommend ‘select the faces you want to project to manually’, but when in a crunch…

Revit-file is in the initial post

1 Like

Hi Marcel,

You could achieve this via ReferenceIntersector class from the API :slight_smile:

import clr

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

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

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

#Import ToDSType(bool) extensions method
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument

#---###Start scripting here:###---#
pts = IN[0]

rvtPts = [i.ToXyz() for i in pts]

ray = XYZ(0,0,1)

filter = ElementCategoryFilter(BuiltInCategory.OST_Floors)

distmidPt = []

midptNulls = []

for i, j in enumerate(rvtPts):
	refI = ReferenceIntersector(filter, FindReferenceTarget.Face, doc.ActiveView)
	#Make sure elements from links are included
	refI.FindReferencesInRevitLinks = True
	#Find nearest point that "hits"
	refCmidPt = refI.FindNearest(j, ray)
	#Get references from both points
	if refCmidPt != None:
		referencemidPT = refCmidPt.GetReference()
		#Translate to global points	
		intersectmidPt = referencemidPT.GlobalPoint
		#geommidPT.append(intersectmidPt)
		#Get distance from startpoint to referece startpoint
		distmidPt.append(UnitUtils.ConvertFromInternalUnits(j.DistanceTo(intersectmidPt), DisplayUnitType.DUT_MILLIMETERS))
	else:
		midptNulls.append(i)

OUT = distmidPt, midptNulls

distanceTo_Marcel.dyn (31.8 KB)

Edit: Please forgive me for the variable names. The python script is from another workflow, but was easily applied to yours. :slight_smile:

2 Likes

before


after

Not all elements reacted (408 out of 2600+)

And there is a Floor above alle the Electrical Fixtures? No Beams or Columns?

The Python script is looking specifically for Floors, but you could extend the filter with other categories.

58 out of 2642 do not have a floor above them
No pinning used either

Can you register a difference in the two lists to see if a value was added at the indexes that doesn’t move:
image

Data-Shapes package as a ray bounce that alows you to set category(ies)

4 Likes

@Daniel_Hurtubise

I can see in the Dynamo view, all calculations worked.
In my test file it worked beautiful
Not on the main model though
You see why i think i have overlooked something
Maybe i should do a test, make a copy of the model, delete all the Elements except floors and Elec. Fixt. piece by piece .and run it, if it works i’ll bring back what i need, piece by piece (undo). If i choose the order in which i delete i can end up with the model i need anyway. I want to split by discipline :slight_smile: .