Solid Hatch not display before I drag the hatch

Hey,
I tried using some code to add solid fill patterns to closed curves in bulk, but after running the code, I couldn’t see any fill patterns.
When I selected all the shapes in the viewport, the command line showed that the fill patterns were already selected, which means the fill patterns were successfully created.
When I dragged or stretched the fill patterns using the control axis, they reappeared. What’s going on here?
Solid Hatch Problern
Solid Hatch not display.3dm (240.8 KB)

Hi -

When I open the file and run SelBadObjects, the hatch object is selected.
You might want to provide the code that you used to create this object.
-wim

Hi Wim Dekeyser, The code to create solid hatch is below

                          foreach(Curve crv in Crvs)
                          {
                              if (crv.IsClosed)
                              {
                                  if(crv.ClosedCurveOrientation(Plane.WorldXY) == CurveOrientation.Clockwise)
                                      crv.Reverse();
                                  
                                  Hatch[] hatchs = Hatch.Create(crv, (int)HatchIndex, RhinoMath.ToRadians(HatchRotation), HatchScale, doc.ModelAbsoluteTolerance);
                                  foreach (Hatch hatch in hatchs)
                                  {
                                      if(hatch != null)
                                      {
                                          hatch.Plane = Plane.WorldXY;
                                          doc.Objects.AddHatch(hatch, obj_attr);
                                      }
                                  }
                              }
                          }

Hi @1056960357,

Seems like you need to Redraw when your finished.

doc.Views.Redraw();

– Dale

Hi Dale @dale
I don’t think so.the problem file attach below the post
Solid Hatch not display.3dm (240.8 KB)