Set Location of Adaptative points in an Adaptative Components

I have some Adaptative Components placed in a model, the position and geometry of them is based in 3 adaptative points. This adaptative points would change due to design decisions in the future, I wonder if it possible to move them to a new adaptative point position via Dynamo but maintaining the same ID.

I will need only move them, not deleted and redo the element in the correct position. ( I will lost the internal ID in that case…).

1 Like

Hi @Esva

Use Element.Set Location custom node from spring nodes package.

I already try that, but it does not help to move the Adaptative points. It only move the basic point of the family so it does not help in this case.

It moves the family but not to the position based in the adaptative points

You can controle your points with surface.point at parameter ! But you have to regroupe all the points by four by your self and don’t use the lunch box package ! Youcan place and control your points independently of u and v in the surface.

hi @talbimam,

Sorry I do not understand how I can controle the points with this command (surface.pointatparameters). I have already a old an new position point, what I want is just make the translation.

I was thinking in generate this movement via python.

    adaptComp = AdaptiveComponentInstanceUtils.CreateAdaptiveComponentInstance(doc, famsymb)
    adptPoints = AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(adaptComp)

    aPt1 = doc.get_Element(adptPoints[0])
    aPt2 = doc.get_Element(adptPoints[1])
    aPt3 = doc.get_Element(adptPoints[2])
    #Asign the new locations()

    loc1 = XYZ(0,0,0)
    loc2 = XYZ(0,40,20) 
    loc3 = XYZ(40,40,0) 

    #Some vector math to get the translation for MoveElement()
    trans1 = loc1.Subtract(aPt1.Position)
    trans2 = loc2.Subtract(aPt2.Position)
    trans3 = loc3.Subtract(aPt3.Position)
    trans4 = loc4.Subtract(aPt4.Position)

    #Position Adaptive Component using MoveElement()

    ElementTransformUtils.MoveElement(doc, adptPoints[0], trans1)
    ElementTransformUtils.MoveElement(doc, adptPoints[1], trans2)
    ElementTransformUtils.MoveElement(doc, adptPoints[2], trans3)
    ElementTransformUtils.MoveElement(doc, adptPoints[3], trans4)

But I am not sure if it can work

1 Like

you can use revit API to do that.
@ingenieroahmad (Ahmed Montaser) and me creat C# code to re locate the adaptive point location. we use this code to edit the location of exsistion adaptive family

image

[MultiReturn(new { “Elements”, “Result” })]
public static Dictionary<string, object> Move_AdaptiveFamily(List<Revit.Elements.Element> Elements, List<List<Autodesk.DesignScript.Geometry.Point>> New_Location)
{
var D = new Dictionary<string, object>();
var doc = DocumentManager.Instance.CurrentDBDocument;
var unwrapped_element = new List<Autodesk.Revit.DB.FamilyInstance>(); ;
var Placement_Points = new List<IList<Autodesk.Revit.DB.ElementId>>(); ;
var RFS = new List<Autodesk.Revit.DB.ReferencePoint>();
var LOCS = new List();
var TRANS = new List();
var Dyn_Points = new List();
var PPF = new List();
var result_text = new List();
var result_Elements = new List<Revit.Elements.Element>();

        // get internal element as family instance
        foreach (var item in Elements)
        {
            unwrapped_element.Add((doc.GetElement(item.InternalElement.Id)) as Autodesk.Revit.DB.FamilyInstance);
        }

        // get placement points for each element
        foreach (var item in unwrapped_element)
        {
            Placement_Points.Add(AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(item));
        }
        for (int i = 0; i < Placement_Points.Count; i++)
        {
            for (int j = 0; j < Placement_Points[i].Count; j++)
            {
                PPF.Add(Placement_Points[i][j]);
            }
        }

        // Convert inserted points to locations and make vectors to move
        for (int i = 0; i < New_Location.Count; i++)
        {
            for (int j = 0; j < New_Location[i].Count; j++)
            {
                Dyn_Points.Add(New_Location[i][j].ToXyz());
            }
        }

        // Get reference points 
        for (int i = 0; i < PPF.Count; i++)
        {
            RFS.Add(doc.GetElement(PPF[i]) as Autodesk.Revit.DB.ReferencePoint);
        }
        for (int i = 0; i < Dyn_Points.Count; i++)
        {
            LOCS.Add(Dyn_Points[i]);
        }

        // Prepare Vectors
        for (int i = 0; i < Dyn_Points.Count; i++)
        {
            TRANS.Add(LOCS[i].Subtract(RFS[i].Position));
        }

        // Transaction to start
        TransactionManager.Instance.EnsureInTransaction(doc);
        // Move segments
        for (int i = 0; i < Dyn_Points.Count; i++)
        {
            ElementTransformUtils.MoveElement(doc, PPF[i], TRANS[i]);
        }
        // Transaction is done
        TransactionManager.Instance.TransactionTaskDone();

        // Result text
        for (int i = 0; i < New_Location.Count; i++)
        {
            result_text.Add(string.Format("Segment No.{0} has been moved", i + 1));
        }
        // Result Elements
        foreach (var item in Elements)
        {
            result_Elements.Add(item);
        }
        D.Add("Elements", result_Elements);
        D.Add("Result", result_text);
        return D;
    }
2 Likes
1 Like