.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tutorial - How to create a Visual Studio template

24 REPLIES 24
SOLVED
Reply
Message 1 of 25
Ed.Jobe
2762 Views, 24 Replies

Tutorial - How to create a Visual Studio template

Hi @_gile  I updated your tutorial for AutoCAD 2023 and Visual Studio 2022. See attached.

 

For others, this tutorial is based upon one that @_gile created on his website. It is also helpful for learning how to create a new project, since it contains the code for the classes necessary for a plugin to work. After you create your template, you can use it to create your first plugin.

 

**Updated for 2024.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

24 REPLIES 24
Message 21 of 25
kdub_nz
in reply to: Ed.Jobe

To @ joshuaW5HNW

(sorry for the tag Ed )

 

Just curious, 

Which AutoCAD build are you using ?

Which AutoCAD builds are installed ?
Which Template ( and from where ) did you use ?

 

Have you had memory issues ?
Have you had a recent unsucessful windows update ?



Can you run an ACAD session normally ?
Can you load and run a previously build DLL ( that you built ) for that version ?


Can you make a new project without the template ?

 


// Called Kerry in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect.

class keyThumper<T> : Lazy<T>;      another  Swamper

Message 22 of 25
Yehoshua18
in reply to: Ed.Jobe

- Civil 3d as AutoCAD 2021,

- I have installed: Civil 3D 2021, Civil 3D, 2022, and AutoCAD 2020
- I used the template creation instructions provided here. They used to work fine apart from the 

- I haven't noticed any memory issues

- Windows Updates are all installed properly

- I can run AutoCAD outside of Visual Studio normally

- When compiling the project, it successfully compiles. Just it wont successfully open AutoCAD anymore.  When I start a separate instance of AutoCAD outside of Visual Studio, i can netload the DLL just fine, and it runs perfectly. 

- I can make a new project without the template. 

* I restarted my computer and the problem went away. But this is still occurring intermittently. Meaning I can go a day now and the project will refuse to open AutoCAD, and it's only resolved by restarting the computer. 

 

Thanks!

Message 23 of 25
_gile
in reply to: Yehoshua18

Maybe the fact that the error occurs intermittently is due to the product started (Civil3d or AutoCAD).

You should try to force the start of a specific product. This can be done by modifying the command line arguments either from Visual Studio in the Debug tab; or by directly modifying the StartArguments tag in the .csproj file of the template (see this topic).

<StartArguments>/nologo /product ACAD /b "start.scr"</StartArguments>

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 24 of 25
john9XGED
in reply to: Ed.Jobe

@Ed.Jobe this is incredible! Are there any sources that would show a newbie how to modify this for Civil 3D? Is that even necessary?

Message 25 of 25
Ed.Jobe
in reply to: john9XGED

Sure, once you create the project in VS, just add code to the project's Commands.cs file for C3D, as shown on page 6, e.g. references and using statements. Then finish creating your template. Since I don't have C3D, I can't tell you what base dll's it loads that you might want to reference. Maybe another user can tell you. You can also get a clue by looking at what gets reported when C3D loads by looking at the command line history F2. Your possible choices would be the files included in the C3D sdk.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report