Setting System Variables in VB.Net - ANSWERED

I'm converting a program that I used in AutoCad to be used with BricsCAD and some commands didn't translate.
Dim podDWG As Document = Application.DocumentManager.MdiActiveDocument
Dim podDB As Database = podDWG.Database
Dim podEd As Editor = podDWG.Editor

ApplicationServices.Application.SetSystemVariable("OSMODE", 0) <--This doesn't work as "Application is notr a member of Microsoft.VisualBasic.ApplicationServices"

What is the equivalent command to set SystemVariables with VB.Net when using BricsCAD?

Thanks

Comments

  • You are accessing the wrong Application.
    Bricscad.ApplicationServices.Application

  • James Maeding
    edited July 2020

    That is a workspace overlap issue related to your references, not a bricscad issue.
    Simply preface the ApplicationServices with full bricscad api lineage.

    Note that when writing .net code for acad and bcad, its better to use project variables and an alias like (in c#):
    (pound sign) if ACAD
    using AcAp = Autodesk.AutoCAD.ApplicationServices.Application;
    (pound sign)endif
    (pound sign) if BCAD
    using AcAp = Bricscad.ApplicationServices.Application;
    (pound sign)endif

    That way you call things with the alias like:
    AcAp.DocumentManager.MdiActiveDocument.Database

    and the code works for both acad and bcad projects.
    You set that ACAD or BCAD variable in the project "Conditional Compilation Symbols".

    My using section typically looks like this for each file:
    (pound sign)if ACAD
    using Autodesk.AutoCAD.Runtime;
    using Autodesk.AutoCAD.ApplicationServices;
    using AcAp = Autodesk.AutoCAD.ApplicationServices.Application;
    using Autodesk.AutoCAD.EditorInput;
    using AcEd = Autodesk.AutoCAD.EditorInput;
    using Autodesk.AutoCAD.DatabaseServices;
    using AcDb = Autodesk.AutoCAD.DatabaseServices;
    using Autodesk.AutoCAD.Geometry;
    using AcGe = Autodesk.AutoCAD.Geometry;
    using AcCo = Autodesk.AutoCAD.Colors;
    using Autodesk.AutoCAD.Windows;
    using Autodesk.AutoCAD.GraphicsInterface;
    (pound sign)endif

    (pound sign)if BCAD
    using Bricscad.Runtime;
    using Bricscad.ApplicationServices;
    using AcAp = Bricscad.ApplicationServices.Application;
    using Bricscad.EditorInput;
    using AcEd = Bricscad.EditorInput;
    using Teigha.DatabaseServices;
    using AcDb = Teigha.DatabaseServices;
    using Teigha.Geometry;
    using AcGe = Teigha.Geometry;
    using AcCo = Teigha.Colors;
    using Bricscad.Windows;
    using Teigha.GraphicsInterface;
    (pound sign)endif

  • Thank you both for the information.