The center of the element

Hi,

  1. I would like to get the midpoint of the family as per attachment:

Its important for me to find that point.
If I have a concrete wall and a cabinet, I should have a plug for the installation.



It is important for me to find this point and specify in the script the distance from this point to the end of the concrete wall to switch the element off / on.

  1. If the situation were as follows then there should be no blanking plug:

  2. I created a script that detects whether the cabinet is next to concrete or to ceramics, but when it detects that the cabinet is only touching concrete, the plug turns on. Script and furniture below:
    Find walls and furnitures.dyn (101.4 KB)
    (55) Umywalka z szafkami.rfa (1.3 MB)

If anyone has any idea, please let me know. The topic is very important to me

@krzysztof.nowakFWCRN ,

that can be a direction…

Amigo @krzysztof.nowakFWCRN buenas, you can also ask for the bounding box of the element, if you transform the bounding box into a cuboid, you can ask for the centroid, it’s just an idea maybe it will help you !

you could nest a shared family at the back of the cabinet and use that to create collisions with concrete walls. I assume this is needed to see where concrete inserts in the wall are required?

Any ideas on how to do this? I’m relatively new to dynamo and still learning

Yes. I have some ideas. A quick question though. Is this for a large project with 100s of placed elements, or are we talking about less than 40 or 50 placed elements?

I’m not sure how important the origin of the family is for you (at the moment, the origin is at the drain.) If the origin of the family is unimportant, you could just change it in the family…but you may have to go through and re-align each instance of the family…then you can use that point to determine which type of wall the element is placed against.

After thinking about this, you don’t need the nested family. (It’s one way to do it, but it is probably more complicated than it needs to be. You could just create some geometry on the back of the cabinet in order to create collisions with walls. You can create a type parameter in the family which turns the element on and off. When you need, turn it on…when not…turn it off. You could even build that into your script.

Something like this…

Anyways. Once you have the piece of collision geometry, you just need to run a collision check. You can do that with bimorph nodes, or with the revit built-in collisions. If you do the revit collisions, you will have to export the html report, open it in excel, save as excel, and re-read the report in revit. It will give you the type names, the worksets if activated, the mark and the element id of both the wall and the cabinet family.

any progress?

I added a new family to the cabinet family, “Find reinforced concrete” as shown in the screenshot. I added a parameter to a new family in the family, but the script shows a warning “parameter is read only” and an error so it is not working at the moment.
Attachments below.

(55) Umywalka z szafkami.rfa (1.4 MB)
D3. Znajdź umywalki przy ścianach v.3.dyn (103.5 KB)

Skrypt:


Python:


#python nodes in dynamo 1.0
#proposed by Julien Benoit @jbenoit44 
#http://aecuandme.wordpress.com/
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import itertools
import operator

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
activeV=doc.ActiveView

host = []
finst=[]
finstID=[]
for i in IN[0]:
	host.append(UnwrapElement(i))
for i in IN[1]:
	finst.append(UnwrapElement(i))
for i in IN[1]:
	finstID.append(UnwrapElement(i).Id)	


superset=[]
hloop=[]


for h in host:
	collection = List[ElementId](finstID)
	collector=FilteredElementCollector(doc,collection)
	a=h.BoundingBox[activeV]
	c=Outline (a.Min,a.Max)
	d=BoundingBoxIntersectsFilter(c,float(IN[2]))
	e=collector.WherePasses(d).ToElements()
	setlist=[]
	hostlist=[]
	hostlist.append(h)
	setlist.append(e)
	all_lists = [hostlist,setlist]
	c=reduce(operator.add, all_lists)
	superset.append(c)
		
OUT=superset

This looks a bit more complicated than it needs to be. I can’t help you with the python.

Here is what I did. Sorry…I don’t have 2018 installed on my machine anymore…otherwise I would just give you the files. ,)

This is modeled in the family and has a type-parameter to turn the visibility of the element off. It could also be an instance parameter…it’s just easier to control if i ever have to turn it on or off manually.

It would be great if you send it because I’m losing hope :frowning:

do you have bimorph nodes?

Yes

Here isthe script. I had to rebuild it, because apparently I didn’t save the first version.

I’ve removed the part which turns the collision-body on-and-off. The family you posted didn’t have that element modeled. You don’t need to nest a family…it is enough just to model a piece of geometry that you can turn on and turn off while runing the collison check.

Collisions-SetParameter.DYN (33.1 KB)

You will have to make adjustments to the pink boxes as necessary.

any luck?

I also read your original post. I think the nested family is ok, but it will not work for the collision. I’ve used these in the past to force collisions-points, but in this case it does not work that well.

You can simply model a small element on the back of the wall cabinet in order to force the collision. (I chose this face, since it is directly on the wall.) You can also adjust the visibility of this element so that it only shows up in 3d. And as I stated before, you can also add a parameter in order to turn it on and off, before and after you run your collision checks.

Once you have that, you can get the elements which are colliding with walls.

I’ve also noticed that the bi-morph collision node is “unreliable” in the sense that it doesn’t seem to automatically update collisions. As you can see, dynamo is set to automatic and the moved element is still in the collision list. Looks like you will have to either run the script from the dynamo player, or open and close it each time you run it. (You can’t run the script, make changes to the model, and expect changes which should affect the collision check to work.)

Hi, your script works fine. I change script for linkelement:

However, there was a problem with the items that are included in the group:
image

Any idea how to solve it? I tried “Group.Member” but it didn’t work.

If you don’t have dependent elements (dimensions etc.), delete old groups and create new ones with Dynamo.

so if you have access to edit the family, you can get named references inside of the family with Revit- so place a reference plane center L-R and then search for it in Revit. The node is family instance get references in the Genius Loci package.