# Sloped ceiling hanger rod length not working

**URL:** <https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042>\
**Category:** Uncategorized\
**Created:** [August 16, 2017, 2:35pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042 "2017-08-16T14:35:44Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 16, 2017, 2:35pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/1 "2017-08-16T14:35:44Z")

</div>

hello, I am trying to write a script to reduce the hanger rod length by the correct distance based on the slope of the ceiling. I had it working but I had to select every starting hanger and second hanger manually. So I tried to speed it up using this springs node. SelectedElements(ordered) to have it work faster. I thought I could get it to work using a while loop but its choking on me. Any advise? thanks!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/1/41a0530becce6fb7867f6b24caaf3978e8d941b5.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 16, 2017, 6:22pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/2 "2017-08-16T18:22:57Z")

</div>

Your `continueWhile` input is an open function. Your `<=` node needs another input.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 16, 2017, 6:32pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/3 "2017-08-16T18:32:50Z")

</div>

I still cant get it to work.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/3/13fe225d35007aeae27ab4be4ba1270c4638bc9a.png)

I was trying to do what they did in the dictionary.

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/4/642df3b0fb2e5995384de11c83082b42c47b1cf0.jpg)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 16, 2017, 6:59pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/4 "2017-08-16T18:59:01Z")

</div>

Hmmm… I’m not too familiar with the LoopWhile node so you could be using it correctly.

I don’t know if a LoopWhile node is needed anyway. You have to slope of the roof and the hanger instances, so you should be able to get the location of the hangers and calculate the ΔZ based on the hanger spacing. You could also project the hanger points onto the roof geometry and get the difference in elevation between points.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 16, 2017, 7:02pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/5 "2017-08-16T19:02:00Z")

</div>

> [@Nick\_Boyts](#):
>
> ou have to slope of the roof and the hanger instances, so you should be able to get the location of the hangers and calculate the ΔZ based on the hanger spacing.

Yes this is what I am doing. But I am having trouble doing it all for more than two hangers. Any advice, if not with a while loop.

> [@Nick\_Boyts](#):
>
> You could also project the hanger points onto the roof geometry and get the difference in elevation between points.

This is very intriguing. How would I do this? Thanks!

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 16, 2017, 7:51pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/6 "2017-08-16T19:51:44Z")

</div>

> [@mix](#):
>
> This is very intriguing. How would I do this? Thanks!

Check out `Surface.ProjectInputOnto`. It will let you project geometry (hanger points) onto a surface (bottom of roof). Then you just compare the z coordinates of the original point to the projected point and get the difference.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 12:59pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/7 "2017-08-17T12:59:53Z")

</div>

Hello Nick,

so i tried using the node you mentioned and I read about it in the dictionary but it only appears to work with lines and stuff? I tried using it with my hangers and i got this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/e/1ef38ced568085446decb6c98cf1b6fa3eff65bb.png)

is there a way to get around this?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 1:01pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/8 "2017-08-17T13:01:29Z")

</div>

You have to get the location of the hangers as a point (or line) before you can project it onto the surface. Try Element.Location from Clockwork.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 1:05pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/9 "2017-08-17T13:05:02Z")

</div>

I cant use custom packages. Other than springs it seems like. because It looks like my IT department blocks all DLLs. Is there a way to do it with out clockwork?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 1:07pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/10 "2017-08-17T13:07:16Z")

</div>

You can try Element.GetLocation.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 1:23pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/11 "2017-08-17T13:23:38Z")

</div>

Ok, that works, but I seem to be having a hard time understanding what the point is telling me. I wrote an equation that should work but seeing as it is a level based element, the location in the Z direction is 0 and in the projection it is 546. is that feet? inches? This equation should work based on looking at the family, however the hanger rods shoot straight through the ceiling. What am I doing wrong? Thanks in advance!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/5/45695158747fd5c78a4ec82c77768e83420779b1.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 1:26pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/12 "2017-08-17T13:26:17Z")

</div>

I don’t have any hanger families to play with so I’m not exactly sure what parameters we’re working with. Can you send a screenshot of the hanger parameters? I’m looking to see if they have an Offset or if something like Top of Strut/Bottom of Rod will work.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 1:27pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/13 "2017-08-17T13:27:32Z")

</div>

[KIT #1 (SS).rfa](https://forum.dynamobim.com/uploads/short-url/wTxXKcjV3OfkdCe3n7q7WhkLSpR.rfa) (724 KB)  
Here is the hanger family.I looked at the length it should be and it should be like 408 inches but the projection is like 546. I dont see what the probem is.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 1:43pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/14 "2017-08-17T13:43:51Z")

</div>

Your family is a bit confusing with both level offsets and Top of Strut modifying the element’s location. It would probably be easier if one of these was a reporting parameter.

It looks like the family doesn’t have an actual Rod Length parameter that we can set either. You will have to manipulate the Top Level and Top Offset parameters to get the rod at the correct location.You’ll want to get the elevation of the hanger point intersecting the roof (using Surface.ProjectInputOnto) then set the Top Offset to be at that elevation with respect to the Top Level of the hanger.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 1:46pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/15 "2017-08-17T13:46:07Z")

</div>

Yes, that is correct. Its what I did too. But when I use it to set the Top Offset, it doesnt work. The Rod length parameter is a reporting parameter and so is H. I cant figure out where the descrepancy is though

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 1:58pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/16 "2017-08-17T13:58:20Z")

</div>

What about it doesn’t work? Is it not acting as you expected? Is it not being set to the right location?  
The offsets seem to work for me the bottom is just controlled by both the Base Level and the Top of Strut.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 2:21pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/17 "2017-08-17T14:21:37Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/b/abc12df0d760032f46fb60fd5d3f5713efe996fa.png)

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 7:02pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/18 "2017-08-17T19:02:29Z")

</div>

perfect!  
Now why wont it let me do multiple items? looks like it is crapping out in the projection node

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/3/d32d049eb53c56ba3286f2d872f0660d268537e0.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 17, 2017, 7:04pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/19 "2017-08-17T19:04:00Z")

</div>

You’ll have to do a little list management. Try setting the lacing to longest.

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 17, 2017, 7:09pm UTC](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042/20 "2017-08-17T19:09:27Z")

</div>

fantastic!  
Nick youre amazing! would you mind explaining lacing to me in laymens terms please? no matter how many times i read about it, i still dont get it, and I seem to allways be only changing my lacing as a last resort, blindly and iteritively when things dont work but I still dont get it. And ive read everyting on primer about it already. Makes zero sense the way they explain it.

[Next page](https://forum.dynamobim.com/t/sloped-ceiling-hanger-rod-length-not-working/14042.md?page=2)
