i am trying to highlight a selected element in the drawingcontrol3D, but selected from external. So i have a list with all spaces of the model, when i select a space an event is triggered
`
using (var model = IfcStore.Open(filePathIFC1))
{
var selectedSpace = model.Instances.OfType<IIfcSpace>().Where(p => p.Name.ToString() == entityID).FirstOrDefault() as IPersistEntity;
SelectedElement = selectedSpace;
DrawingControl.ReloadModel(DrawingControl3D.ModelRefreshOptions.ViewPreserveCameraPosition);
}
`
From the XBim git WPFSample i have this code parts
`
public static readonly DependencyProperty ModelProviderProperty = DependencyProperty.Register("ModelProvider", typeof(ObjectDataProvider), typeof(MainWindow));
private ObjectDataProvider ModelProvider
{
get
{
return MainFrame.DataContext as ObjectDataProvider;
}
}
#endregion
public IfcStore Model
{
get { return ModelProvider.ObjectInstance as IfcStore; }
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
ModelProvider.Refresh();
}
public IPersistEntity SelectedElement
{
get => DrawingControl.SelectedEntity;
set => DrawingControl.SelectedEntity = value;
}
public Xbim.Presentation.DrawingControl3D.SelectionBehaviours SelectionBehaviour
{
get => DrawingControl.SelectionBehaviour;
set => DrawingControl.SelectionBehaviour = value;
}
public Xbim.Presentation.EntitySelection Selection
{
get => DrawingControl.Selection;
set => DrawingControl.Selection = value;
}
public delegate void SelectionChangedHandler(object sender, System.Windows.Controls.SelectionChangedEventArgs e);
public event SelectionChangedEventHandler SelectionChanged;
private void LoadXbimFile(string dlgFileName)
{
Clear();
var model = IfcStore.Open(dlgFileName);
var context = new Xbim3DModelContext(model);
context.CreateContext();
ModelProvider.ObjectInstance = model;
}
`
The drawingcontrol3D is working fine, and highlight "OnSelectionChanged" is working fine inside the view. But i can't trigger onselectionchanged from external like in my first code part above. I mean i can, and everything is working... but the selected space is not highlightes afterwarts.
Hey,
i am trying to highlight a selected element in the drawingcontrol3D, but selected from external. So i have a list with all spaces of the model, when i select a space an event is triggered
`
using (var model = IfcStore.Open(filePathIFC1)) {
`
From the XBim git WPFSample i have this code parts
`
public static readonly DependencyProperty ModelProviderProperty = DependencyProperty.Register("ModelProvider", typeof(ObjectDataProvider), typeof(MainWindow));
`
The drawingcontrol3D is working fine, and highlight "OnSelectionChanged" is working fine inside the view. But i can't trigger onselectionchanged from external like in my first code part above. I mean i can, and everything is working... but the selected space is not highlightes afterwarts.
Thx for the help.
oh and this is my xaml
<Window x:Class="ResultViewerDALEC.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:presentation="http://schemas.Xbim.com/Presentation" xmlns:local="clr-namespace:ResultViewerDALEC" xmlns:webView="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls.WebView" xmlns:webView2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" mc:Ignorable="d" xmlns:oxy="http://oxyplot.org/wpf" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:webEx="clr-namespace:ResultViewerDALEC.Commands" Title="MainWindow" MinWidth="750" ResizeMode="CanResize" Height="400" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Loaded="MainWindow_Loaded">
`