NewFamilyInstance doubling the offset from level?

NewFamilyInstance doubling the offset from level?

PerryLackowski
Advocate Advocate
372 Views
2 Replies
Message 1 of 3

NewFamilyInstance doubling the offset from level?

PerryLackowski
Advocate
Advocate

I'm trying to place an instance of a concrete equipment pad family at the same location as my equipment, then raise the equipment by the height of the pad. I had success using NewFamilyInstance(XYZ, FamilySymbol, StructuralType). However, this particular overload doesn't assign my new pad to the same level as the equipment. I looked through the overloads for NewFamilyInstance and found this one: NewFamilyInstance Method (XYZ, FamilySymbol, Level, StructuralType). Unfortunately, when I insert the new pad using the location and level of the original equipment, the new pad appears to be adding the Z elevation to the level elevation, so the pad appears at double the elevation of the equipment. What am I missing?

 

new_pad = doc.Create.NewFamilyInstance(equipment_element.Location.Point, concrete_pad_standard, doc.GetElement(equipment_element.LevelId), StructuralType.NonStructural )
0 Likes
Accepted solutions (1)
373 Views
2 Replies
Replies (2)
Message 2 of 3

PerryLackowski
Advocate
Advocate
Accepted solution

While I still think the NewFamilyInstance command is bugged, I found a workaround. Rather than using the location of the equipment as the XYZ argument, I first modified it so the Z component is the equipment's Elevation from Level. This effectively subtracts the Level's elevation from the Z component, since the NewFamilyInstance command is adding it back in when it sets the level.

 

el = equipment_element.Location.Point
new_pad_location = XYZ(el.X, el.Y, equipment_element.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble())
new_pad = doc.Create.NewFamilyInstance(new_pad_location, concrete_pad_standard, doc.GetElement(equipment_element.LevelId), StructuralType.NonStructural )
0 Likes
Message 3 of 3

PerryLackowski
Advocate
Advocate
0 Likes