0

I have a drawing with hatched views (sections, detail views). Next, I created a simple macro (the business logic is shown below). The problem is, in sections, the first output of the compCount variable does not match the second output of the variable's value. Is this a SW problem or is there a bug in my code?

    public void EditFaceHatches(DrawingDoc drawing)
    {
        View view = drawing.GetFirstView();
        while (view != null)
        {
            if (view.Type == (int)swDrawingViewTypes_e.swDrawingSheet)
            {
                view = view.GetNextView();
                continue;
            }
            Debug.Print("View: " + view.Name);
            int compCount = view.GetVisibleComponentCount(); // FIRST
            Debug.Print("   visible components before: " + compCount);
            if (view.GetFaceHatchCount() > 0)
            {
                foreach (FaceHatch fhatch in view.GetFaceHatches())
                {
                    fhatch.UseMaterialHatch = false;
                    fhatch.Angle = fhatch.Angle + (10 / 57.3);
                }
            }
            compCount = view.GetVisibleComponentCount(); // SECOND
            Debug.Print("   visible components after: " + compCount);
            Debug.Print("");
            view = view.GetNextView();
        }
    }
Nicomed
  • 1
  • 1

1 Answers1

0

After editing the Face Hatch, you need to use drawing.ForceRebuild().

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Nicomed
  • 1
  • 1