Lock aligned families

I have a family that I insert and align with a wall.
I want the family remains aligned after I move the wall.
This is possible by setting this lock.
If I have to place a lot of the same type always have to clicking on the lock.
Is it possible to do this afterwards with a Dynamo script?
So if I placed the families and I aligned them use the Dynamo script and turn all the families that are aligned on lock.


I have never tried it, but it seems to be a method in the api that can create a locked alignment:


The challenge with those methods is always to find the references, here is an example that uses uidoc pick face to pick them. This is of course a lot more work than just hitting the lock in revit, but I hope this helps to get you (or someone else) started:

import clr

from  Autodesk.Revit.UI import *

from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import ItemFactoryBase

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

view = doc.ActiveView
if IN[0]:
	r1 = uidoc.Selection.PickObject(Selection.ObjectType.Face, 'Pick first face for reference');
	r2 = uidoc.Selection.PickObject(Selection.ObjectType.Face, 'Pick second face for reference');
	#Do some action in a Transaction
	lockedAlign = doc.Create.NewAlignment(view, r1, r2)
	OUT = view , lockedAlign


I have the same problem. I have tried the python script and it’s work but I want to modify it, I don’t want select the faces but integrate the face before the node.
I tried this (with IN[1] and IN[2] with the node “select face”)
if IN[0]:
r1 = IN[1];
r2 = IN[2];


@guilbertxavier26 Have you been able to make any headway on this?