private static IEnumerable <Reference> RequestReferenceSelection( string message, ILogger logger, SelectionObjectType selectionType) { var doc = DocumentManager.Instance.CurrentUIDocument; Reference reference = null; var choices = doc.Selection; choices.Elements.Clear(); logger.Log(message); switch (selectionType) { case SelectionObjectType.Face: reference = doc.Selection.PickObject(ObjectType.Face, message); break; case SelectionObjectType.Edge: reference = doc.Selection.PickObject(ObjectType.Edge, message); break; case SelectionObjectType.PointOnFace: reference = doc.Selection.PickObject(ObjectType.PointOnElement, message); break; } return(reference == null ? null : new List <Reference> { reference }); }
protected RevitSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(selectionType, selectionObjectType, message, prefix) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; }
public SteelSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix, IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts) : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts) { AppResolver.Resolve <IAppInteraction>().DocumentOpened += Controller_DocumentChanged; }
private static IEnumerable <Reference> RequestMultipleReferencesSelection( string message, ILogger logger, SelectionObjectType selectionType) { var doc = DocumentManager.Instance.CurrentUIDocument; IList <Reference> references = null; var choices = doc.Selection; choices.Elements.Clear(); logger.Log(message); switch (selectionType) { case SelectionObjectType.Face: references = doc.Selection.PickObjects(ObjectType.Face, message); break; case SelectionObjectType.Edge: references = doc.Selection.PickObjects(ObjectType.Edge, message); break; case SelectionObjectType.PointOnFace: references = doc.Selection.PickObjects(ObjectType.PointOnElement, message); break; } if (references == null || !references.Any()) { return(null); } return(references); }
public RevitSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix, IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts) : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts) { RevitServicesUpdater.Instance.ElementsUpdated += Updater_ElementsUpdated; DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged; }
public static VirtualCell.CellType[] GetCellTypes(SelectionObjectType selection_type) { if (selectionDict == null) { CreateSelectionDictionary(); } return(selectionDict[selection_type]); }
public void GetSelectionOutputTest(SelectionObjectType selectionObjectType, SelectionType selectinType, string expectedResult) { selection = new SelectionConcrete(selectinType, selectionObjectType, "testMessage", "testPrefix"); var result = selection.GetOutputPortName(); Assert.AreEqual(expectedResult, result); }
/* TODO: Now that nodes know nothing about their owners, we can't access RunEnabled. * public override bool CanSelect * { * get { return base.CanSelect && RevitDynamoModel.RunEnabled; } * set { base.CanSelect = value; } * } * * public override string SelectionSuggestion * { * get * { * return RevitDynamoModel.RunEnabled * ? base.SelectionSuggestion * : "Selection is disabled when Dynamo run is disabled."; * } * } * * /// <summary> * /// Handler for the RevitDynamoModel's PropertyChanged event. * /// </summary> * /// <param name="sender"></param> * /// <param name="e"></param> * private void revMod_PropertyChanged(object sender, PropertyChangedEventArgs e) * { * // Use the RunEnabled flag on the dynamo model * // to set the CanSelect flag, enabling or disabling * // any bound UI when the dynamo model is not * // in a runnable state. * if (e.PropertyName == "RunEnabled") * { * RaisePropertyChanged("CanSelect"); * RaisePropertyChanged("SelectionSuggestion"); * } * } */ #endregion #region protected constructors protected RevitSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(selectionType, selectionObjectType, message, prefix) { RevitServicesUpdater.Instance.ElementsDeleted += Updater_ElementsDeleted; RevitServicesUpdater.Instance.ElementsModified += Updater_ElementsModified; DocumentManager.Instance.CurrentUIApplication.Application.DocumentOpened += Controller_RevitDocumentChanged; //revMod.PropertyChanged += revMod_PropertyChanged; }
public XafBootstrapTable() { SelectionType = SelectionObjectType.None; SelectedObjects = new List <object>(); CustomColumns = new List <HeaderInfo>(); Content = new Control(); Controls.Add(Content); ClientSideEvents = new StaticEditClientSideEvents(); }
public SelectionConcrete( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base( selectionType, selectionObjectType, message, prefix) { }
//This constructor is only used during testing to allow the initialization of the SelectionHelper property public SelectionConcrete( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix, IModelSelectionHelper <ModelBase> selectionHelper) : base( selectionType, selectionObjectType, message, prefix) { SelectionHelper = selectionHelper; }
public void RemoveCellInstancesOfTypesInSelection(SelectionObjectType sop) { foreach (VirtualCell.CellType t in SelectionManager.GetCellTypes(sop)) { List <CellInstance> tmp_list = new List <CellInstance>(this.instances); foreach (CellInstance ci in tmp_list) { if (ci.type == t) { RemoveCellInstance(ci); } } } }
/// <summary> /// Request an element in a selection. /// </summary> /// <typeparam name="T">The type of the Element.</typeparam> /// <param name="selectionMessage">The message to display.</param> /// <param name="selectionType">The selection type.</param> /// <param name="objectType">The selection object type.</param> /// <returns></returns> public IEnumerable <T> RequestSelectionOfType( string selectionMessage, SelectionType selectionType, SelectionObjectType objectType) { switch (selectionType) { case SelectionType.One: return(RequestElementSelection(selectionMessage, AsLogger())); case SelectionType.Many: return(RequestMultipleElementsSelection(selectionMessage, AsLogger())); } return(null); }
public IEnumerable <Reference> RequestSelectionOfType( string selectionMessage, SelectionType selectionType, SelectionObjectType objectType) { switch (selectionType) { case SelectionType.One: return(RequestReferenceSelection(selectionMessage, AsLogger(), objectType)); case SelectionType.Many: return(RequestMultipleReferencesSelection(selectionMessage, AsLogger(), objectType)); } return(null); }
private List <GameObject> SelectInternal(PhysicalMap physicalMap, SelectionObjectType type) { if (physicalMap == null) { Debug.Log("NO PHYSICAL MAP!"); return(null); } DaedalusDebugUtils.Assert(physicalMap.gameObjectLists != null, "Physical map's game object lists are null!"); List <GameObject> list = physicalMap.GetObjectsOfType(type) as List <GameObject>; if (list.Count == 0) { Debug.Log("NO ITEMS!"); return(list); } if (OVERRIDE_MATERIALS) { Material currentMat = list[0].GetComponentsInChildren <MeshRenderer>()[0].sharedMaterial; if (originalMaterials.ContainsKey(type) && originalMaterials[type] != null) { // Already selected! return(list); } else { originalMaterials[type] = currentMat; } Material sharedMat = new Material(currentMat); sharedMat.color = Color.blue; sharedMat.name = "Debug Material"; foreach (GameObject go in list) { foreach (MeshRenderer r in go.GetComponentsInChildren <MeshRenderer>()) { r.sharedMaterial = sharedMat; } } } return(list); }
public SelectionConcrete( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix, IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts) : base( selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts) { }
protected SelectionBase(WorkspaceModel workspaceModel, SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(workspaceModel) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; OutPortData.Add(new PortData("Elements", "The selected elements.")); RegisterAllPorts(); SelectCommand = new DelegateCommand(Select, CanBeginSelect); Prefix = prefix; }
private void ClearList(PhysicalMap physicalMap, SelectionObjectType type) { List <GameObject> list = physicalMap.GetObjectsOfType(type); if (OVERRIDE_MATERIALS) { if (originalMaterials.ContainsKey(type) && originalMaterials[type] != null) { foreach (GameObject go in list) { foreach (MeshRenderer r in go.GetComponentsInChildren <MeshRenderer>()) { r.sharedMaterial = originalMaterials[type]; } } originalMaterials[type] = null; } } }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; OutPortData.Add(new PortData("Elements", Resources.SelectionPortDataResultToolTip)); RegisterAllPorts(); Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = false; }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; OutPortData.Add(new PortData("Elements", "The selected elements.")); RegisterAllPorts(); SelectCommand = new DelegateCommand(Select, CanBeginSelect); Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = false; }
protected RevitSelection( WorkspaceModel workspaceModel, SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(workspaceModel, selectionType, selectionObjectType, message, prefix) { Logger = workspaceModel.DynamoModel.Logger; RevitDynamoModel = Workspace.DynamoModel as RevitDynamoModel; // we need to obtain the dynamo model directly from the workspace model // here, as it is not yet initialized on the base constructor var revMod = workspaceModel.DynamoModel as RevitDynamoModel; if (revMod == null) { return; } revMod.RevitServicesUpdater.ElementsDeleted += Updater_ElementsDeleted; revMod.RevitServicesUpdater.ElementsModified += Updater_ElementsModified; revMod.RevitDocumentChanged += Controller_RevitDocumentChanged; revMod.PropertyChanged += revMod_PropertyChanged; }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; string portName = GetOutputPortName(); OutPorts.Add(new PortModel(PortType.Output, this, new PortData(portName, Resources.SelectionPortDataResultToolTip))); RegisterAllPorts(); Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = true; }
protected SelectionBase( SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix, IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts) : base(inPorts, outPorts) { selectionMessage = message; this.selectionType = selectionType; this.selectionObjectType = selectionObjectType; Prefix = prefix; State = ElementState.Warning; ShouldDisplayPreviewCore = true; SelectionIdentifier = selectionIdentifier; ResetSelectionFromIds(SelectionIdentifier.ToList()); }
protected ElementSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix, IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts) : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts) { }
public IEnumerable <string> RequestSelectionOfType(string selectionMessage, SelectionType selectionType, SelectionObjectType objectType) { IAppInteraction appInteraction = AppResolver.Resolve <IAppInteraction>(); Point3d pt = appInteraction.PickPoint(); return(new string[] { string.Format("{0};{1};{2}", pt.x, pt.y, pt.z) }); }
public List <GameObject> SelectObjects(SelectionObjectType type) { PhysicalMap physicalMap = generator.physicalMap; return(SelectInternal(physicalMap, type)); }
protected ReferenceSelection( WorkspaceModel workspaceModel, SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(workspaceModel, selectionType, selectionObjectType, message, prefix) { }
public IEnumerable <string> RequestSelectionOfType(string selectionMessage, SelectionType selectionType, SelectionObjectType objectType) { IAppInteraction appInteraction = AppResolver.Resolve <IAppInteraction>(); var descs = appInteraction.PickElements(); return(descs); }
protected ElementSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(selectionType, selectionObjectType, message, prefix) { }
protected ReferenceSelection(SelectionType selectionType, SelectionObjectType selectionObjectType, string message, string prefix) : base(selectionType, selectionObjectType, message, prefix) { }