Extrusion.WallSurface bug?

Hi all,

I’m having issues with getting curves, walls, ceiling and floor and Mesh from the Extrusion class. (ToBrep() works fine)

It’s just returning nulls with even simple polyline inputs, see below

 private void RunScript(Curve Crv, ref object extrusion, ref object extrusionFloor, ref object extrusionRoof, ref object extrusionWalls, ref object mesh)
    if (Crv == null) return;

    Plane plane = Plane.Unset;
    if(Crv.TryGetPlane(out plane))
      Extrusion ex = Rhino.Geometry.Extrusion.Create(Crv, 100, true);
      extrusion = ex;

      Surface floor = ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionCapSurface, 0));
      extrusionFloor = floor;

      Surface roof = ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionCapSurface, 1));
      extrusionRoof = roof;

      List<Surface> wallSurfaces = new List<Surface>();

      for (int i = 0; i < int.MaxValue; i++)
        Surface sr = ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionWallSurface, i));
        if (sr == null)
      extrusionWalls = wallSurfaces;

      Mesh m = ex.GetMesh(MeshType.Default);
      mesh = m;


@dale i see you moved this to GH but it’s a RhinoCommon bug that I’m struggling with even so in a Rhino plugin.

The Extrusion has following issues:

ex.GetMesh() => null
ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionWallSurface, 0)) => null
ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionCapSurface, 0)) => null
ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionCapSurface, 1)) => null
ex.ToBrep() //works fine but kind of eliminates my purpose of using a lightweight class.
Mesh.CreateFromBrep(ex.ToBerep()) //works fine but is a stupid overhead.

I just tested this again in Rhino8 and problem persists.

Hi @sonderskovmathias,

Can you provide something we can use to test?


– Dale

Hi Dale, sure,

The code for a c# component was provided in the first post.

Attaching it as a gh file and adding a few more methods that return nulls.
I ran the same code in a rhino plugin with same results.

Maybe I’m missing something in the documentation, but i dont get the returns that I’m expecting.

 private void RunScript(
	Curve Crv,
	ref object extrusion_,
	ref object extrusionFloor_,
	ref object extrusionRoof_,
	ref object extrusionWalls_,
	ref object defaultMesh_,
	ref object renderMesh_,
	ref object toBrep_,
	ref object toNurbs_,
	ref object bottomProfile_,
	ref object topProfile_,
	ref object wallEdge_,
	ref object profile3d_)
      Extrusion ex = Rhino.Geometry.Extrusion.Create(Crv, 100, true);
      extrusion_ = ex;

    // https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.extrusion/wallsurface
     // https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.componentindextype
      extrusionFloor_ = ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionCapSurface, 0)); // -> null

      extrusionRoof_ = ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionCapSurface, 1)); // -> null

      List<Surface> wallSurfaces = new List<Surface>();

      for (int i = 0; i < int.MaxValue; i++)
        Surface sr = ex.WallSurface(new ComponentIndex(ComponentIndexType.ExtrusionWallSurface, i)); // -> null
        if (sr == null)
      extrusionWalls_ = wallSurfaces;

      defaultMesh_ = ex.GetMesh(MeshType.Default); // -> null
      renderMesh_ = ex.GetMesh(MeshType.Render); // -> null
      toBrep_ = ex.ToBrep();
      toNurbs_ = ex.ToNurbsSurface();
      bottomProfile_ = ex.WallEdge(new ComponentIndex(ComponentIndexType.ExtrusionBottomProfile, 0)); // -> null
      topProfile_ = ex.WallEdge(new ComponentIndex(ComponentIndexType.ExtrusionTopProfile, 0)); // -> null
      wallEdge_ = ex.WallEdge(new ComponentIndex(ComponentIndexType.ExtrusionWallEdge, 0));

      profile3d_ = ex.Profile3d(0,0);


ExtrusionMethods.gh (16.5 KB)