VIZZARD Document Help

3D 형상의 2D Projection 외곽형상 포인트 추출

3D 형상의 2D Projection 외곽형상 포인트 추출 예제

  • 조회 중인 3D 모델의 외곽형상 포인트를 추출

Projection2DVO projection = Connector.Get2DProjectionVertex( 60 /* Scale */ , false /* True(전체), False(단일폐곡선) */ , 1 /* 1(Default) */ ); if (projection == null) return; float area = projection.Area; int vertexCount = projection.VertexCount; BoundBoxVO vertexBbox = projection.VertexBoundBox; BoundBoxVO nodeBbox = projection.NodeBoundBox; string matrix = projection.Matrix; string points = projection.Points; string vertex = projection.Vertex; string pathGeometry = projection.PathGeometryString;
  • ISO+ 방향 모델 외곽 포인트 추출 결과

Figure 1 : ISO+ 방향 모델 외곽 포인트

VIZZARD_DEV_2DPROJECTION_01.png
    • Z+ 방향 모델 외곽 포인트 추출 결과

    Figure 2 : Z+ 방향 모델 외곽 포인트

    VIZZARD_DEV_2DPROJECTION_02.png
      • PathGeometry는 WPF 클래스입니다. 2D Projection 외곽선 추출 결과를 WPF 컨트롤을 활용하여 아래와 같이 렌더링 할 수 있습니다.

      using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace Projection2DWpfDrawControl { public partial class DrawControl : UserControl { public DrawControl() { InitializeComponent(); } public void DrawPathGeometry(string PATHDATA) { MyCanvas.Children.Clear(); if (String.IsNullOrEmpty(PATHDATA) == true) return; Path myPath = new Path(); myPath.Stroke = Brushes.Red; myPath.StrokeThickness = 1; myPath.Data = Geometry.Parse(PATHDATA); MyCanvas.Children.Add(myPath); } public void DrawPoints(string Point) { MyCanvas.Children.Clear(); if (String.IsNullOrEmpty(Point) == true) return; string[] Points = Point.Split(new char[] { ',' }); string PathDataByPoints = String.Empty; int minX = 1000; int minY = 1000; for (int i = 0; i < Points.Length; i++) { if (i % 2 != 0) continue; int nX = Convert.ToInt32(Points[i]); int nY = Convert.ToInt32(Points[i + 1]); minX = Math.Min(minX, nX); minY = Math.Min(minY, nY); if (i == 0) { PathDataByPoints = string.Format("M{0},{1}", Points[i], Points[i + 1]); } else if (i < Points.Length - 3) { PathDataByPoints += string.Format("L{0},{1}", Points[i], Points[i + 1]); } else { PathDataByPoints += string.Format("L{0},{1}z", Points[i], Points[i + 1]); } } int nMargineX = 0; int nMargineY = 0; TranslateTransform translateTransform = new TranslateTransform(0 - minX + nMargineX, 0 - minY + nMargineY); Path myPath = new Path(); myPath.Stroke = Brushes.Red; myPath.StrokeThickness = 1; myPath.Data = Geometry.Parse(PathDataByPoints); myPath.RenderTransform = translateTransform; MyCanvas.Children.Clear(); MyCanvas.Children.Add(myPath); } } }
      <UserControl x:Class="Projection2DWpfDrawControl.DrawControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Projection2DWpfDrawControl" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> <Canvas Name="MyCanvas"> </Canvas> </UserControl>
      Last modified: 04 3월 2024