Catch all magnets related to a door, and give them the associated doornumber?



Hello Dynos,

i get my task just partly to a progress, i can`t bridge the gab. So i need the doornumber in my “door magnets” they are modeled (pic).

get the magnets (native: current doc)

# 🎯 just electrical fixtures
collector = FilteredElementCollector(doc, doc.ActiveView.Id)\
    .OfCategory(BuiltInCategory.OST_ElectricalFixtures)\
    .WhereElementIsNotElementType()\
    .ToElements()

my doors are from the linked AR model, but here i got already confused

# 0️⃣ Linked Elements

linked_docs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToElements()

linkedARCH = [i for i in linked_docs if i.Name.Contains("FM_AR")]
model = linkedARCH[0].GetLinkedDocument()
print(model)

linked_doors = FilteredElementCollector(model,doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements()

PyMagnetDoors_V01.dyn (55.1 KB)

my idea is useing bounding box. I am open open for other solutions, it looks the best way, because it works in the preview


KR
Andreas

I cannot help you right now with the BoundingBox Issue but once you get that part over this node from clockwork might help you :slight_smile:
image

1 Like

Hi Andreas probably something here maybe :wink:

1 Like

@pyXam ,

i come until here. so how can i get the elements behind the points. ?
grafik

Might have some time to play on this tonight but I need the rvt document and a linked document to do so. Building a project to link in and a family to host in the link instance and then placing the linked instances is a lot of added work to help out. Can you delete all but a half dozen doors and walls in the linked model and all but the half dozen associated instances in the main model, purge unused and post them as ‘link.rvt’ and ‘model.rvt’? Or make a fake data set with your family and hosting conditions?

1 Like

@jacob.small

i have 3 situations:
1.) 1 flush + 1 magnet
2.) 2 flush + 2 magnets
3.) magnet lost in space, without any door ( they shoud pass)
ELT_2024-4-10_22.35.20.7z (1.5 MB)


i want just pass “mark” to “zugehoerigeTuerNummer”

Sorry @Draxl_Andreas I sortoff had the feeding it was a 1 to 1 relationship until you brought in the doubleleaf door with the magnets

This might work for you, Elements inside from BiMorphNodes
(sorry i only had an random electrical test families model open so so i had to improvise what a “Door” and “Magnet” :stuck_out_tongue:

1 Like

arhh i thought these fixtures was hosted on the link…here is an alternative way :wink:

4 Likes

@sovitek ,

i did a “hands on script”


i come until here … it looks promising, hot to deal with this error…
[PyMagnetDoors_V03.dyn|attachment]

is there a Null anywhere ? (upload://6e2efWB6w1zRcNfyRG3mGn982YD.dyn) (24.2 KB)

@pyXam ,

i followed your advise too and i get a result :wink:
BUT i got anything


PyMagnetDoors_V04.dyn (23.2 KB)

Your elements arnt actually inside, so the tollerance needs to grow to a size where you expect the magent to be. At tolerance 1 i think you are saying that it essentially is 1mm distance from the door which wouldnt be correct.

Might make your life easier if you also play with the last levels when joining the lists so @l3 there are the doors and @l2 there are the magnets, would make your get set parameters easier after i think.

Also… are both magnets and doors linked elements?

1 Like

@pyXam

only the doors are linked. I have to extract the doornumber…

i get weard results. so i have to find the right tolerance

Yeah i found the same with the statement from BiMorph being “Tolerance distance is converted dynamically to Revit internal units”

But if i’m honest i didn’t want to comit the time to read up on what exactly that meant in terms of distance from edge of boundingbox, i leave that to you :wink:

1 Like

try set lacing to cross in intesect node and L2 in mask

and probably union your solids so you have one by door

here is another way there probably could work as well

2 Likes

@sovitek ,

the only “beauty” issue is to do it in clean python :wink: … i will progress that.