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.

Thanks.

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

http://revitapisearch.com/html/b3c10008-aba6-9eee-99c9-7e05ace75796.htm

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

clr.AddReference("RevitAPIUI")
from  Autodesk.Revit.UI import *

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.Creation import ItemFactoryBase

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

clr.AddReference('RevitServices')
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
	TransactionManager.Instance.EnsureInTransaction(doc)
	lockedAlign = doc.Create.NewAlignment(view, r1, r2)
	TransactionManager.Instance.TransactionTaskDone()
	
	OUT = view , lockedAlign
2 Likes

Hi,

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];

Thanks,

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