Netload doesn't work in AutoCAD script ( but works when I manually typing it in command line)

Netload doesn't work in AutoCAD script ( but works when I manually typing it in command line)

soonhui
Advisor Advisor
874 Views
5 Replies
Message 1 of 6

Netload doesn't work in AutoCAD script ( but works when I manually typing it in command line)

soonhui
Advisor
Advisor

Here's something strange. When I explicitly type in Netload at the AutoCAD command line, I can select the relevant dll and the loading is successful.

 

However, when I netload it via script, it doesn't work.

 

To be more specific, I'm launching AutoCAD 2023( as Civil 3D 2023, but it shouldn't matter here) as a Debugging action in my Visual Studio 2023, with the following command line argument:

 

/ld "D:\Program Files\Autodesk\AutoCAD 2023\\AecBase.dbx" /p "<<C3D_Metric>>" /product "C3D" /b "C:\Users\User\Documents\Projects\MES\MiTS2\Civil3DIntegrator\Source\LoadPlugin_2023.scr"

 

And in my SCR script, this is what I put in

 

netload "C:\Users\User\Documents\Projects\MES\MiTS2\Civil3DIntegrator\Source\bin\Debug\2023\MES.Civil3DIntegrator.dll"

 

When I launch my debugger, I can see AutoCAD being loaded alright, but I don't see my plugin being activated ( like I mentioned above, if I manually type in Netload then everything works just fine). When I press F2, I got this weird message:

 

netload Assembly file name: "C:\Users\User\Documents\Projects\MES\MiTS2\Civil3DIntegrator\Source\bin\Debug\2023\MES.Civil3DIntegrator.dll"*Cancel*
*Cancel*"C:\Users\User\Documents\Projects\MES\MiTS2\Civil3DIntegrator\Source\bin\Debug\2023\MES.Civil3DIntegrator.dll"
"C:\Users\User\Documents\Projects\MES\MiTS2\Civil3DIntegrator\Source\bin\Debug\2023\MES.Civil3DIntegrator.dll"

 

Notice that AutoCAD actually cancels (??) my netload, for unknown reasons!

 

On a separate note, notice that the dll is located 2 directories below the .scr file. I wonder whether it's possible to simplify the scr content  to something like

 

netload "..\bin\Debug\2023\MES.Civil3DIntegrator.dll"

 

Does SCR file support relative path?

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Accepted solutions (2)
875 Views
5 Replies
Replies (5)
Message 2 of 6

ActivistInvestor
Mentor
Mentor

Have you tried using the LISP (command) function to invoke NETLOAD? 

0 Likes
Message 3 of 6

soonhui
Advisor
Advisor

@ActivistInvestor , no haven't. But can you call .lsp file like how you call .scr file in the VS debugging command line setting?

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 4 of 6

_gile
Consultant
Consultant
Accepted solution

In the script file, replace:

 

netload "C:\Users\User\Documents\Projects\MES\MiTS2\Civil3DIntegrator\Source\bin\Debug\2023\MES.Civil3DIntegrator.dll"

 

 

with this LISP expression:

 

(command "netload" "C:\\Users\\User\\Documents\\Projects\\MES\\MiTS2\\Civil3DIntegrator\\Source\\bin\\Debug\\2023\\MES.Civil3DIntegrator.dll")

 

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 6

soonhui
Advisor
Advisor

@_gile , this is what I got after modifying the SCR file:

 

lisp command.png

 

Now the plugin is loaded and all I have to do further after this, is just to press the Enter key. There is some progress in a sense.

 

But why my original command couldn't work? It does work in other project though, but not this one. 

 

And is there anyway to enhance the script still, so that I don't have to press Enter to load the plugin?

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 6 of 6

_gile
Consultant
Consultant
Accepted solution

In an AutoCAD script file, a space or a carriage return means 'Enter'.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub