Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to use my updater to set parameter values of my element. To identify the value that needs to be assigned to the element's parameters the element must be placed first. The trigger for this updater must be called by two change types: 1- Element Addition and 2- Geometry Change.
My updater is working fine with geometry change but is not assigning the values when the element is being added.
*Please can anyone clarify, do I need to create a new Transaction in the execute method of updaters, (currently two of the updaters are working fine without the transaction but i am confused)
following is the code for the execute method of the updater.
public void Execute(UpdaterData data)
{
Document doc = data.GetDocument();
foreach (ElementId id in data.GetModifiedElementIds())
{
Element element = doc.GetElement(id);
if (element is FamilyInstance familyInstance)
{
//check if parameters for location and rotation exist
if (familyInstance.LookupParameter("X_Coordinate") != null) //check for X_Coordinate Parameter
{
Parameter x_param = familyInstance.GetParameters("X_Coordinate")[0];
x_param.Set((familyInstance.Location as LocationPoint).Point.X);
}
if (familyInstance.LookupParameter("Z_Coordinate") != null) //check for Z_Coordinate Parameter
{
Parameter y_param = familyInstance.GetParameters("Z_Coordinate")[0];
y_param.Set((familyInstance.Location as LocationPoint).Point.Z);
}
if (familyInstance.LookupParameter("Y_Coordinate") != null) //check for Y_Coordinate Parameter
{
Parameter z_param = familyInstance.GetParameters("Y_Coordinate")[0];
z_param.Set((familyInstance.Location as LocationPoint).Point.Y);
}
if (familyInstance.LookupParameter("Rotation") != null) //check for Rotation Parameter
{
Parameter rotation = familyInstance.GetParameters("Rotation")[0];
rotation.Set(0);
}
}
}
}
Solved! Go to Solution.