Hi everyone,
Is there a way to autoload a DLL file at startup? I’ve seen various methods online, but I’m looking for a neat and clean solution that works effectively. Any guidance on this would be greatly appreciated.
Thank you!
Solved! Go to Solution.
Hi everyone,
Is there a way to autoload a DLL file at startup? I’ve seen various methods online, but I’m looking for a neat and clean solution that works effectively. Any guidance on this would be greatly appreciated.
Thank you!
Solved! Go to Solution.
Solved by luckyboy82292. Go to Solution.
Hi,
IMHO, the "neatest and cleanest" way is to use the auto loader mechanism with a .bundle folder in some ApplicationPlugins directory. See this section of the documentation and the related topics.
But you can also load the DLL via AutoLISP or the registry (see this topic).
Hi,
IMHO, the "neatest and cleanest" way is to use the auto loader mechanism with a .bundle folder in some ApplicationPlugins directory. See this section of the documentation and the related topics.
But you can also load the DLL via AutoLISP or the registry (see this topic).
If you want to netload your plugin via AutoLISP, you should add the following LISP expression (after replacing "Plugin.dll" with your DLL file name) to a file name "acad.lsp" and save is as the "Plugin.dll" file in some AutoCAD search path directory (create the "acad.lsp" file if it does not already exists).
((lambda (f)
(if f
(command-s "netload" f)
(prompt "DLL file not found")
)
)
(findfile "MyPlugin.dll")
)
That said, IMHO, using a .bundle folder in some ApplicationPlugins directory should be "neater and cleaner".
If you want to netload your plugin via AutoLISP, you should add the following LISP expression (after replacing "Plugin.dll" with your DLL file name) to a file name "acad.lsp" and save is as the "Plugin.dll" file in some AutoCAD search path directory (create the "acad.lsp" file if it does not already exists).
((lambda (f)
(if f
(command-s "netload" f)
(prompt "DLL file not found")
)
)
(findfile "MyPlugin.dll")
)
That said, IMHO, using a .bundle folder in some ApplicationPlugins directory should be "neater and cleaner".
Actually, I am trying the .bundle method, but some errors occur.
@echo off
setlocal
set BundlePath=$(TargetDir)Convert3DPoly.bundle\Contents\Windows
mkdir %BundlePath%
set BundleInfo=$(TargetDir)Convert3DPoly.bundle\Contents\BundleInfo.xml
echo %BundleInfo%
copy /Y $(TargetPath) %BundlePath%\Convert3DPoly.dll
echo ^<?xml version="1.0" encoding="utf-8"?^> > %BundleInfo%
echo ^<Bundle^> >> %BundleInfo%
echo ^ <Assembly^> >> %BundleInfo%
echo ^ <Name>Convert3DPoly</Name^> >> %BundleInfo%
echo ^ <Description>Convert 3D Polylines in AutoCAD</Description^> >> %BundleInfo%
echo ^ <Version>1.0.0.0</Version^> >> %BundleInfo%
echo ^ <AssemblyPath>Convert3DPoly.dll</AssemblyPath^> >> %BundleInfo%
echo ^ </Assembly^> >> %BundleInfo%
echo ^</Bundle^> >> %BundleInfo%
endlocal
Here is the code for a 'post-build event command line.' However, when I rebuild the application, I get the following error: '1> The filename, directory name, or volume label syntax is incorrect.' I hope this helps you understand the issue.
Actually, I am trying the .bundle method, but some errors occur.
@echo off
setlocal
set BundlePath=$(TargetDir)Convert3DPoly.bundle\Contents\Windows
mkdir %BundlePath%
set BundleInfo=$(TargetDir)Convert3DPoly.bundle\Contents\BundleInfo.xml
echo %BundleInfo%
copy /Y $(TargetPath) %BundlePath%\Convert3DPoly.dll
echo ^<?xml version="1.0" encoding="utf-8"?^> > %BundleInfo%
echo ^<Bundle^> >> %BundleInfo%
echo ^ <Assembly^> >> %BundleInfo%
echo ^ <Name>Convert3DPoly</Name^> >> %BundleInfo%
echo ^ <Description>Convert 3D Polylines in AutoCAD</Description^> >> %BundleInfo%
echo ^ <Version>1.0.0.0</Version^> >> %BundleInfo%
echo ^ <AssemblyPath>Convert3DPoly.dll</AssemblyPath^> >> %BundleInfo%
echo ^ </Assembly^> >> %BundleInfo%
echo ^</Bundle^> >> %BundleInfo%
endlocal
Here is the code for a 'post-build event command line.' However, when I rebuild the application, I get the following error: '1> The filename, directory name, or volume label syntax is incorrect.' I hope this helps you understand the issue.
I have corrected the 'post-build event command line' code.
@echo off
setlocal
set BundlePath=$(TargetDir)Convert3DPoly.bundle\Contents\Windows
mkdir %BundlePath%
set BundleInfo=$(TargetDir)Convert3DPoly.bundle\Contents\BundleInfo.xml
echo %BundleInfo%
copy /Y $(TargetPath) %BundlePath%\Convert3DPoly.dll
echo ^<?xml version="1.0" encoding="utf-8"?^> > %BundleInfo%
echo ^<Bundle^> >> %BundleInfo%
echo ^ ^<Assembly^> >> %BundleInfo%
echo ^ ^<Name^>Convert3DPoly^</Name^> >> %BundleInfo%
echo ^ ^<Description^>Convert 3D Polylines in AutoCAD^</Description^> >> %BundleInfo%
echo ^ ^<Version^>1.0.0.0^</Version^> >> %BundleInfo%
echo ^ ^<AssemblyPath^>Convert3DPoly.dll^</AssemblyPath^> >> %BundleInfo%
echo ^ ^</Assembly^> >> %BundleInfo%
echo ^</Bundle^> >> %BundleInfo%
endlocal
But I still don't know how to use it now or where to put it so that it can be loaded at startup. A step-by-step guide would be greatly appreciated.
I have corrected the 'post-build event command line' code.
@echo off
setlocal
set BundlePath=$(TargetDir)Convert3DPoly.bundle\Contents\Windows
mkdir %BundlePath%
set BundleInfo=$(TargetDir)Convert3DPoly.bundle\Contents\BundleInfo.xml
echo %BundleInfo%
copy /Y $(TargetPath) %BundlePath%\Convert3DPoly.dll
echo ^<?xml version="1.0" encoding="utf-8"?^> > %BundleInfo%
echo ^<Bundle^> >> %BundleInfo%
echo ^ ^<Assembly^> >> %BundleInfo%
echo ^ ^<Name^>Convert3DPoly^</Name^> >> %BundleInfo%
echo ^ ^<Description^>Convert 3D Polylines in AutoCAD^</Description^> >> %BundleInfo%
echo ^ ^<Version^>1.0.0.0^</Version^> >> %BundleInfo%
echo ^ ^<AssemblyPath^>Convert3DPoly.dll^</AssemblyPath^> >> %BundleInfo%
echo ^ ^</Assembly^> >> %BundleInfo%
echo ^</Bundle^> >> %BundleInfo%
endlocal
But I still don't know how to use it now or where to put it so that it can be loaded at startup. A step-by-step guide would be greatly appreciated.
My issue has been resolved. I researched and used ChatGPT, and I found that AutoCAD 2024 only works with the 'PackageContents.xml' file structure.
Here's the recommended bundle folder structure:
Mylibfiles.bundle
|
|--> PackageContents.xml
|
|--> Contents
|
|--> Windows
|
|--> Put lib files here
In the 'PackageContents.xml' file, use the following content:
<?xml version="1.0" encoding="UTF-8"?>
<ApplicationPackage SchemaVersion="1.0"
Name="MyLibFiles"
AppVersion="1.0.0"
Author="xyz"
Description="Multiple Commands" >
<Components>
<RuntimeRequirements OS="Win64" SeriesMin="R19.0" />
<ComponentEntry AppName="mylib1"
ModuleName="./Contents/Windows/mylib1.dll"
AppDescription="put any description here"
LoadOnAutoCADStartup="True">
</ComponentEntry>
<ComponentEntry AppName="mylib2"
ModuleName="./Contents/Windows/mylib2.dll"
AppDescription="put any description here"
LoadOnAutoCADStartup="True">
</ComponentEntry>
</Components>
</ApplicationPackage>
You can add more files to the 'Windows' folder and update the 'PackageContents.xml' file accordingly. I hope this helps!
My issue has been resolved. I researched and used ChatGPT, and I found that AutoCAD 2024 only works with the 'PackageContents.xml' file structure.
Here's the recommended bundle folder structure:
Mylibfiles.bundle
|
|--> PackageContents.xml
|
|--> Contents
|
|--> Windows
|
|--> Put lib files here
In the 'PackageContents.xml' file, use the following content:
<?xml version="1.0" encoding="UTF-8"?>
<ApplicationPackage SchemaVersion="1.0"
Name="MyLibFiles"
AppVersion="1.0.0"
Author="xyz"
Description="Multiple Commands" >
<Components>
<RuntimeRequirements OS="Win64" SeriesMin="R19.0" />
<ComponentEntry AppName="mylib1"
ModuleName="./Contents/Windows/mylib1.dll"
AppDescription="put any description here"
LoadOnAutoCADStartup="True">
</ComponentEntry>
<ComponentEntry AppName="mylib2"
ModuleName="./Contents/Windows/mylib2.dll"
AppDescription="put any description here"
LoadOnAutoCADStartup="True">
</ComponentEntry>
</Components>
</ApplicationPackage>
You can add more files to the 'Windows' folder and update the 'PackageContents.xml' file accordingly. I hope this helps!
Some additions. I put the .bundle folder into 'C:\Program Files (x86)\Autodesk\ApplicationPlugins\' folder. And it's working very well now.
Some additions. I put the .bundle folder into 'C:\Program Files (x86)\Autodesk\ApplicationPlugins\' folder. And it's working very well now.
Can't find what you're looking for? Ask the community or share your knowledge.