コード例 #1
0
        private void Object3D_OnObject3DSelected(object sender, Event.EventManager.Object3DSelectedEventArgs e)
        {
            bool enable = ckEnable.Checked;

            if (enable == false)
            {
                return;
            }

            if (e.Node.Count == 0)
            {
                vizcore3d.Section.Clear();
                return;
            }

            bool modelBoundBox = ckModelBoundBox.Checked;
            bool parentObject  = ckParentObject.Checked;
            bool margin        = ckMargin.Checked;

            float marginX = Convert.ToSingle(txtX.Text);
            float marginY = Convert.ToSingle(txtY.Text);
            float marginZ = Convert.ToSingle(txtZ.Text);

            VIZCore3D.NET.Data.BoundBox3D sectionBoxSize;

            if (modelBoundBox == true)
            {
                sectionBoxSize = vizcore3d.Model.BoundBox;
            }
            else
            {
                if (parentObject == false)
                {
                    sectionBoxSize = vizcore3d.Object3D.GeometryProperty.FromSelectedObject3D().GetBoundBox();
                }
                else
                {
                    sectionBoxSize = vizcore3d.Object3D.GeometryProperty.FromNode(e.Node[0].GetParent(), false).GetBoundBox();
                }
            }

            if (margin == true)
            {
                sectionBoxSize.MinX -= marginX * 0.5f;
                sectionBoxSize.MinY -= marginY * 0.5f;
                sectionBoxSize.MinZ -= marginZ * 0.5f;

                sectionBoxSize.MaxX += marginX * 0.5f;
                sectionBoxSize.MaxY += marginY * 0.5f;
                sectionBoxSize.MaxZ += marginZ * 0.5f;
            }

            vizcore3d.BeginUpdate();

            VIZCore3D.NET.Data.Section section = vizcore3d.Section.AddBox(false);
            vizcore3d.Section.SetBoxSize(section.ID, sectionBoxSize);

            vizcore3d.EndUpdate();
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (vizcore3d.Model.IsOpen() == false)
            {
                return;
            }

            if (vizcore3d.Section.Sections.Count != 0)
            {
                vizcore3d.Section.Clear();
            }

            if (rbSection.Checked == true)
            {
                if (ckMulti.Checked == false)
                {
                    VIZCore3D.NET.Data.Section section = vizcore3d.Section.Add(false, Data.Axis.X);
                    //vizcore3d.Section.Clipping = Manager.SectionManager.ClippingTypes.ONE_WAY_CLIPPING;
                    //vizcore3d.View.MoveCamera(Data.CameraDirection.X_MINUS);
                }
                else
                {
                    float offset = Convert.ToSingle(txtOffset.Text);
                    VIZCore3D.NET.Data.BoundBox3D boundBox = vizcore3d.Model.BoundBox;
                    float length = boundBox.LengthX;
                    float unit   = length / offset;

                    vizcore3d.BeginUpdate();
                    for (int i = 1; i < Convert.ToInt32(unit); i++)
                    {
                        VIZCore3D.NET.Data.Section section = vizcore3d.Section.Add(false, Data.Axis.X);
                        float[] pos = vizcore3d.Section.GetCenterPosition(section.ID, -1);
                        vizcore3d.Section.SetCenterPosition(section.ID, -1, boundBox.MinX + (offset * i), pos[1], pos[2]);
                    }
                    vizcore3d.EndUpdate();
                }
            }
            else if (rbSectionBox.Checked == true)
            {
                VIZCore3D.NET.Data.Section section = vizcore3d.Section.AddBox(false, 0);
            }

            DrawLine();
        }