Sample
CAD 모델 열기(추가) 시, 노드 병합 규칙 설정/해제
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
string rulePath = "C:\Rule.xml";
string modelPath = "C:\Model.rvm";
vizcore3d.Model.SetMergeNodeRuleFile(rulePath);
vizcore3d.Model.Open(modelPath);
vizcore3d.Model.ClearMergeNodeRuleFile();
}
KeyUp 이벤트 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.OnVIZCore3DKeyUp += VIZCore3D_OnVIZCore3DKeyUp;
}
private void VIZCore3D_OnVIZCore3DKeyUp(object sender, Event.EventManager.VIZCoreKeyUpEventArgs e)
{
if(e.KeyCode == Keys.A)
{
// Control Key is Pressed
if(e.Ctrl == true)
{
}
// Alt Key is Pressed
if(e.Alt == true)
{
}
// Shift Key is Pressed
if(e.Shift == true)
{
}
}
}
개체 선택 이전 이벤트 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.Object3D.OnObject3DSelecting += Object3D_OnObject3DSelecting;
}
private void Object3D_OnObject3DSelecting(object sender, Event.EventManager.Object3DSelectingEventArgs e)
{
// 선택된 모델 이름에 "PIPE" 이름이 포함된 경우에
if(e.Node.NodeName.Contains("PIPE") == true)
{
// 선택 가능
e.Cancel = false;
}
else
{
// 선택 취소
e.Cancel = true;
}
}
개체 이동/회전 핸들 기능(표준, 축 이동, 축 회전, 평행면 이동) 옵션 설정
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
if (vizcore3d.Model.IsOpen() == false) return;
if (vizcore3d.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.SELECTED_TOP, false).Count == 0) return;
// Default
vizcore3d.Object3D.Transform.EnableHandle = true;
}
private void Example1()
{
if (vizcore3d.Model.IsOpen() == false) return;
if (vizcore3d.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.SELECTED_TOP, false).Count == 0) return;
// 축 기준 이동
vizcore3d.Object3D.Transform.HandleMode = VIZCore3D.NET.Manager.TransformManager.HandleModes.MoveByAxis;
vizcore3d.Object3D.Transform.EnableHandle = true;
}
private void Example2()
{
if (vizcore3d.Model.IsOpen() == false) return;
if (vizcore3d.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.SELECTED_TOP, false).Count == 0) return;
// 평행면 이동
vizcore3d.Object3D.Transform.HandleMode = VIZCore3D.NET.Manager.TransformManager.HandleModes.MoveByPlane;
vizcore3d.Object3D.Transform.EnableHandle = true;
}
private void Example3()
{
if (vizcore3d.Model.IsOpen() == false) return;
if (vizcore3d.Object3D.FromFilter(VIZCore3D.NET.Data.Object3dFilter.SELECTED_TOP, false).Count == 0) return;
// 축 기준 회전
vizcore3d.Object3D.Transform.HandleMode = VIZCore3D.NET.Manager.TransformManager.HandleModes.RotateByAxis;
vizcore3d.Object3D.Transform.EnableHandle = true;
}
빈(Empty) 모델 생성 기능
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
vizcore3d.Model.NewEmptyModel("MODEL");
}
Node 및 Body 생성
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
}
Node 및 Body 생성 시, Mesh 형식으로 형상 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
string assemblyName = string.Format("Assembly #{0}", vizcore3d.Object3D.GetNodeCount());
VIZCore3D.NET.Data.Node assembly = vizcore3d.MeshEdit.CreateNode(0, VIZCore3D.NET.Data.NodeKind.ASSEMBLY, assemblyName);
if (assembly == null) return;
string partName = string.Format("Part #{0}", vizcore3d.Object3D.GetNodeCount());
VIZCore3D.NET.Data.Node part = vizcore3d.MeshEdit.CreateNode(assembly.Index, VIZCore3D.NET.Data.NodeKind.PART, partName);
if (part == null) return;
string bodyName = string.Format("Body #{0}", vizcore3d.Object3D.GetNodeCount());
List<VIZCore3D.NET.Data.Vertex3D> coords = new List<VIZCore3D.NET.Data.Vertex3D>();
List<VIZCore3D.NET.Data.Vertex3D> normals = new List<VIZCore3D.NET.Data.Vertex3D>();
coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 0.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 0.0, 1000.0));
coords.Add(new Data.Vertex3D(1000.0, 1000.0, 1000.0));
coords.Add(new Data.Vertex3D(0.0, 1000.0, 1000.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, -1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, -1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, -1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, -1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, -1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, -1.0));
normals.Add(new Data.Vertex3D(-1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(-1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(-1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(-1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(-1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(-1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 1.0, 0.0));
normals.Add(new Data.Vertex3D(1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(1.0, 0.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, -1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, -1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, -1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, -1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, -1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, -1.0, 0.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, 1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, 1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, 1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, 1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, 1.0));
normals.Add(new Data.Vertex3D(0.0, 0.0, 1.0));
int id = vizcore3d.MeshEdit.CreateBodyWithMesh(part.Index, bodyName, coords, normals, Color.Orange);
if (id == -1)
MessageBox.Show("NG", "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
MessageBox.Show(string.Format("Body ID : {0}", id), "VIZCore3D.NET", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
Body 노드에 Pyramid Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
SizeF bottom = new SizeF(30, 40);
SizeF top = new SizeF(10, 20);
SizeF offset = new SizeF(2.5f, 4.5f);
float height = 50;
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitivePyramid(
bodyIndex /* Body Node Index */
, bottom /* Bottom Of Size */
, top /* Top Of Size */
, offset /* Offset Of Size */
, height /* Height */
, matrix /* Matrix */
, Color.Green /* Color */
, 1 /* System Type */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Box(Cube) Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
List<float> length = new List<float>() { 1000.0f, 2000.0f, 3000.0f };
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveBox(
bodyIndex /* Body Node Index */
, length /* Length */
, matrix /* Matrix */
, Color.Orange /* Color */
, 1.0f /* Scale */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Rectangular Torus Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
List<float> radius = new List<float>();
radius.Add(10); // Inside Radius
radius.Add(20); // Outside Radius
float height = 15;
float angle = 90; // Degree
int numSection = 4;
//int numSection = Convert.ToInt32(angle / 10);
//int numSection = Convert.ToInt32(angle / 15);
//int numSection = Convert.ToInt32(angle);
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveRectangularTorus(
bodyIndex /* Body Node Index */
, radius /* Radius */
, height /* Height */
, angle /* Angle */
, matrix /* Matrix */
, Color.Green /* Color */
, numSection /* Number Of Section */
, 4 /* Number of Side (4) */
, 1.0f /* Unit Scale (1.0f) */
, 0 /* Detail Level (0) */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Circular Torus Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
List<float> radius = new List<float>();
radius.Add(10); // Inside Radius
radius.Add(20); // Outside Radius
float angle = 90f; // Degree
int numberSide = 12; // Default(12). 6 ~ 36
int numberSection = 10;
//int numberSection = Convert.ToInt32(angle / 10);
//int numberSection = Convert.ToInt32(angle / 15);
//int numberSection = Convert.ToInt32(angle);
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveCircularTorus(
bodyIndex /* Body Node Index */
, radius /* Radius */
, angle /* Angle */
, numberSide /* Number of Side (12). 6~36 */
, numberSection /* Number Of Section */
, matrix /* Matrix */
, Color.Green /* Color */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Dish Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
int numberSide = 12;
int numberSlice = 12;
List<float> radius = new List<float>();
radius.Add(20); // Bottom Radius
radius.Add(10); // Top Radius
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveDish(
bodyIndex /* Body Node Index */
, radius /* Radius */
, numberSide /* Number of Side */
, numberSlice /* Number Of Slice */
, matrix /* Matrix */
, Color.Green /* Color */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Spherical Cap Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
float radius = 29.0f;
float height = 6.0f;
int numberSide = 12;
int numberSection = 12;
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveSphericalCap(
bodyIndex /* Body Node Index */
, radius /* Radius */
, height /* Height */
, numberSide /* Number of Side */
, numberSection /* Number Of Section */
, matrix /* Matrix */
, Color.Green /* Color */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Cone Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
/* Radius : Top[0], Bottom[1] */
List<float> radius = new List<float>() { 1000.0f, 1000.0f };
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 1000.0f;
matrix.Matrix[10] = 1000.0f;
matrix.Matrix[11] = 2000.0f;
vizcore3d.MeshEdit.AddPrimitiveCone(
bodyIndex /* Body Node Index */
, radius /* Radius */
, 2000.0f /* Height */
, matrix /* Matrix */
, Color.Blue /* Color */
, 12 /* Side Count */
, 1.0f /* Scale */
, 1 /* System Type */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Cylinder Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
float radius = 1000.0f;
float height = 2000.0f;
int sideCount = 12;
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveCylinder(
bodyIndex /* Body Node Index */
, radius /* Radius */
, height /* Height */
, matrix /* Matrix */
, Color.Green /* Color */
, sideCount
, false /* Rebuild Data */
);
}
{
VIZCore3D.NET.Data.Vertex3D start = new VIZCore3D.NET.Data.Vertex3D(1000.0f, 1000.0f, 1000.0f);
VIZCore3D.NET.Data.Vertex3D end = new VIZCore3D.NET.Data.Vertex3D(0.0f, 0.0f, 0.0f);
float radius = 500.0f;
int id = vizcore3d.MeshEdit.AddPrimitiveCylinder(
bodyIndex /* Body Node Index */
, start /* Radius */
, end /* Height */
, radius /* Radius */
, Color.Orange /* Color */
, 12 /* Side Count */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}
Body 노드에 Sphere Primitive 생성 (혹은 추가) 기능 추가
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
public void Example()
{
// New Empty Model
int index = vizcore3d.Model.NewEmptyModel("MODEL");
string assemblyName = "ASSEMBLY";
VIZCore3D.NET.Data.Node assemblyNode =
vizcore3d.Structure.CreateNode(
index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.ASSEMBLY /* Node Kind */
, assemblyName /* Node Name */
);
string partName = "PART";
VIZCore3D.NET.Data.Node partNode =
vizcore3d.Structure.CreateNode(
assemblyNode.Index /* Parent Node Index */
, VIZCore3D.NET.Data.NodeKind.PART /* Node Kind */
, partName /* Node Name */
);
string bodyName = "BODY";
int bodyId =
vizcore3d.Structure.CreateBody(
partNode.Index /* Parent Node Index */
, bodyName /* Node Name */
);
int bodyIndex = vizcore3d.Object3D.GetBodyIndex(bodyId);
{
VIZCore3D.NET.Data.Matrix3D matrix = new VIZCore3D.NET.Data.Matrix3D();
matrix.Matrix[0] = 1.0f;
matrix.Matrix[1] = 0.0f;
matrix.Matrix[2] = 0.0f;
matrix.Matrix[3] = 0.0f;
matrix.Matrix[4] = 1.0f;
matrix.Matrix[5] = 0.0f;
matrix.Matrix[6] = 0.0f;
matrix.Matrix[7] = 0.0f;
matrix.Matrix[8] = 1.0f;
matrix.Matrix[9] = 0.0f;
matrix.Matrix[10] = 0.0f;
matrix.Matrix[11] = 0.0f;
vizcore3d.MeshEdit.AddPrimitiveSphere(
bodyIndex /* Body Node Index */
, 100.0f /* Radius */
, matrix /* Matrix */
, Color.Green /* Color */
, 1 /* Detail Level */
, false /* Rebuild Data */
);
}
vizcore3d.Structure.RebuildData();
}