VB.NET tutorials for newbie?

Can anyone point to some tutorials to help get started with programming BricsCAD17 in VB.NET? I have done quite a lot of programming of AutoCAD via VB6 and VBA, but now being faced with the programming environment of VisualStudio2013 is quite overwhelming and I am stuck just trying
understand how to connect to a running instance of BricsCAD.  I need to be able to access the full range of methods and properties offered by the .NET object model, not just the fairly limited set that was available via VBA/VB6 (previously I was using a long obsolete AutoCAD plug-in called AcadX that allowed access to more complex methods such as .GetFirstDerivateAt and .GetParameterAtDistance from VBA/VB6).  I can create a Class Library, make the required
references as instructed in the Bricsys online help, and copy all the Imports files needed, but from that point I don't know how to proceed in connecting to the BricsCAD app.  Any help in just getting going would be very much appreciated.

Comments

  • I'm somewhat confused with 2 terms you use: 
    1) I can create a Class Library...
    2) how to proceed in connecting to the BricsCAD app...
    because these terms or concepts are (generally speaking) mutually exclusive.
    Either you create a Class Library or you create a (stand-alone) application which then (tries to) connect to BricsCAD via COM. (of course and as it is often the case this strict either/or distinction does not always hold but let's stick to it for the purpose this discussion)
    Both approaches are typically authored on the same IDE: Microsoft VisualStudio.

    case 1: (create library class path) would typically indicate that the bianry output of your the vb.net project you create will generate a (.dll) . Once successfully compiled  this .dll will get loaded into a running BricsCAD session with the NETLOAD command. This is done once BricsCAD session has started by using the NETLOAD command on the BricsCAD command line. Once loaded all the (extra) commands made available by your library class project, become availbale to the BricsCAD session. Here typically the libraries which need to be referenced by your vb.net project are: BrxMgd.dll and TD_Mgd.dll; they are refered to as 'managed' code. Note that there is no need to 'connect' to BricsCAD since the purpose and effect of NETLOAD is load the dll within the BricsCAD context...
    case 2: The other case (as  I understand from your wording) is where your VB.net project generates a .exe? Once launched this application will try to communicate with a running instance of BricsCAD. (or typically if no running instance of BricsCAD is found, will launch a new BricsCAD instance and connect to it). In this case the libraries which need to be referenced by your vb.net project are:  Interop.BricscadApp.dll and  Interop.BricscadDb.dll; this would be 'ActiveX' code (as oppose to  'managed' code described above)
  • By the way, some sample projects can be found in the BricsCAD install folder, subfolder \API\dotNet. One of them is a VB.NET project called "VbBrxMgd" which illustrates the setup as Ferdinand described in case 1. Alongside you will find a readme file with some extra help for project configuration.
  • Robert Casey
    edited February 2017

    Thank you very much for your answers. The reason I spoke about creating class libraries is that I was trying to follow the Bricsys Developer Reference help, and on the .NET page it says:

    "To setup a project with Visual Studio

    Create a class library using the class library wizard under your preferred .NET language. There are currently two DLLs that need to be referenced, BrxMgd.dll and TD_Mgd.dll (+ optional TD_MgdBrep.dll (BREP API)). These DLLs are located in your BricsCAD installation folder. Important note: when referencing these DLLs, its important to set the 'Copy Local' property to False. All other DLLs such as referenced COM DLLs or satellite DLLs. can have their 'Copy Local' property to true, or as needed by your project."

    I was just floundering because, whilst I can find lots of help for COM with VB6 and VBA, I cannot find anything help "get me going" with VB.NET and Bricsys, in particular because I need to go beyond the set of properties and methods available through VB6 and VBA (eg I need things like the GetDerivative method from the Teigha.Geometry namespace). With my old VB6 propgrams I was used to being able to connect to running instances/drawings of AutoCAD and minipulate the drawing database, or to create programs which would start up new instances, which - yes - would be as per 'case 2' in Ferdinands post.

    I mentioned that up until now, with AutoCAD 2004 I had used a .dll made by a developer (long since discontinued) which had to be dropped on the AutoCAD window to register it, and which then created a new object which could accessed in VB6/VBA and which, in turn, gave access to all the 'extended commands' which were not available in the standard ACAD object model. This sounds a lot like the 'case 1' situation.

    My problem is the apparent lack of documentation which is tailored for green programmers like myself. In particular when you are faced with the Visual Studio IDE which is SOOO much more complex than VB6/VBA, and you are left wondering "where do I even start"?

  • @Robert Casey said:
    My problem is the apparent lack of documentation which is tailored for green programmers like myself. In particular
    when you are faced with the Visual Studio IDE which is SOOO much more complex than VB6/VBA, and you are left
    wondering "where do I even start"?

    I agree with you. But, on the plus side, the support from BricsCAD and the people on this forum has been excellent. Initially my first responc to learning something is to go to the manual. Though, for BricsCAD (at least up to the v14 that I use) I have been prone to only giving the manual a quick search, and then seeking other sources. One other source is AutoCAD's online documentation or online blogs from 3rd parties about AutoCAD, which requires some adjustment for the differences (which are not well documented either). Another is this forum.

    -Joe

This discussion has been closed.