Is custom .NETCore running application inside AutoCAD or Civil3D?

Is custom .NETCore running application inside AutoCAD or Civil3D?

michael_robertson
Collaborator Collaborator
260 Views
3 Replies
Message 1 of 4

Is custom .NETCore running application inside AutoCAD or Civil3D?

michael_robertson
Collaborator
Collaborator

How can I tell if my custom .NET application is running inside plain AutoCAD or Civil 3D?

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer
0 Likes
261 Views
3 Replies
Replies (3)
Message 2 of 4

kerry_w_brown
Advisor
Advisor

I'm not civil, so I can't test this . . 

Crude, but may suit the situation.
Identify a System Variable unique to Civil3D

 

Check it's value.

Something like : 

 

 

 

global using CadApp = Autodesk.AutoCAD.ApplicationServices.Application;
global using Exception = System.Exception;

[assembly: CommandClass(typeof(ProductInfoTest.Commands))]

namespace ProductInfoTest
{
   public class Commands
   {
      [CommandMethod("Test")]
      public static void Test()
      {
         var ed = CadApp.DocumentManager.MdiActiveDocument.Editor;

         try
         {
            //var cmd = (string)CadApp.GetSystemVariable("ACADVER");
            //var cmd = CadApp.GetSystemVariable("UCSICON");
            var cmd = CadApp.GetSystemVariable("PPOINT");
            ed.WriteMessage($"\nVariable .Test : {cmd}\n");
         }
         catch(Exception ex)
         {
            ed.WriteMessage($"\nError: {ex.Message}\n");
         }
      }
   }
}

 

 

"PPOINT" source :

https://www.google.com/search?q=system+variables+unique+to+civil+3d

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 3 of 4

ActivistInvestor
Mentor
Mentor

Have you tried checking the PRODUCT system variable?

0 Likes
Message 4 of 4

kerry_w_brown
Advisor
Advisor

@ActivistInvestor 

Hi Tony, 

I wasn't sure about that because you can start "Civil 3D as AutoCAD" using a different profile ( if I remember correctly )

. . . though it makes sense that the "Product" variable would change, so that would be simpler.

 

Regards,

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes