Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Setting System Variables in VB.Net

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

  • edited July 30

    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.

Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam