Morphing does not work fine in Rhino 6 but in Rhino 5 works perfectly

Hi @Dale @will ,

When the size of the mesh that you are going to morph is large then it gives this error:

Error

The code that generates this error during execution is:

    Mesh m2d;
    GeometryBase geom;

    //Where m2d is the mesh with less resolution
    //geom is the mesh with full resolution


      morph = new TMorphTranslateMesh( );
      morph.SetWorkingMeshes( ref m2d );
      morph.PreserveStructure = false;
      morph.QuickPreview = true;
      morph.Tolerance = 1.0;
                 

     resultMorph = morph.Morph( geom );
class TMorphTranslateMesh : SpaceMorph
 {

      Point3d pt3d;
      private Mesh m2d;
      public override Point3d MorphPoint( Point3d pt2d )
      { 

           pt3d = pt2d;
             
           cp = m2d.ClosestMeshPoint( pt2d, 0.0 );

           [...]
      
          return pt3d;
    }

This is an example that makes it fail

Error de Morph.3dm (10.7 MB)

Hi @Dale, @will

Have you been able to look at something on this topic?

Thanks

Hi @Eliseo,

Can you provide source code for a sample command, that I can run here, that does not work for you?

— Dale

Hi @dale

Yes of course, here you have the code

using Rhino.Geometry;
using Rhino.Input.Custom;
using Rhino.DocObjects;

    internal class MorphExample: SpaceMorph
    {
        private Point3d pt3d;
        private Mesh m2d;
        private MeshPoint cp;

        internal MorphExample( )
        {
            m2d = null;
        }

        internal void SetWorkingMeshes( ref Mesh _m2d )
        {
            m2d = _m2d;
        }

        public override Point3d MorphPoint( Point3d pt2d )
        {
            pt3d = pt2d;

            cp = m2d.ClosestMeshPoint( pt2d, 0.0 );

            return pt3d;
        }
    }

    internal bool example( )
        {
            Mesh m2d, m;
            MorphExample morph;
            GeometryBase geom;
            GetObject go, go2;

            go2 = new GetObject( );
            go2.SetCommandPrompt( "Select FULL mesh" );
            go2.GeometryFilter = ObjectType.Mesh;
            go2.EnablePreSelect( false, false );
            go2.Get( );
            if ( go2.CommandResult( ) != Result.Success ) return false;

            go = new GetObject( );
            go.SetCommandPrompt( "Select SIMPLE mesh" );
            go.GeometryFilter = ObjectType.Mesh;
            go.EnablePreSelect( false, false );
            go.Get( );

            m2d = go.Object( 0 ).Mesh( ).DuplicateMesh( );
            if ( m2d == null ) return false;

            morph = new MorphExample( );
            morph.SetWorkingMeshes( ref m2d );
            morph.PreserveStructure = false;
            morph.Tolerance = 1.0;

            geom = go2.Object( i ).Geometry( ).Duplicate( );
            if ( SpaceMorph.IsMorphable( geom ) )
                morph.Morph( geom );

            return true;
        }

Is this enough for you?

Please, try it with the example provided above. The “FULL” mesh is the mesh with a lot of poligons,

Eliseo

Hi @Eliseo,

I am able to repeat what you are seeing. I’ve reported the issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-45038

– Dale

OK thanks

Just tell you that the error is extendable to any type of morph, not just the spacemorph

Eliseo

Hi @dale, @stevebaer

I can not distribute our plugin in Rhino 6 until this bug is fixed. Do you know when it will be fixed more or less?

Thanks

Hi @Eliseo,

What is your plug-in? Is it on Food4Rhino?

– Dale

No, it is icad3DP / Sole3D

Hi @dale,

If you need help or more examples, let me know. Everything seems to indicate that the error is generated in the morhpoint

Eliseo

Hi @dale

There is an update of Rhino 6 on 04/05/2018 (6.4.18124.12321), Do you know if the issue
https://mcneel.myjetbrains.com/youtrack/issue/RH-45038
has been updated in this version or will it not be available until SR 5?

Thanks

Hi @Eliseo,

Yes, the fix will be available in SR5.

– Dale