void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ModelTypes = ((System.Windows.Controls.ComboBox)(target)); return; case 2: this.ModelName = ((System.Windows.Controls.TextBox)(target)); return; case 3: this.FilePath = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.Browse = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\ImportModel.xaml" this.Browse.Click += new System.Windows.RoutedEventHandler(this.Browse_Click); #line default #line hidden return; case 5: this.viewport = ((HelixToolkit.Wpf.HelixViewport3D)(target)); return; case 6: this.Mesh = ((HelixToolkit.Wpf.MeshGeometryVisual3D)(target)); return; case 7: this.Ok = ((System.Windows.Controls.Button)(target)); #line 30 "..\..\ImportModel.xaml" this.Ok.Click += new System.Windows.RoutedEventHandler(this.Ok_Click); #line default #line hidden return; case 8: this.Cancel = ((System.Windows.Controls.Button)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ModelTypes = ((System.Windows.Controls.ComboBox)(target)); #line 19 "..\..\..\Pages\Models.xaml" this.ModelTypes.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ModelTypes_SelectionChanged); #line default #line hidden return; case 2: this.ModelsList = ((System.Windows.Controls.ListBox)(target)); #line 20 "..\..\..\Pages\Models.xaml" this.ModelsList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ModelsList_SelectionChanged); #line default #line hidden return; case 3: this.ImportModel = ((System.Windows.Controls.Button)(target)); #line 22 "..\..\..\Pages\Models.xaml" this.ImportModel.Click += new System.Windows.RoutedEventHandler(this.ImportModel_Click); #line default #line hidden return; case 4: this.DeleteModel = ((System.Windows.Controls.Button)(target)); #line 23 "..\..\..\Pages\Models.xaml" this.DeleteModel.Click += new System.Windows.RoutedEventHandler(this.DeleteModel_Click); #line default #line hidden return; case 5: this.geoVert = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.textVert = ((System.Windows.Controls.TextBlock)(target)); return; case 7: this.vertNorm = ((System.Windows.Controls.TextBlock)(target)); return; case 8: this.paramVert = ((System.Windows.Controls.TextBlock)(target)); return; case 9: this.point = ((System.Windows.Controls.TextBlock)(target)); return; case 10: this.line = ((System.Windows.Controls.TextBlock)(target)); return; case 11: this.face = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.viewport = ((HelixToolkit.Wpf.HelixViewport3D)(target)); return; case 13: this.Mesh = ((HelixToolkit.Wpf.MeshGeometryVisual3D)(target)); return; case 14: this.Tipp = ((System.Windows.Controls.TextBlock)(target)); return; case 15: this.Export = ((System.Windows.Controls.Button)(target)); #line 40 "..\..\..\Pages\Models.xaml" this.Export.Click += new System.Windows.RoutedEventHandler(this.Export_Click); #line default #line hidden return; case 16: this.size = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 5 "..\..\Show3D.xaml" ((AssetManager.Show3D)(target)).Closed += new System.EventHandler(this.Window_Closed); #line default #line hidden return; case 2: this.BoxRadio = ((System.Windows.Controls.RadioButton)(target)); #line 15 "..\..\Show3D.xaml" this.BoxRadio.Checked += new System.Windows.RoutedEventHandler(this.BoxRadio_Checked); #line default #line hidden return; case 3: this.SphereRadio = ((System.Windows.Controls.RadioButton)(target)); #line 16 "..\..\Show3D.xaml" this.SphereRadio.Checked += new System.Windows.RoutedEventHandler(this.SphereRadio_Checked); #line default #line hidden return; case 4: this.TubeRadio = ((System.Windows.Controls.RadioButton)(target)); #line 17 "..\..\Show3D.xaml" this.TubeRadio.Checked += new System.Windows.RoutedEventHandler(this.TubeRadio_Checked); #line default #line hidden return; case 5: this.TeapotRadio = ((System.Windows.Controls.RadioButton)(target)); #line 18 "..\..\Show3D.xaml" this.TeapotRadio.Checked += new System.Windows.RoutedEventHandler(this.TeapotRadio_Checked); #line default #line hidden return; case 6: this.viewport = ((HelixToolkit.Wpf.HelixViewport3D)(target)); return; case 7: this.mesh = ((HelixToolkit.Wpf.MeshGeometryVisual3D)(target)); return; } this._contentLoaded = true; }
private void CreateFaceModels(IFCItem item, Vector3D center) { while (item != null) { if (item.ifcID != IntPtr.Zero && item.noVerticesForFaces != 0 && item.noPrimitivesForFaces != 0) { var positions = new Point3DCollection(); var normals = new Vector3DCollection(); if (item.verticesForFaces != null) { for (int i = 0; i < item.noVerticesForFaces; i++) { var point = new Point3D(item.verticesForFaces[6 * i + 0] - center.X, item.verticesForFaces[6 * i + 1] - center.Y, item.verticesForFaces[6 * i + 2] - center.Z); var normal = new Vector3D(item.verticesForFaces[6 * i + 3], item.verticesForFaces[6 * i + 4], item.verticesForFaces[6 * i + 5]); positions.Add(point); normals.Add(normal); } Debug.Assert(item.verticesForFaces.Length == item.noVerticesForFaces * 6); } var indices = new Int32Collection(); if (item.indicesForFaces != null) { for (int i = 0; i < 3 * item.noPrimitivesForFaces; i++) { indices.Add(item.indicesForFaces[i]); } } MeshGeometry3D meshGeometry = new MeshGeometry3D(); meshGeometry.Positions = positions; meshGeometry.Normals = normals; meshGeometry.TriangleIndices = indices; MeshGeometryVisual3D mesh = new MeshGeometryVisual3D(); mesh.MeshGeometry = meshGeometry; item.Mesh3d = mesh; _meshToIfcItems[mesh] = item; #if DEBUG OutputObj(item.ifcID.ToString(), meshGeometry); #endif FillMeshByIfcColor(item); hVp3D.Children.Add(mesh); } CreateFaceModels(item.child, center); item = item.next; } }
public void GetModel(MeshGeometryVisual3D mesh) { MeshBuilder mb = new MeshBuilder(false, true); double Hdelta = MaxHeight - MinHeight; for (int x = 0; x < SizeX - 1; x++) { for (int y = 0; y < SizeY - 1; y++) { if (!Points[x, y].HasValue || !Points[x, y + 1].HasValue || !Points[x + 1, y].HasValue || !Points[x + 1, y + 1].HasValue) continue; mb.AddQuad( new Point3D(Min.X + (x + 1) * Delta.X / (SizeX - 1), Min.Y + (y) * Delta.Y / (SizeY - 1), Points[x + 1, y].Value), new Point3D(Min.X + (x + 1) * Delta.X / (SizeX - 1), Min.Y + (y + 1) * Delta.Y / (SizeY - 1), Points[x + 1, y + 1].Value), new Point3D(Min.X + (x) * Delta.X / (SizeX - 1), Min.Y + (y + 1) * Delta.Y / (SizeY - 1), Points[x, y + 1].Value), new Point3D(Min.X + (x) * Delta.X / (SizeX - 1), Min.Y + (y) * Delta.Y / (SizeY - 1), Points[x, y].Value), new Point(0, (Points[x + 1, y].Value - MinHeight) * Hdelta), new Point(0, (Points[x + 1, y + 1].Value - MinHeight) * Hdelta), new Point(0, (Points[x, y + 1].Value - MinHeight) * Hdelta), new Point(0, (Points[x, y].Value - MinHeight) * Hdelta) ); } } mesh.MeshGeometry = mb.ToMesh(); }