public static string Viewerdata(DrawingControl3D control, XbimModel model, int EntityLabel) { StringBuilder sb = new StringBuilder(); control.ReportData(sb, model, EntityLabel); return(sb.ToString()); }
/// <summary> /// /// </summary> /// <param name="control"></param> /// <param name="model"></param> /// <param name="entityLabel"></param> /// <returns></returns> public static string Viewerdata(DrawingControl3D control, IfcStore model, int entityLabel) { var sb = new StringBuilder(); control.ReportData(sb, model, entityLabel); return(sb.ToString()); }
private static void OnModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DrawingControl3D d3D = d as DrawingControl3D; if (d3D != null) { d3D.ReloadModel(); } }
private void DrawingControl_MeasureChangedEvent(DrawingControl3D m, PolylineGeomInfo e) { if (e != null) { EntityLabel.Text = e.ToString(); Debug.WriteLine("Points:"); foreach (var pt in e.VisualPoints) { Debug.WriteLine("X:{0} Y:{1} Z:{2}", pt.X, pt.Y, pt.Z); } } }
private void DrawingControl_MeasureChangedEvent(DrawingControl3D m, Xbim.Presentation.ModelGeomInfo.PolylineGeomInfo e) { if (e != null) { this.EntityLabel.Text = e.ToString(); Debug.WriteLine("Points:"); foreach (var pt in e.VisualPoints) { Debug.WriteLine(string.Format("X:{1} Y:{1} Z:{2}", pt.X, pt.Y, pt.Z)); } } }
/// <summary> /// Initialises the properties of the instance from the control. /// </summary> /// <param name="control">Initialisation object; reference not retained</param> public VisualizationInfo(DrawingControl3D control) : this() { if (control != null) { if (control.Viewport.Orthographic) { this.orthogonalCameraField = new OrthogonalCamera((System.Windows.Media.Media3D.OrthographicCamera)control.Viewport.Camera); } else { this.perspectiveCameraField = new PerspectiveCamera((System.Windows.Media.Media3D.PerspectiveCamera)control.Viewport.Camera); } var cg = control.GetCutPlane(); if (cg != null) { this.ClippingPlanes.Add(new ClippingPlane(cg)); } } }
/// <summary> /// Initialises the properties of the instance from the control. /// </summary> /// <param name="control">Initialisation object; reference not retained</param> public VisualizationInfo(DrawingControl3D control) : this() { if (control != null) { if (control.Viewport.Orthographic) { orthogonalCameraField = new OrthogonalCamera((System.Windows.Media.Media3D.OrthographicCamera)control.Viewport.Camera); } else { perspectiveCameraField = new PerspectiveCamera((System.Windows.Media.Media3D.PerspectiveCamera)control.Viewport.Camera); } var cg = control.GetCutPlane(); if (cg != null) { ClippingPlanes.Add(new ClippingPlane(cg)); } } }
public AddViewXbim(Markup issue, string bcfTempFolder, DrawingControl3D control) { try { InitializeComponent(); AddViewControl.Issue = issue; AddViewControl.TempFolder = bcfTempFolder; _control = control; AddViewControl.TextBlockInfo.Text = "3D/2D information of the current view will be included in the viewpoint"; GetRevitSnapshot(); } catch (Exception ex) { MessageBox.Show("Error!", "exception: " + ex); } }
private BitmapImage GetSnapshotImage(DrawingControl3D control) { var renderTargetBitmap = Get3DVisual(control); var bitmapImage = new BitmapImage(); var bitmapEncoder = new PngBitmapEncoder(); bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); using (var stream = new MemoryStream()) { bitmapEncoder.Save(stream); stream.Seek(0, SeekOrigin.Begin); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = stream; bitmapImage.EndInit(); } return(bitmapImage); }
private static VisualizationInfo GenerateViewpoint(DrawingControl3D control3D) { try { var v = new VisualizationInfo(); // it is a orthogonal view if (control3D.Viewport.Orthographic) { // ReSharper disable once RedundantNameQualifier var cam = control3D.Viewport.Camera as System.Windows.Media.Media3D.OrthographicCamera; if (cam != null) v.OrthogonalCamera = new OrthogonalCamera { // todo: this works internally, but we must ensure it's compatible with other bcf viewers CameraViewPoint = { X = cam.Position.X, Y = cam.Position.Y, Z = cam.Position.Z }, CameraUpVector = { X = cam.UpDirection.X, Y = cam.UpDirection.Y, Z = cam.UpDirection.Z }, CameraDirection = { X = cam.LookDirection.X, Y = cam.LookDirection.Y, Z = cam.LookDirection.Z }, ViewToWorldScale = cam.Width }; } // it is a perspective view else { // todo: this works internally, but we must ensure it's compatible with other bcf viewers var cam = control3D.Viewport.Camera as System.Windows.Media.Media3D.PerspectiveCamera; if (cam != null) v.PerspectiveCamera = new PerspectiveCamera() { CameraViewPoint = { X = cam.Position.X, Y = cam.Position.Y, Z = cam.Position.Z }, CameraUpVector = { X = cam.UpDirection.X, Y = cam.UpDirection.Y, Z = cam.UpDirection.Z }, CameraDirection = { X = cam.LookDirection.X, Y = cam.LookDirection.Y, Z = cam.LookDirection.Z }, FieldOfView = cam.FieldOfView }; } /* todo components list to be implemented //COMPONENTS PART var versionName = "XbimXplorer BCFIer Plugin"; v.Components = new List<Component>(); var visibleElems = new FilteredElementCollector(doc, doc.ActiveView.Id) .WhereElementIsNotElementType() .WhereElementIsViewIndependent() .ToElementIds(); var hiddenElems = new FilteredElementCollector(doc) .WhereElementIsNotElementType() .WhereElementIsViewIndependent() .Where(x => x.IsHidden(doc.ActiveView) || !doc.ActiveView.IsElementVisibleInTemporaryViewMode( TemporaryViewMode.TemporaryHideIsolate, x.Id)).ToList(); //would need to check how much this is affecting performance var selectedElems = uidoc.Selection.GetElementIds(); //include only hidden elements and selected in the BCF if (visibleElems.Count() > hiddenElems.Count()) { foreach (var elem in hiddenElems) { v.Components.Add(new Component { OriginatingSystem = versionName, IfcGuid = IfcGuid.ToIfcGuid(ExportUtils.GetExportId(doc, elem.Id)), Visible = false, Selected = false, AuthoringToolId = elem.Id.IntegerValue.ToString() }); } foreach (var elem in selectedElems) { v.Components.Add(new Component { OriginatingSystem = versionName, IfcGuid = IfcGuid.ToIfcGuid(ExportUtils.GetExportId(doc, elem)), Visible = true, Selected = true, AuthoringToolId = elem.IntegerValue.ToString() }); } } //include only visible elements //all the others are hidden else { foreach (var elem in visibleElems) { v.Components.Add(new Component { OriginatingSystem = versionName, IfcGuid = IfcGuid.ToIfcGuid(ExportUtils.GetExportId(doc, elem)), Visible = true, Selected = selectedElems.Contains(elem), AuthoringToolId = elem.IntegerValue.ToString() }); } } */ return v; } catch (Exception ex) { MessageBox.Show("Error generating viewpoint", "exception: " + ex); } return null; }
private BitmapImage GetSnapshotImage(DrawingControl3D control) { var renderTargetBitmap = Get3DVisual(control); var bitmapImage = new BitmapImage(); var bitmapEncoder = new PngBitmapEncoder(); bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); using (var stream = new MemoryStream()) { bitmapEncoder.Save(stream); stream.Seek(0, SeekOrigin.Begin); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = stream; bitmapImage.EndInit(); } return bitmapImage; }
public LayerViewModel(string LayerName, DrawingControl3D control3D) { _LayerName = LayerName; _d3d = control3D; }
private static VisualizationInfo GenerateViewpoint(DrawingControl3D control3D) { try { var v = new VisualizationInfo(); // it is a orthogonal view if (control3D.Viewport.Orthographic) { // ReSharper disable once RedundantNameQualifier var cam = control3D.Viewport.Camera as System.Windows.Media.Media3D.OrthographicCamera; if (cam != null) { v.OrthogonalCamera = new OrthogonalCamera { // todo: this works internally, but we must ensure it's compatible with other bcf viewers CameraViewPoint = { X = cam.Position.X, Y = cam.Position.Y, Z = cam.Position.Z }, CameraUpVector = { X = cam.UpDirection.X, Y = cam.UpDirection.Y, Z = cam.UpDirection.Z }, CameraDirection = { X = cam.LookDirection.X, Y = cam.LookDirection.Y, Z = cam.LookDirection.Z }, ViewToWorldScale = cam.Width } } ; } // it is a perspective view else { // todo: this works internally, but we must ensure it's compatible with other bcf viewers var cam = control3D.Viewport.Camera as System.Windows.Media.Media3D.PerspectiveCamera; if (cam != null) { v.PerspectiveCamera = new PerspectiveCamera() { CameraViewPoint = { X = cam.Position.X, Y = cam.Position.Y, Z = cam.Position.Z }, CameraUpVector = { X = cam.UpDirection.X, Y = cam.UpDirection.Y, Z = cam.UpDirection.Z }, CameraDirection = { X = cam.LookDirection.X, Y = cam.LookDirection.Y, Z = cam.LookDirection.Z }, FieldOfView = cam.FieldOfView } } ; } /* todo components list to be implemented * * //COMPONENTS PART * var versionName = "XbimXplorer BCFIer Plugin"; * v.Components = new List<Component>(); * * var visibleElems = new FilteredElementCollector(doc, doc.ActiveView.Id) * .WhereElementIsNotElementType() * .WhereElementIsViewIndependent() * .ToElementIds(); * var hiddenElems = new FilteredElementCollector(doc) * .WhereElementIsNotElementType() * .WhereElementIsViewIndependent() * .Where(x => x.IsHidden(doc.ActiveView) || || !doc.ActiveView.IsElementVisibleInTemporaryViewMode( || TemporaryViewMode.TemporaryHideIsolate, x.Id)).ToList(); || //would need to check how much this is affecting performance || ||var selectedElems = uidoc.Selection.GetElementIds(); || ||//include only hidden elements and selected in the BCF ||if (visibleElems.Count() > hiddenElems.Count()) ||{ || foreach (var elem in hiddenElems) || { || v.Components.Add(new Component || { || OriginatingSystem = versionName, || IfcGuid = IfcGuid.ToIfcGuid(ExportUtils.GetExportId(doc, elem.Id)), || Visible = false, || Selected = false, || AuthoringToolId = elem.Id.IntegerValue.ToString() || }); || } || foreach (var elem in selectedElems) || { || v.Components.Add(new Component || { || OriginatingSystem = versionName, || IfcGuid = IfcGuid.ToIfcGuid(ExportUtils.GetExportId(doc, elem)), || Visible = true, || Selected = true, || AuthoringToolId = elem.IntegerValue.ToString() || }); || } ||} ||//include only visible elements ||//all the others are hidden ||else ||{ || foreach (var elem in visibleElems) || { || v.Components.Add(new Component || { || OriginatingSystem = versionName, || IfcGuid = IfcGuid.ToIfcGuid(ExportUtils.GetExportId(doc, elem)), || Visible = true, || Selected = selectedElems.Contains(elem), || AuthoringToolId = elem.IntegerValue.ToString() || }); || } ||} */ return(v); } catch (Exception ex) { MessageBox.Show("Error generating viewpoint", "exception: " + ex); } return(null); }
public static string Viewerdata(DrawingControl3D control, XbimModel model, int EntityLabel) { StringBuilder sb = new StringBuilder(); control.ReportData(sb, model, EntityLabel); return sb.ToString(); }
private void DrawingControl_MeasureChangedEvent(DrawingControl3D m, Xbim.Presentation.ModelGeomInfo.PolylineGeomInfo e) { if (e != null) { this.EntityLabel.Text = e.ToString(); } }