If you don’t know how to record new Macro then check Macro Toolbar in DraftSight tutorial & record new VB.NET Macro for this tutorial.
If you already have recorded VB.NET Macro in DraftSight then use that file here.
To Run DraftSight VB.NET Macro you will need to have Visual Studio installed on your System. If you don’t have Visual Studio then I would recommend to install Visual Studio Community .
I am using Visual Studio Community 2012 for this Tutorial.
So, I have drawn a Circle in DraftSight using Macro Recorder. I will save my Macro on D: driver with name DrawCircle.vbproj (you can choose any name you want) .
Now Close the DraftSight Drawing in which we have recorded macro & open new Blank drawing
Open Visual Studio and Go to File > Open
Here, you can Directly select Project/Solution… OR Folder… option
If you choose Project/Solution… option then following Dialog box will pop up.
Click Ok on it.
Your Solution Explorer will look like this :
Double click on DrawCircle.vb. You will see Macro code as below:
Note: It may be different if you choose Macro Recording Level to High in DraftSight System options.
No problem, Whole purpose of this tutorial is to Run a DraftSight VB.NET Macro which will create a Circle in DraftSight.
If you try to Run this Program from Visual Studio then you will get error.
Because we have not added Reference Libraries of DraftSight in Visual Studio. These Libraries are required so that Visual Studio can recognize and get access to DraftSight API functions .
Right Click on ‘References ‘ in Solution Explorer & Click ‘Add Reference…’ > Click on ‘Browse…’ button on dialog box.
We have to add DraftSight Primary interop assemblies files [See Introduction to DraftSight API] as below :
Select Files > Add then ok on Dialog box.
Both Reference files will be shown in Solution Explorer.
Now Run the Code by clicking on ‘Start’ button and You will see a Circle is created inside DraftSight.