Ejemplo n.º 1
0
        void update_cut_op()
        {
            List <ModelingOpException> exceptions = null;

            if (cut_parameters_dirty)
            {
                CutOp.HoleSize         = hole_size;
                CutOp.HoleSubdivisions = subdivisions;
                CutOp.ThroughHole      = through_hole;
                CutOp.HoleDepth        = hole_depth;
                cut_parameters_dirty   = false;
            }

            try {
                DMeshOutputStatus result = ComputeOp.CheckForNewMesh();
                is_computing = (result.State == DMeshOutputStatus.States.Computing);
                if (result.State == DMeshOutputStatus.States.Ready)
                {
                    current_result_ok = (result.IsErrorOutput() == false);

                    var setMesh = result.Mesh;
                    if (result.Mesh.CompactMetric < 0.8)
                    {
                        setMesh = new DMesh3(result.Mesh, true);
                    }
                    CutPreviewSO.ReplaceMesh(setMesh, true);
                    CutPreviewSO.AssignSOMaterial((current_result_ok) ? CutPreviewMaterial : ErrorMaterial);

                    exceptions = result.ComputeExceptions;
                }
            } catch (Exception e) {
                DebugUtil.Log(2, Name + "Tool.PreRender: caught exception! " + e.Message);
            }

            if (ComputeOp.HaveBackgroundException)
            {
                Exception e = ComputeOp.ExtractBackgroundException();
                if (VerboseOutput)
                {
                    DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute: " + e.Message);
                    DebugUtil.Log(2, e.StackTrace);
                }
            }

            if (exceptions != null && VerboseOutput)
            {
                foreach (var mopex in exceptions)
                {
                    DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute " + mopex.op.GetType().ToString() + " : " + mopex.e.Message);
                    DebugUtil.Log(2, mopex.e.StackTrace);
                }
            }
        }
Ejemplo n.º 2
0
        virtual public void PreRender()
        {
            if (in_shutdown())
            {
                return;
            }

            List <ModelingOpException> exceptions = null;

            try {
                DMeshOutputStatus result = ComputeOp.CheckForNewMesh();
                is_computing = (result.State == DMeshOutputStatus.States.Computing);
                if (result.State == DMeshOutputStatus.States.Ready)
                {
                    process_new_result(result);
                    current_result_ok = (result.IsErrorOutput() == false);

                    var setMesh = result.Mesh;
                    if (result.Mesh.CompactMetric < 0.8)
                    {
                        setMesh = new DMesh3(result.Mesh, true);
                    }
                    PreviewSO.ReplaceMesh(setMesh, true);
                    PreviewSO.AssignSOMaterial((current_result_ok) ? PreviewMaterial : ErrorMaterial);

                    exceptions = result.ComputeExceptions;
                }
            } catch (Exception e) {
                DebugUtil.Log(2, Name + "Tool.PreRender: caught exception! " + e.Message);
            }

            if (ComputeOp.HaveBackgroundException)
            {
                Exception e = ComputeOp.ExtractBackgroundException();
                DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute: " + e.Message);
                DebugUtil.Log(2, e.StackTrace);
            }

            if (exceptions != null)
            {
                foreach (var mopex in exceptions)
                {
                    DebugUtil.Log(2, GetType().ToString() + ".PreRender: exception in background compute " + mopex.op.GetType().ToString() + " : " + mopex.e.Message);
                    DebugUtil.Log(2, mopex.e.StackTrace);
                }
            }
        }