# Assembly: modify origin (Part 2)

**URL:** <https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995>\
**Category:** Developers\
**Tags:** python\
**Created:** [February 12, 2018, 10:56am UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995 "2018-02-12T10:56:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 12, 2018, 10:56am UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/1 "2018-02-12T10:56:27Z")

</div>

Hi All,

**Short introduction**  
We are a manufacturer of precast concrete stairs.  
Since the Builtin Revit Stairs have a lack of possibilities we build our Families as Generic Models.  
Right now we are looking for ways to automate the generation of views for our shopdrawings.

**Assemblies**  
We are focussing on Assemblies, as they seem to have the most advantages. But by default there is also a big disadvantage, witch is the orientation. If a family instance has a rotation (not aligned to the X or Y-axis), the views are not aligned to the family instance, but to the X or Y-axis (see picture 1).

 ![picture%201](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/a/7a1714245b8fc1c0b68318203c975426d3da3add.png)

Assemblies do have their own Assembly Origin wich can be manipulated by Python.  
In the thread below @daniel_woodcock1 was kind enough to share a Python script that can rotate the Assembly Origin.

> [@Assembly modify origin](https://forum.dynamobim.com/t/assembly-modify-origin/11433):
>
> Hi, I have a problem with the origin orientation of assemblies created. This orientation is affecting all the assemblies views created because the elevations and plan views will not align with the elements main face(normal). Is there a way in dynamo to get the origin and alight the orientation with the wall orientation that is part of the assembly? autodesk is saying as below but it would be a pain to edit all assemblies and do it manually… [image] When i do it manually, …

```
import clr
import math
clr.AddReference("ProtoGeometry")
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
app = DocumentManager.Instance.CurrentUIApplication.Application

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

def tolist(obj1):
	if hasattr(obj1," __iter__"): return obj1
	else: return [obj1]

elems = tolist(UnwrapElement(IN[0]))
axis = tolist(IN[1])
rot = tolist(IN[2])

outList = []

for e, a, r in zip(elems, axis, rot):
	trans = e.GetTransform()
	transRot = trans.CreateRotationAtPoint(a.ToXyz(),math.radians(r), trans.Origin)
	try:
		TransactionManager.Instance.EnsureInTransaction(doc)
		e.SetTransform(transRot)
		TransactionManager.Instance.TransactionTaskDone()
		outList.append(e)
	except Exception, e:
		outList.append(e.message)
	
OUT = outList

```

I used this Python script in my Dynamo workflow (also attached below).  
After running it the Assembly Origins are rotated correctly, and the orientation of views is also correct.  
But the centerpoint of the Assembly Instance seems to be no longer the basepoint for the created views (see picture 2).

 ![picture%202](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/2/8229a18e37da5f484f90b455e0fcbccc087d5512.png)

**Does anyone know why this is happening ?**

 ![DynamoWorkflow](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/2/a2bd903d7ef37425e21ba26cfd2cc70425d78f85.png)

[Assemblies\_RotatedOrigin\_01.dyn](https://forum.dynamobim.com/uploads/short-url/9b2Ko44zB0QK86W8i4bMQAmPj7.dyn) (51.3 KB)  
[Assemblies\_RotatedOrigin\_01.rvt](https://forum.dynamobim.com/uploads/short-url/8eREZ7bIOemhcTgRn9JW4twwmwW.rvt) (2.3 MB)

Thanks in advance,  
Mark

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 12, 2018, 3:22pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/2 "2018-02-12T15:22:11Z")

</div>

This is the result i’m looking for …

 ![3D_view](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/6/961fcc1532a7342170b80f87696ffd08fa325332.png)

 ![Level%201_view](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/e/3ec38fdc229da8c99746ae2052fb37ab77cf8a53.png)

![picture%203](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/8/78a9d2051188efa4500dcf7bb28366db38621072.png)

The views are aligned with the element, even if the (highlighted) stair is not aligned by the X or Y-axis (45 degrees rotation). I created this result by manualy rotate the Assembly Origin in Revit.

---

<div class="post-metadata">

**Author:** ![viktor\_kuzev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/viktor_kuzev/32/48254_2.png) [@viktor\_kuzev](https://forum.dynamobim.com/u/viktor_kuzev)\
**Post date:** [February 13, 2018, 10:49am UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/3 "2018-02-13T10:49:42Z")

</div>

Hi I don’t have some of the nodes you’re using (btw which packages are they from?)  
But the problem is here:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/1/218e548965def4c419e890ea9f6ac0c23e3980d9.png)  
You’re using the z axis at the origin so that’s why the assembly rotates around the origin(0,0,0).  
You have to rotate each assembly around it’s own center

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 12:20pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/4 "2018-02-13T12:20:24Z")

</div>

Hi Viktor,

Thanks a lot for your response.  
Can you give me a hint on how you would solve this ?

- Create a virtual/dynamo axis at the assemblycenter, and feed that as input to the Python script.
- Or edit the Python script itself, so it won’t need input of an axis.

Any help is much appreciated.

PS. Sorry i forgot about the custom nodes (i wil post a list shortly).

Kind regards,  
Mark

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 12:47pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/5 "2018-02-13T12:47:07Z")

</div>

This is the list of the custom nodes i used (please correct me if i missed one).

- **Element.Type** = Archi-lab\_Grimshaw (can be replaced by Element.ElementType).
- **Element.RotationAngle** = BIM4Struc.Productivity
- **Passthrough** = Clockwork
- **Tool.CreateAssembly** = Steamnodes
- **Tool.RenameAssembly** = Steamnodes
- **Tool.AssemblyViews** = Steamnodes

---

<div class="post-metadata">

**Author:** ![viktor\_kuzev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/viktor_kuzev/32/48254_2.png) [@viktor\_kuzev](https://forum.dynamobim.com/u/viktor_kuzev)\
**Post date:** [February 13, 2018, 1:31pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/6 "2018-02-13T13:31:24Z")

</div>

I took a look at the script and it’s possible that it’s not the rotation axis, but rather the way the views for the assemblies are created. The method in the API doesn’t seem to have any control of where exactly to place the the section lines and thus the crop region includes much more than the stair. I don’t have time to go into further detail with this, but you may consider creating the views without assemblies.  
I might not be right though. I hope someone else has more info about it.

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 1:41pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/7 "2018-02-13T13:41:22Z")

</div>

> [@viktor\_kuzev](#):
>
> I don’t have time to go into further detail with this

No problem, thanks for your time, and effort to help me 👍

> [@viktor\_kuzev](#):
>
> I hope someone else has more info about it

Yes i hope so too. I still have the feeling it’s possible, because when i rotate the Assembly Origin manualy it works fine.

Kind regards,  
Mark

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 13, 2018, 3:13pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/8 "2018-02-13T15:13:01Z")

</div>

> [@MJB-online](#):
>
> Yes i hope

Hi I was playing with the assemblies recently and I think creating the views using the Assembly build-in functionality is better. I am talking about this.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/4/04d779a4d99aaccb4f35a7741b53186455adf4da.png)  
And here is the Dynamo node for this.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/e/3ed18c0cbc72433dd202b4ece12a497674356397.png)  
You can find the node in Steam Nodes package. You are able also to create the assemblies inside Dynamo with Tool.CreateAssembly node and to automate the whole process. I’ve done something like that to create assemble views for curtain walls.

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 3:37pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/9 "2018-02-13T15:37:42Z")

</div>

Hi Petar,

Thanks for your reply  
That is also the node (Tools.AssemblyViews) i use in my script.  
My script is divided in the steps below.

- Create Assemblies (Tool.CreateAssembly).
- Rename the created Assemblies (Tool.RenameAssembly).
- Then i use the Python script to rotate the origin of the Assemblies, to get the views aligned to our elements.
- Last step is the actual creation of the views with the node you mentioned (Tool.AssemblyViews).

All these steps seem to work fine, only the views don’t seem to relate to the assembly anymore (see picture 2 of my original post).

Kind regards,  
Mark

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 13, 2018, 3:48pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/10 "2018-02-13T15:48:48Z")

</div>

I guess that I am missing something. What is the sequence in your script? Because what I’ve done is first to create the assemblies then to rotate them and after the rotation I create the views and everything is fine.

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 4:01pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/11 "2018-02-13T16:01:44Z")

</div>

Do you have an example you can share, i would be very interesested 🙂

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 13, 2018, 4:05pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/12 "2018-02-13T16:05:40Z")

</div>

Of course, hope this helps.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/f/1fc76ffbe85a240aa21eaf0230396a13dca728fe.jpg)

and the result

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/a/7af574611b315b29a99622d017abe859b87a6f80.gif)

I know it is different but the logic should be the same. Here I needed always to have front view showing correctly no matter the orientation of the wall.

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 4:09pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/13 "2018-02-13T16:09:49Z")

</div>

What is the version of your Dynamo installation.

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 13, 2018, 4:10pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/14 "2018-02-13T16:10:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 4:12pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/15 "2018-02-13T16:12:48Z")

</div>

Strange it’s the same version as mine, but i don’t seem to have the “RotateAssembly” node (is it a custom node)

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 13, 2018, 4:14pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/16 "2018-02-13T16:14:57Z")

</div>

This node is the same that you are using. I just wrapped it in a custom node to use the @level functionality. It is still the same python code that you are using.

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

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 13, 2018, 4:17pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/17 "2018-02-13T16:17:59Z")

</div>

Okay thanks a lot for now, i have to leave now, but wil continue tomorow 👍

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 13, 2018, 4:18pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/18 "2018-02-13T16:18:16Z")

</div>

Ok, good luck!

---

<div class="post-metadata">

**Author:** ![MJB-online](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mjb-online/32/24884_2.png) [@MJB-online](https://forum.dynamobim.com/u/MJB-online)\
**Post date:** [February 14, 2018, 2:12pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/19 "2018-02-14T14:12:32Z")

</div>

I’ve done a lot of testing, and have the feeling i have to give up 😢

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

Assembly Views are placed on the **faces** of the “Assembly BoundingBox” (see picture above). So the only thing i can think of is that the **size** of the “Assembly BoundingBox” is (heavily) affected by rotating the Assembly Origin. If that’s the case it would be far beyond my knowledge. On the other hand that makes no sense, because @Petar_Penchev1 is doing the same thing, and it works fine for him.

---

<div class="post-metadata">

**Author:** ![Petar\_Penchev1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/petar_penchev1/32/8592_2.png) [@Petar\_Penchev1](https://forum.dynamobim.com/u/Petar_Penchev1)\
**Post date:** [February 14, 2018, 2:40pm UTC](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995/20 "2018-02-14T14:40:55Z")

</div>

I use only elevation views, though. I did’t place any sections but still this won’t be a big problem. Here is a very good example of creating views for elements using sections - [https://revitbeyondbim.wordpress.com/2017/02/10/element-view-generation-in-revit-with-dynamo-revised/](https://revitbeyondbim.wordpress.com/2017/02/10/element-view-generation-in-revit-with-dynamo-revised/)

[Next page](https://forum.dynamobim.com/t/assembly-modify-origin-part-2/18995.md?page=2)
