Quickly convert code files from AutoCAD .NET to BricsCAD .NET

Hello everyone.
My first project converted from AutoCAD to BricsCAD started nearly 2 years ago. The old code files have changed a lot so I decided to convert again.

This time, I don't manually find/replace any more. I found a more efficient way:

*

Step 1: Find the old but good TextCrawler 2.5 software. (Must be V2.5 because it is free and has the Batch Editor feature. You can support the author of TextCrawler by using V3.x Pro paid version)

Step 2: Prepare a list of Find - Replace strings and save it to reuse later

I have prepared a sample file for VB.net in the attachment below.

Click the Load button to load the TextCrawler_Replace_Dictionary.txc dictionary file.

Step 3: Add files from a folder or multi folders

Step 4: Let TextCrawler find/replace multi string pairs in multi code files for you

*

Now, you can add the processed code files to previous BricsCAD project or new BricsCAD project

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • The reason I don't use same file code for AutoCAD and BricsCAD with compile directives as someone's best practice is:

    1. AutoCAD 2025 now use Net 8.0 while BricsCAD still use Net 4.8
    2. I already had tons of compile directives in my code
    3. I don't want to take risks with my AutoCAD projects. It's better to separate 2 type of projects

    Therefore, a multi find/replace tool which supports multi string pairs and multi files is my choice.

    Hope this tip may help.

  • I have huge projects that do use the same code files for acad and bcad. I have a few compile directives, more for the acad side than the bcad.

    Its not complex at all when you use alias's's for things, like:

    //AutoCad Usings
    #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;
    #endif

    #if BCAD
    using Bricscad.Runtime;
    using Bricscad.ApplicationServices;
    using AcAp = Bricscad.ApplicationServices.Application;
    using Bricscad.EditorInput;
    using AcEd = Bricscad.EditorInput;
    using Teigha.DatabaseServices;
    using Teigha.Runtime;
    using AcDb = Teigha.DatabaseServices;
    using Teigha.Geometry;
    using AcGe = Teigha.Geometry;
    using AcCo = Teigha.Colors;
    using Bricscad.Windows;
    #endif

    If you do that, you rarely need #if statements in actual code, just at top.

    You will need some, but I would say its much easier to have one code file with reminders of where bcad is different, than 2 files where its not obvious.

    I don't get the search and replace idea. To maintain 2 code files for the same stuff is the worst idea of any.

  • "To maintain 2 code files for the same stuff is the worst idea of any."

    Agree with you.

    *

    However, in my situation, things are slightly different.

    I mainly code for AutoCAD and sometimes try to port some modules to BricsCAD, once a year !

    So I find it better not to bother my AutoCAD code projects.

    I believe that AutoCAD coders who want to try convert their code to BricsCAD for the first time also choose a safe solution like duplicate projects, find & replace … rather than add BricsCAD library references to existing AutoCAD projects.

  • Even if you don’t maintain multiple platforms, It’s best to setup your project with this in mind. Use good aliasing, reference the code files instead of adding them to your project (Add as link). Most important is unit testing, so you’re not left scratching your head after that one year

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.