2025.3 Method
Changes 5
M

ItemFactoryBase.NewFamilyInstance

Description:
Inserts a new instance of a family into the document, using a location, type/symbol, and the host element.
Remarks:
This method is used to insert one family instance into another element, such as inserting a window into a wall. If the instance fails to be created an exception may be thrown.

The type/symbol that is used must be loaded into the document before this method is called. Families and their symbols can be loaded using the Document.LoadFamily or Document.LoadFamilySymbol methods.

The host object must be one that supports insertion of instances otherwise this method will fail.

Some Families, such as Beams, have more than one endpoint and are inserted in the same manner as single point instances. Once inserted these linear family instances can have their endpoints changed by using the instance's Element.Location property.

Note: ForbiddenForDynamicUpdateException might be thrown during a dynamic update if the inserted instance establishes a mutual dependency with another structure.

Note: if the created family instance includes nested instances, the API framework will automatically regenerate the document during this method call.

public FamilyInstance NewFamilyInstance(
	XYZ location,
	FamilySymbol symbol,
	Element host,
	StructuralType structuralType
)
  • location
    The physical location where the instance is to be placed.
  • symbol
    A FamilySymbol object that represents the type of the instance that is to be inserted.
  • host
    The object into which the FamilyInstance is to be inserted, often known as the host.
  • structuralType
    If structural then specify the type of the component.
Return Value FamilyInstance If creation was successful then an instance to the new object is returned, otherwise .