internal void UpdateInitialParameters(Document doc)
{
Transaction t = new Transaction(doc, "Update parameters");
t.Start();
SchemaBuilder builder = new SchemaBuilder(m_schemaId); //(new Guid("{4DE4BE80-0857-4785-A7DF-8A8918851CB2}"));
builder.AddSimpleField("Position", typeof(XYZ)).SetUnitType(UnitType.UT_Length);
builder.AddSimpleField("Orientation", typeof(XYZ)).SetUnitType(UnitType.UT_Length);
builder.SetSchemaName("WallPositionData");
builder.SetDocumentation("Two points in a Window element that assist in placing a section view.");
builder.SetVendorId("adsk");
builder.SetApplicationGUID(doc.Application.ActiveAddInId.GetGUID());
m_schema = builder.Finish();
t.Commit();
t.Start();
Field fieldPosition = m_schema.GetField("Position");
Field fieldOrientation = m_schema.GetField("Orientation");
FamilyInstance window = doc.get_Element(m_windowId) as FamilyInstance;
Entity storageEntity = new Entity(m_schema);
LocationPoint lp = window.Location as LocationPoint;
XYZ location = lp.Point;
storageEntity.Set<XYZ>(fieldPosition, location, DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES);
XYZ orientation = window.FacingOrientation;
storageEntity.Set<XYZ>(fieldOrientation, orientation, DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES);
window.SetEntity(storageEntity);
t.Commit();
}