AutoCAD has provided so called AutoLoader for a while. It is announced to be environment friendly (no need to mess up the Windows Registry anymore), support multiple versions, support both AutoCAD and its flavors (such as AutoCAD Mechanical and AutoCAD Architecture) at the same time in a single place, support various AutoCAD applications such as .NET, ARX, DBX, and AutoLISP, support multiple Operating Systems (such as Microsoft Windows 64, Microsoft Windows 32, and even Apple Mac), and more.
It sounds huge and complex, but in fact, it is nothing but an XML file that is supposed to specify what the application/addin/plugin is, what it does, and what it needs. That is about it in a single sentence.
Though simple, it has many subtle details for us to sort out due to lack of good documentation, not open at all the AutoLoader schema if any, and far from set yet at this time. Thus, mysteries about the AutoLoader are here and there in spite that the XML format itself is not a thing at all to most developers.
We have presented a simple and working sample of AutoLoader and addressed a very important point about the ModuleName attribute. Some readers may have noticed that we used the backslash as the delimiter for the ModuleName but the forward-slash for other paths such as HelpFile and Icon in the AutoLoader sample.
Questions come up: Should we use backslash or forward-slash as the delimiter for paths (e.g. the ModuleName here, which is our most concern)? Are we supposed to use different delimiter for different path? Even deeper, must we use single backslash or forward-slash (whichever works) or both single and double will just work?
The first experiment: let’s change the ModuleName from using backslash to forward-slash.
<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
HelpFile="./Application/UsersGuide.chm"
OnlineDocumentation="spiderinnet1.typepad.com"
Name="TestApp"
Description=""
Icon="./Application/app.ico"
Author="spiderinnet1">
<CompanyDetails Name="nss"
Url="http://spiderinnet1.typepad.com"
Email="spiderinnet1@nss.com">
</CompanyDetails>
<Components>
<RuntimeRequirements OS="Win64" Platform="AutoCAD" SeriesMin="R18.0" SeriesMax="R18.2" />
<ComponentEntry
ModuleName="./Application/TestApp.dll"
LoadOnAutoCADStartup="true"
LoadOnCommandInvocation="false"
AppDescription="This is assembly TestApp."
AppName="TestApp"
AppType=".NET">
<Commands GroupName="CmdGroup1">
<Command Local="Command1" Global="Command1" />
</Commands>
</ComponentEntry>
</Components>
</ApplicationPackage>
We find AutoCAD 2012 still can find the assembly and load it fine. So the conclusion is both backslash and forward-slash work well.
The second experiment: let’s make the forward-slash from single to double.
ModuleName=".//Application//TestApp.dll"
We find it still works fine.
The last experiment: let’s use double backslashes this time.
ModuleName=".\\Application\\TestApp.dll"
The AutoLoader still works as expected.
Therefore, now we reach the final conclusion that both backslash and forward-slash, both single and double all can serve as good delimiters for the ModuleName in the AutoLoader.
What about mixtures of backslash/forward-slash and single/double in the ModuleName of AutoLoader then?
Good question. Please go ahead and do a bit more experiments to sort these out, but from common practices, we may not have to care about these.
What about other paths such as Icon and HelpFile in the AutoLoader?
Pretty much the same as the ModuleName, we bet (or speaking it another way, educationaly and confidentially guess).
By the way, the TestApp project and the sample command were all generated by the leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard) automatically in a moment. AcadNetAddinWizard provides various project wizards, item wizards, coders including a Ribbon Creator, and widgets to help program AutoCAD .NET addins.
Posted by: |