Sample
Review File(*.rev, *.rvm) 열기/추가 시, 노드 이름 앞에 있는 '/' 자동 제거 기능 옵션화
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.Model.RemoveNodeNameSlashOption = !vizcore3d.Model.RemoveNodeNameSlashOption;
}
Review(Note)의 텍스트를 빠르게 가시화하기 위한 Cache 기능(EnableFontTextureCache) 추가. 기본값 False
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.Review.EnableFontTextureCache = !vizcore3d.Review.EnableFontTextureCache;
}
TextDrawing에 텍스트 추가 시, Size 설정 API 추가
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void DrawText()
{
VIZCore3D.NET.Data.TextDrawingItem item = vizcore3d.TextDrawing.Add(
new VIZCore3D.NET.Data.Vertex3D(0, 0, 0)
, new VIZCore3D.NET.Data.Vector3D(1, 0, 0) /* X+ 방향으로 텍스트가 표시 */
, new VIZCore3D.NET.Data.Vector3D(0, 1, 0) /* 텍스트의 위쪽 방향 : Z+에서 볼때, Y+가 위쪽 임. */
, 3500
, 100
, Color.Black
, "ZONE_001"
);
vizcore3d.TextDrawing.Show(item.ID, true);
}
Walkthrough 모드에서 Avatar의 위치를 설정
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.BeginUpdate();
vizcore3d.Walkthrough.Avatar = true;
vizcore3d.Walkthrough.AvatarPosition = new Data.Vertex3D(19427.13f, 1204.982f, 2335.0f);
vizcore3d.EndUpdate();
}
툴바 보이기/숨기기
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.ToolbarMain.Visible = true; /* 기본툴바 */
vizcore3d.ToolbarNote.Visible = true; /* 노트 */
vizcore3d.ToolbarMeasure.Visible = true; /* 측정 */
vizcore3d.ToolbarSection.Visible = true; /* 단면 */
vizcore3d.ToolbarClash.Visible = false; /* 간섭검사 */
vizcore3d.ToolbarAnimation.Visible = false; /* 애니메이션 */
vizcore3d.ToolbarSimulation.Visible = false; /* 시뮬레이션 */
}
단면 생성 이전/이후 이벤트
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.Section.OnSectionBeforeAddEvent += Section_OnSectionBeforeAddEvent; /* 생성 이전 */
vizcore3d.Section.OnSectionAfterAddEvent += Section_OnSectionAfterAddEvent; /* 생성 이후 */
}
private void Section_OnSectionBeforeAddEvent(object sender, Event.EventManager.SectionBeforeAddEventArgs e)
{
switch (e.Kind)
{
case Manager.SectionManager.SectionTypes.SECTION:
{
bool partSelection = e.PartSelection;
VIZCore3D.NET.Data.Axis axis = e.SectionAxis;
}
break;
case Manager.SectionManager.SectionTypes.SECTION_BOX:
{
bool partSelection = e.PartSelection;
float margine = e.Margine;
}
break;
case Manager.SectionManager.SectionTypes.SECTION_INBOX:
break;
case Manager.SectionManager.SectionTypes.SECTION_INBOX6:
break;
default:
break;
}
}
private void Section_OnSectionAfterAddEvent(object sender, Event.EventManager.SectionAfterAddEventArgs e)
{
VIZCore3D.NET.Data.Section section = e.Item;
}
리뷰 이동 시, 이벤트 호출 : 기존 OnReviewChangedEvent 이벤트에 유형(Kind) 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore;
private void InitializeVIZCore3DEvent()
{
vizcore.Review.OnReviewChangedEvent += Review_OnReviewChangedEvent;
}
private void Review_OnReviewChangedEvent(object sender, Event.EventManager.ReviewEventArgs e)
{
string log = String.Empty;
switch (e.EventKind)
{
case Manager.ReviewManager.ReviewEventKind.DESELECTED_REVIEW:
log = string.Format("[{0}] 모두 선택해제", (int)e.EventKind);
break;
case Manager.ReviewManager.ReviewEventKind.SELECT_REVIEW:
log = string.Format("[{0}] 리뷰 선택 : {1} / {2}", (int)e.EventKind, e.ReviewID, vizcore.Review.GetItem(e.ReviewID).Kind);
break;
case Manager.ReviewManager.ReviewEventKind.SELECT_REVIEW_ADD:
log = string.Format("[{0}] 리뷰 선택 (추가) : {1} / {2}", (int)e.EventKind, e.ReviewID, vizcore.Review.GetItem(e.ReviewID).Kind);
break;
case Manager.ReviewManager.ReviewEventKind.CHANGED_REVIEW_DATA:
log = string.Format("[{0}] 리뷰 정보 변경 : {1} / {2}", (int)e.EventKind, e.ReviewID, vizcore.Review.GetItem(e.ReviewID).Kind);
break;
case Manager.ReviewManager.ReviewEventKind.ADDED_SURFACE_NOTE:
log = string.Format("[{0}] 표면노트 추가 : {1} / {2}", (int)e.EventKind, e.ReviewID, vizcore.Review.GetItem(e.ReviewID).Kind);
break;
case Manager.ReviewManager.ReviewEventKind.CANCELED_ADD:
log = string.Format("[{0}] 추가 동작 취소", (int)e.EventKind);
break;
case Manager.ReviewManager.ReviewEventKind.CHANGED_ARROW_POSITION:
log = string.Format("[{0}] 지시선 위치 변경 : {1} / {2}", (int)e.EventKind, e.ReviewID, vizcore.Review.GetItem(e.ReviewID).Kind);
break;
case Manager.ReviewManager.ReviewEventKind.REVIEW_MOVED:
log = string.Format("[{0}] 이동된 리뷰 : {1} / {2}", (int) e.EventKind, e.ReviewID, vizcore3d.Review.GetItem(e.ReviewID).Kind);
break;
default:
break;
}
}
리뷰 삭제 시, 이벤트 발생 : OnReviewDeletingEvent
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore;
private void InitializeVIZCore3DEvent()
{
vizcore3d.Review.OnReviewDeletingEvent += Review_OnReviewDeletingEvent;
}
private void Review_OnReviewDeletingEvent(object sender, Event.EventManager.ReviewDeletingEventArgs e)
{
Data.ReviewItem item = vizcore3d.Review.GetItem(e.ReviewID);
System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show(
"Are you sure you want to delete?\n : " + item.Title, "Review Delete - " + item.Kind.ToString()
, System.Windows.Forms.MessageBoxButtons.OKCancel);
if (result == System.Windows.Forms.DialogResult.Cancel)
e.Cancel = true;
}
뷰 툴바(View Toolbar) 처리 이벤트 추가 : OnViewToolbarViewChangingEvent, OnViewToolbarViewChangedEvent
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
// 뷰툴바 처리 이전 이벤트
vizcore3d.View.OnViewToolbarViewChangingEvent
+= View_OnViewToolbarViewChangingEvent;
// 뷰툴바 처리 이후 이벤트
vizcore3d.View.OnViewToolbarViewChangedEvent
+= View_OnViewToolbarViewChangedEvent;
}
private void View_OnViewToolbarViewChangingEvent(
object sender
, Event.EventManager.ViewToolbarViewChangingEventArgs e)
{
switch (e.CameraDirection)
{
case Data.CameraDirection.ISO_PLUS:
break;
case Data.CameraDirection.ISO_MINUS:
break;
case Data.CameraDirection.X_PLUS:
break;
case Data.CameraDirection.X_MINUS:
break;
case Data.CameraDirection.Y_PLUS:
break;
case Data.CameraDirection.Y_MINUS:
break;
case Data.CameraDirection.Z_PLUS:
break;
case Data.CameraDirection.Z_MINUS:
break;
default:
break;
}
// if you need...
//e.Cancel = true;
}
private void View_OnViewToolbarViewChangedEvent(
object sender
, Event.EventManager.ViewToolbarViewChangedEventArgs e)
{
switch (e.CameraDirection)
{
case Data.CameraDirection.ISO_PLUS:
break;
case Data.CameraDirection.ISO_MINUS:
break;
case Data.CameraDirection.X_PLUS:
break;
case Data.CameraDirection.X_MINUS:
break;
case Data.CameraDirection.Y_PLUS:
break;
case Data.CameraDirection.Y_MINUS:
break;
case Data.CameraDirection.Z_PLUS:
break;
case Data.CameraDirection.Z_MINUS:
break;
default:
break;
}
}
측정 호출 이벤트 : OnAddMeasureEvent
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
// Add Event
vizcore3d.Review.Measure.OnAddMeasureEvent += Measure_OnAddMeasureEvent;
vizcore3d.Review.Measure.AddBasicPosition(); // Call Measure_OnAddMeasureEvent
//vizcore3d.Review.Measure.AddBasicDistance();
}
private void Measure_OnAddMeasureEvent(object sender, Event.EventManager.MeasureEventArgs e)
{
System.Diagnostics.Trace.WriteLine(e.Kind.ToString());
switch (e.Kind)
{
case Data.MeasureKind.BASIC_POSITION:
// code...
break;
case Data.MeasureKind.BASIC_DISTANCE:
// code...
break;
case Data.MeasureKind.BASIC_ANGLE:
// code...
break;
default:
// code...
break;
}
}
영역내 모델 검색 시, 보이는 모델만 검색하는 옵션 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
float x1, y1, z1, x2, y2, z2;
x1 = 0.0f;
y1 = 0.0f;
z1 = 0.0f;
x2 = 100.0f;
y2 = 100.0f;
z2 = 100.0f;
List<VIZCore3D.NET.Data.Node> items =
vizcore3d.Object3D.FromZone(
x1, y1, z1
, x2, y2, z2
, VIZCore3D.NET.Data.BoundBoxSearchOption.FullyContained
);
}
private void Example2()
{
VIZCore3D.NET.Data.Vertex3D min = new Data.Vertex3D(0, 0, 0);
VIZCore3D.NET.Data.Vertex3D max = new Data.Vertex3D(100, 100, 100);
List<VIZCore3D.NET.Data.Node> items =
vizcore3d.Object3D.FromZone(
min
, max
, VIZCore3D.NET.Data.BoundBoxSearchOption.FullyContained
);
}
private void Example3()
{
VIZCore3D.NET.Data.BoundBox3D boundBox
= new Data.BoundBox3D(
new float[] { 0, 0, 0 }
, new float[] { 100, 100, 100 }
);
List<VIZCore3D.NET.Data.Node> items =
vizcore3d.Object3D.FromZone(boundBox
, VIZCore3D.NET.Data.BoundBoxSearchOption.FullyContained
);
}
표면노트 생성 시, 원형 심벌만 표시 하는 옵션
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
VIZCore3D.NET.Data.NoteStyle style = vizcore3d.Review.Note.GetStyle();
style.UseSymbol = true;
style.SymbolText = "A";
style.TextVisible = false;
VIZCore3D.NET.Data.Vertex3D center = vizcore3d.Object3D.FromIndex(0).GetCenter();
vizcore3d.Review.Note.AddNoteSurface("", center, center, style);
}
컨트롤 생성 시, 모듈 초기화 유형
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example1()
{
string assemblyPath = VIZCore3D.NET.ModuleInitializer.GetAssemblyLocation();
string entryAssemblyPath = VIZCore3D.NET.ModuleInitializer.GetEntryAssemblyLocation();
string assemblyVersion = VIZCore3D.NET.ModuleInitializer.GetLibraryVersion();
string interopVersion = VIZCore3D.NET.ModuleInitializer.GetInteropLibraryVersion();
bool compareVersion = VIZCore3D.NET.ModuleInitializer.CompareVersion();
bool existLibrary = VIZCore3D.NET.ModuleInitializer.ExistLibrary();
// Initialize VIZCore3D.NET
// Extract Library by Condition
if (existLibrary == false || compareVersion == false)
VIZCore3D.NET.ModuleInitializer.Run();
}
private void Example2()
{
// Initialize VIZCore3D.NET
// Extract Library Always
VIZCore3D.NET.ModuleInitializer.Run();
}
컨트롤 초기화 시, Predefined Background Image 선택 방법
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
//===================================
// Environment
//===================================
string assemblyPath = VIZCore3D.NET.ModuleInitializer.GetAssemblyLocation();
string entryAssemblyPath = VIZCore3D.NET.ModuleInitializer.GetEntryAssemblyLocation();
string assemblyVersion = VIZCore3D.NET.ModuleInitializer.GetLibraryVersion();
string interopVersion = VIZCore3D.NET.ModuleInitializer.GetInteropLibraryVersion();
bool compareVersion = VIZCore3D.NET.ModuleInitializer.CompareVersion();
bool existLibrary = VIZCore3D.NET.ModuleInitializer.ExistLibrary();
// Initialize VIZCore3D.NET
// Case 1. : Extract Library by Condition
//if(existLibrary == false || compareVersion == false)
// VIZCore3D.NET.ModuleInitializer.Run();
// Case 2. : Extract Library Always
VIZCore3D.NET.ModuleInitializer.Run();
// Change Background Image
vizcore3d = new VIZCore3D.NET.VIZCore3DControl(BackgroundImage.VIZZARD);
//vizcore3d = new VIZCore3D.NET.VIZCore3DControl(BackgroundImage.HHI);
//vizcore3d = new VIZCore3D.NET.VIZCore3DControl(BackgroundImage.HSHI);
vizcore3d.Dock = DockStyle.Fill;
panelView.Controls.Add(vizcore3d);
// Event
vizcore3d.OnInitializedVIZCore3D += VIZCore3D_OnInitializedVIZCore3D;
}
private void VIZCore3D_OnInitializedVIZCore3D(object sender, EventArgs e)
{
VIZCore3D.NET.Data.LicenseResults result =
vizcore3d.License.LicenseServer("0.0.0.0", 8901);
if (result != Data.LicenseResults.SUCCESS)
{
MessageBox.Show(result.ToString()
, "VIZCore3D.NET"
, MessageBoxButtons.OK
, MessageBoxIcon.Error);
return;
}
// Init. Some Options...
}
컨트롤 초기화 시, Custom Background Image 설정 방법
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
//===================================
// Environment
//===================================
string assemblyPath = VIZCore3D.NET.ModuleInitializer.GetAssemblyLocation();
string entryAssemblyPath = VIZCore3D.NET.ModuleInitializer.GetEntryAssemblyLocation();
string assemblyVersion = VIZCore3D.NET.ModuleInitializer.GetLibraryVersion();
string interopVersion = VIZCore3D.NET.ModuleInitializer.GetInteropLibraryVersion();
bool compareVersion = VIZCore3D.NET.ModuleInitializer.CompareVersion();
bool existLibrary = VIZCore3D.NET.ModuleInitializer.ExistLibrary();
// Initialize VIZCore3D.NET
// Case 1. : Extract Library by Condition
//if(existLibrary == false || compareVersion == false)
// VIZCore3D.NET.ModuleInitializer.Run();
// Case 2. : Extract Library Always
VIZCore3D.NET.ModuleInitializer.Run();
// Set Custom Background Image
Image background = Image.FromFile(
System.IO.Path.Combine(Application.StartupPath, "BACKGROUND_SOFTHILLS.jpg")
);
vizcore3d = new VIZCore3D.NET.VIZCore3DControl(
background
, Data.ImageMode.CENTER
, Color.Gray
);
vizcore3d.Dock = DockStyle.Fill;
panelView.Controls.Add(vizcore3d);
// Event
vizcore3d.OnInitializedVIZCore3D += VIZCore3D_OnInitializedVIZCore3D;
}
private void VIZCore3D_OnInitializedVIZCore3D(object sender, EventArgs e)
{
VIZCore3D.NET.Data.LicenseResults result =
vizcore3d.License.LicenseServer("0.0.0.0", 8901);
if (result != Data.LicenseResults.SUCCESS)
{
MessageBox.Show(
result.ToString()
, "VIZCore3D.NET"
, MessageBoxButtons.OK
, MessageBoxIcon.Error
);
return;
}
// Init. Some Options...
}
어셈블리 구조 조회 및 선택 다이얼로그 활용
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
VIZCore3D.NET.Data.Node selectedNode
= vizcore3d.Object3D.ShowAssemblyBrowserDialog();
if (selectedNode == null) return;
MessageBox.Show(selectedNode.NodeName);
}
어셈블리 구조 조회 및 선택 다이얼로그 활용 (특정 노드 하이라이트)
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
List<VIZCore3D.NET.Data.Node> currentSelectedNode =
vizcore3d.Object3D.FromFilter(Data.Object3dFilter.SELECTED_TOP, false);
VIZCore3D.NET.Data.Node selectedNode
= vizcore3d.Object3D.ShowAssemblyBrowserDialog(
currentSelectedNode.Count != 0 ? currentSelectedNode[0] : null);
if (selectedNode == null) return;
MessageBox.Show(selectedNode.NodeName);
}
어셈블리 구조 조회 및 선택 사용자정의 컨트롤
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
VIZCore3D.NET.Controls.AssemblyBrowserControl ctrl
= vizcore3d.Object3D.GetAssemblyBrowserControl();
Form form = new Form();
form.Controls.Add(ctrl);
if (form.ShowDialog() != DialogResult.OK) return;
VIZCore3D.NET.Data.Node selectedNode =
ctrl.SelectedNode;
if (selectedNode == null) return;
MessageBox.Show(selectedNode.NodeName);
}