// // (C) Copyright 2003-2016 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Autodesk.Revit.DB; using Autodesk.Revit.UI; namespace Revit.SDK.Samples.PlacementOptions.CS { /// /// The dialog for setting the FaceBasedPlacementType option of the face based family instance. /// public partial class FacebasedForm : System.Windows.Forms.Form { List m_familySymbolList; FamilySymbol m_selectedSymbol; PromptForFamilyInstancePlacementOptions m_placementOptions; /// /// Constructor /// public FacebasedForm(List symbolList) { InitializeComponent(); radioButtonFace.Checked = true; m_placementOptions = new PromptForFamilyInstancePlacementOptions(); m_placementOptions.FaceBasedPlacementType = FaceBasedPlacementType.PlaceOnFace; m_familySymbolList = symbolList; List nameList = new List(); foreach (FamilySymbol symbol in m_familySymbolList) { nameList.Add(symbol.Name); } comboBoxFamilySymbol.DataSource = nameList; comboBoxFamilySymbol.SelectedIndex = 0; m_selectedSymbol = m_familySymbolList[comboBoxFamilySymbol.SelectedIndex]; } /// /// The family instance placement options for placement. /// public PromptForFamilyInstancePlacementOptions FIPlacementOptions { get { return m_placementOptions; } } /// /// The family symbol for placement. /// public FamilySymbol SelectedFamilySymbol { get { return m_selectedSymbol; } } /// /// Use the FaceBasedPlacementType.Default option or not. /// /// The sender. /// The event arg. private void radioButtonDefault_CheckedChanged(object sender, EventArgs e) { m_placementOptions.FaceBasedPlacementType = FaceBasedPlacementType.Default; } /// /// Use the FaceBasedPlacementType.PlaceOnFace option or not. /// /// The sender. /// The event arg. private void radioButtonFace_CheckedChanged(object sender, EventArgs e) { m_placementOptions.FaceBasedPlacementType = FaceBasedPlacementType.PlaceOnFace; } /// /// Use the FaceBasedPlacementType.PlaceOnVerticalFace option or not. /// /// The sender. /// The event arg. private void radioButtonVF_CheckedChanged(object sender, EventArgs e) { m_placementOptions.FaceBasedPlacementType = FaceBasedPlacementType.PlaceOnVerticalFace; } /// /// Use the FaceBasedPlacementType.PlaceOnWorkPlane option or not. /// /// The sender. /// The event arg. private void radioButtonWP_CheckedChanged(object sender, EventArgs e) { m_placementOptions.FaceBasedPlacementType = FaceBasedPlacementType.PlaceOnWorkPlane; } /// /// Select the family symbol for family instance placement. /// /// The sender. /// The event arg. private void comboBoxFamilySymbol_SelectedIndexChanged(object sender, EventArgs e) { m_selectedSymbol = m_familySymbolList[comboBoxFamilySymbol.SelectedIndex]; } } }