Results 1 to 6 of 6

Thread: Finding AutoCAD templates in Visual Studio Pro 13

  1. #1
    Member
    Join Date
    2007-10
    Posts
    30
    Login to Give a bone
    0

    Default Finding AutoCAD templates in Visual Studio Pro 13

    OK, I'm trying to migrate all our Lisp and VBA routines to VB.net and whenever I type something in VB.net like "acadselectionset" or "ThisDrawing.selectionset" the wavy red underline pops up. Of course, VB.net doesn't understand Autocad stuff, but the VBA code did. I didn't write the VBA programs, and the guy who did is no longer with the company, but I have a feeling there was a template of some sort he used to get the Autocad commands under stood in VBA.

    I have the book "VB.net programming for Autocad customization" by Jerry Winters and I downloaded the latest stuff from his website, but the book says to install the stuff, and I don't know how to do that.

    I guess my question is, how do I install whatever templates Jerry may have supplied? When I start a new project, the list of templates in the New Project command in VB.net doesn't see anything Autocad related. Likewise, I can't find anything on the web when I click "Click here to go online and find templates".

    What to do? I'm confident that when I get over this stumbling block I can transfer all our programming to the VB.net, but I'm really having trouble with this.

    Any ideas out there?

    Anybody?

    Bueller?

    Anybody?

    -Ralphie

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu Hawaii
    Posts
    1,028
    Login to Give a bone
    0

    Default Re: Finding AutoCAD templates in Visual Studio Pro 13

    What version of visual studio are you using?

    VB.net is different than VB or lisp.

    It requires transactions which are covered in Jerry's book.

    It is not com based although you could do com stuff with it like vba.

    I can send you a visual studio file to start you out and you can make a template out of it.

    It will take a full rewrite of your old code.

    It is much faster at run time but slower to code.

    Sorry it toook me so long to respond nbut for some reason I couldnt login.

    Thanks for participating.

    P=
    AutomateCAD

  3. #3
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Finding AutoCAD templates in Visual Studio Pro 13

    I know that VBA used to automatically reference and import acad's API. That's why you didn't need to worry about it. That's also the main reason I'd like to see VSTA in acad the same way AutoDesk did it for Revit: i.e. package the SharpDevelop IDE as a built-in development environment like the old VBA used to be (only now allowing it to use whatever DotNet language you can shake a stick at). It generates those templates for you each time you start a new project.

    There's been some addon's for Visual Studio to add a acad managed (i.e. DotNet) option in the "new project" dialog. Some work well, some not so much, but all of them are relevant only to the specific version of VS (and sometimes also the specific version of acad). Do yourself a favour, download the acad SDK (it's actually intended for ObjectARX, but includes the DotNet stuff too: even one of these VS plugins).

    Though I find it easier just generating my own.

    First and foremost, your DotNet project (no matter the language VB/C#/F#/Python/etc.) will need to reference the relevant ACad assembly files. Those ACMGD.DLL and ACBDMGD.DLL files (and lately also AcCoreMgd.DLL). You do this by right-clicking on the project's References group in the VS project browser (after you've started a new Class Library project). Then choose Add Reference. Open the Browse tab and browse to those files in the acad installation folder (you might want to add this folder to the project's Reference Paths in the project properties).

    Next, you need to import the relevant namespaces from those files. At the top of any new class file (I'm going to go with VB files here since you're asking for that) start typing Imports (the intellisense should guide you already). Then start typing AutoDesk - it should show you all the namespaces available from the referenced assemblies.

    After you've got a minimal amount of stuff you like (e.g. a command method / lispfunction / whatever else you feel you'll always need) go to File --> Export Template, and name it whatever you like. You should now have template as an option in that new project dialog.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  4. #4
    Member
    Join Date
    2007-10
    Posts
    30
    Login to Give a bone
    0

    Default Re: Finding AutoCAD templates in Visual Studio Pro 13

    OK, here's what I got:

    vb-screen.png
    Did I put that in the wrong place? I'm using Visual Studio 13 and Autocad 2010

    Thanks for the responses!
    -Ralphie

  5. #5
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,428
    Login to Give a bone
    0

    Default Re: Finding AutoCAD templates in Visual Studio Pro 13

    Looks like your Imports Statement is within your Class scope; try declaring your Imports Statements, then your application's Namespace, and then define your Class(es):

    Code:
    Imports Autodesk.AutoCAD.ApplicationServices
    Imports Autodesk.AutoCAD.DatabaseServices
    Imports Autodesk.AutoCAD.Geometry
    Imports Autodesk.AutoCAD.EditorInput
    Imports Autodesk.AutoCAD.Runtime
    
    Namespace FOO
         Public Class BAR
              '' <-- Your code here
         End Class
    End Namespace


    [Edit] - You can declare fully qualified Namespaces within your Class, Method(s), etc but that does not require an Imports statement; just declare the fully qualified Namespace in your call.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  6. #6
    Active Member
    Join Date
    2009-08
    Posts
    93
    Login to Give a bone
    0

    Default Re: Finding AutoCAD templates in Visual Studio Pro 13

    You can also find your answers @ Theswamp

Similar Threads

  1. Replies: 0
    Last Post: 2014-11-30, 01:16 PM
  2. Replies: 3
    Last Post: 2013-11-23, 01:58 AM
  3. CP32-3: Visual Studio.NET for AutoCAD Programmers
    By Autodesk University in forum Customization and Programming
    Replies: 0
    Last Post: 2013-04-08, 07:22 PM
  4. AutoCAD 2011 .NET Wizards and Visual Studio 2010
    By rollinkuhn in forum Dot Net API
    Replies: 13
    Last Post: 2011-12-20, 12:18 PM
  5. visual lisp editor should be like visual studio
    By Wish List System in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2011-11-17, 05:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •