My First Plug-in Training

Lesson 8: Bonus Plug-in

Finish off the tutorial by studying a (slightly more complicated) bonus plug-in that extends the functionality of the plug-in you developed to provide full ‘billboarding’ behavior for block attributes.

Provide Feedback: Please provide feedback about this AutoCAD Training or this lesson via email:
Lesson Downloads
lesson8_AutoCAD_2018_projects (zip - 15Kb)
lesson8_archive_2017_and_earlier_project_files (zip - 174Kb)

As a reward for all your hard work in this tutorial, we’ve included a bonus plug-in for you to play with. The plug-in you wrote in this tutorial has two major limitations:

  1. Transforming attributes so they display parallel to the x-axis is really helpful in a 2D drawing, but they are still hard to read in a 3D view (an isometric view, for example).
  2. The plug-in permanently altered the orientation of the attributes relative to their block insert.

Your bonus plug-in addresses these two limitations by using a DrawableOverrule instead of a TransformOverrule to only change the way the attributes display themselves. It forces the overruled attributes to always draw themselves in the plane of the current view – an effect known in computer games development as ‘billboarding’. The plug-in makes no permanent changes to the drawing: If you open the drawing without your overrule active, then the attributes appear exactly as they were originally drawn.

To test the project:

  • Open the MyBonusPlugin.vbproj file from the MyBonusPlugin folder (included above under Lesson Downloads).
  • Build the project (Build menu -> Build MyBonusPlugin).
  • Start AutoCAD.
  • NETLOAD the plug-in DLL (from the folder MyBonusPlugin\MyBonusPlugin\bin\Release).
  • Open the sample drawing.
  • Invoke the custom command – BILLBOARDATTRIBUTES – defined in the plug-in.
  • Select the rectangular block reference.
  • Invoke the 3DORBIT command.
  • Orbit the drawing and see how the AttributeDefinitions display themselves. The image below shows the rectangular block with billboarded attributes.
  • The plug-in also defines the commands:

    • DONTBILLBOARDATTRIBUTES – which behaves the same as DONTKEEPSTRAIGHT in your other plug-in.
    • ACTIVATEBILLBOARDOVERRULE – which behaves the same as ACTIVATEOVERRULE in your other plug-in.

We’ll leave it as an exercise for you to read through the code to understand how it differs from the plug-in you created during the tutorial.

Note: The bonus project is set up to launch AutoCAD from the debugger if it is located in the folder C:\Program Files\Autodesk\AutoCAD 20xx. If you have AutoCAD installed in another folder, then you will have to create a new project (as you did in Lesson 1) and copy the code from the MyCommands.vb into your new project.

Which brings you to the end of this guide. We hope this has proven to be a helpful beginning to your journey with the AutoCAD API. We wish you all the very best in your future API endeavors.