C# Multileader creation. Doesn't fail. Doesn't work either

I've got some code that works in AutoCAD, but doesn't give me the result I expect in BricsCAD.

I've isolated code that demonstrates that my CreateTextMultileader method isn't failing, yet I don't get the multileader I expect.

When I say "don't get" that takes a little extra explaining.

I do get a multileader. I just can't see it.

If I run the SELECT command, I get a selection and I can see that I get a white leader colour, "Contents" is what I expect and I can see grips.

Created multileader.

Is there something specific to BricsCAD that I'm missing?

I've attached the code in the txt file.

Comments

  • Sakko
    edited December 2022
    I had a similar problem...entities that were created and could be selected but were not displayed ...!?
    It turned out to be a bug...so try different Bricscad versions V22 or V23....
  • Sakko
    edited December 2022
    deleted!
  • I have compiled and used your routine in V22.2.06 and V23.1.06.
    It works without any problems, i cannot reproduce the behavior you describe !
    Try a different computer, version....? It might be a local problem....
    This is the result


  • Konstantin, thanks for your reply.

    I'm both pleased and disappointed that the code I supplied worked for you.

    Pleased that it compiled, disappointed that it worked. Always nice to have someone replicate your experience.

    Finding the needle in this haystack should be... fun?

    Out of interest, which .NET version did you compile against? I had to move to VS2022 recently and that defaults to .NET 4.8, requiring an additional download to step backwards.

    I've bitten the bullet and have started compiling previous code to .NET 4.8.

    I note that both V22 and V23 use .NET 4.8.
  • I use .NET 4.8 as well ! It could be the graphics card or the video driver
    Just run the attached assembly on a very different computer with different graphics system.....
  • On hardware specs before I grab the latest NVidia driver.

    I'm running:
    • PC Specs:
      • Lenovo P520c tower
      • Intel Xeon W2223 CPU @ 3.6GHz
      • 32GB RAM
      • Windows 10 Enterprise (64 bit)
        • Version 21H2
        • OS build : 19044.2251
    • Graphics Card:
      • NVidia Quadro P2200
      • Bios Version: 86.6.77.0.3
      • Driver Version: 30.0.14.7284. Also seen as 472.84
      • 5GB Dedicated RAM
      • 16GB (ish) Shared system memory
      • According to OpenGL Extensions Viewer 6.3.8.0:
        • OpenGL Version: 4.6
        • DirectX Supported Profiles: 11.4, 12.1

    Is there anything in there that raises any flags?
  • Just updated the NVidia driver to 31.0.15.2727 (aka 527.27).

    That has made no difference. I still get an invisible leader.

    As for trying other PCs, we've currently only got two seats available. It's a long story.

    It may take me a bit to get the other one installed on a PC that's different enough.
  • Found it!

    We use Annotative Scaling... everywhere. Because it's useful in our context. If you aren't using an annotative multileader style, then the code is fine.

    After these steps, both AutoCAD and BricsCAD have set the leader to Annotative.
    AcDb.MLeader leader = new AcDb.MLeader();
    leader.SetDatabaseDefaults();
    It appears that in AutoCAD, "SetDatabaseDefaults()" also attaches the current annotative scale, but BricsCAD does not.

    BricsCAD result:
    BricsCAD Annotation Scale Missing

    AutoCAD result:
    AutoCAD Annotation Scale Present

    In BricsCAD, this causes the multileader to be 'present' but not visible, as above.

    As soon as an annotative scale is assigned, hey presto, one multileader.
    BricsCAD Annotation Scale Added

    So I've added this to the code and it works:
    #if BRX_APP
                    if (leader.Annotative == AcDb.AnnotativeStates.True)
                    {
                        AcDb.ObjectContextManager ocm = acDB.ObjectContextManager;
                        AcDb.ObjectContextCollection occ = ocm.GetContextCollection("ACDB_ANNOTATIONSCALES");
                        string cAnno = AcAp.Application.GetSystemVariable("CANNOSCALE").ToString();
                        leader.AddContext(occ.GetContext(cAnno));
                    }
    #endif
    You can't see the contexts when debugging. They're obviously not a public property. Hence the AddContext(), HasContext() and RemoveContext() methods on the object.
  • nice find!