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

Advice on moving to .net from VBA

2 REPLIES 2
Reply
Message 1 of 3
S7RM7RPR
211 Views, 2 Replies

Advice on moving to .net from VBA

I've been told by a few different people of late that I "need" to stop using VBA and migrate to .net or C# but in attempting to research it, I'm not convinced it's a good move with how I'm set up right now (VBA support aside). I am very much a self-taught programmer and everything I've learned about VBA I've learned on the job over the last 15 years. I wouldn't say I'm a great programmer, but I've gotten pretty good at making AutoCAD do what I want.

 

I work in a company where I've built a significant amount of programs in AutoCAD for drafting automation. The way it works right now is that a we have a plugin set up on all user's computers that automatically snags the latest copy of the .dvb/vba code and loads it. The users can then initiate various AutoCAD programs using a custom menu or initiate programming using external programs. The majority of the programs simply load a design, insert the relevant blocks, update values in the blocks, and then output in some fashion. Fairly simple I think. However, there are a few programs that do a significant amount of design work as well using iterations and multiple dictionaries. For example, in the last few weeks I was working on running over 20,000 designs usually in lots of 100, reviewing the outputs, making modifications to the code, then running some more tests.

My understanding of .net/C# is that I need to do all the programming in VS and then load the compiled program into AutoCAD. That in itself would be frustrating to me because testing would take significantly longer and with most of the work I'm doing, VS wouldn't have any idea if the code I've written will even work because it all depends on what AutoCAD outputs, not the validity of the actual code itself.

If you have experience with using VBA and .net/C# I would very much appreciate your thoughts.

2 REPLIES 2
Message 2 of 3
ed57gmc2
in reply to: S7RM7RPR

You got two questions really.

1. What is the future of programming?

A. AutoCAD 2025 will move away from the .NET Framework and begin using .NET 8. Which is more suited to multiple platforms. .NET is a steeper learning curve than VBA, but it is the future. Already, VBA is way past it's stated support deadline, so there's no telling how long it will be supported. In other words, you should start learning C# while you have time rather that waiting until VBA stops working. Currently, it is not being updated. By the way, it is critical that you learn C# as nearly everyone develops AutoCAD in C# and all sample code is in C#. This does not mean that you need to convert all your VBA to C# right away. Start doing new tasks in C# and migrate VBA as changes are needed.

 

2. How is using VS helpful?

A. VS  is a very powerful IDE and integrates with AutoCAD easily. It is no problem to set up a breakpoint and debug inside AutoCAD. To load your code, you use the NETLOAD command just like you would use VBALOAD command. It's not any more difficult. @_gile  and I have a tutorial here. If you follow these instructions, you just have to hit F5 to start debugging.

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

Message 3 of 3
s_abeed
in reply to: S7RM7RPR

I was doing some VBA coding for fast prototyping then I moved to C# and ported all code and performance get much better. If you want to work few more years before retirement then its better to start learning. Initially it will be tough but then it will get simplified. Try to port a few things and see how they work and then move the rest. It won't be that tough after you spend 2 months. Like you said you are working on this stuff for 15 years so 2 months learning something won't heart.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report