wannabe Posted October 28, 2008 Posted October 28, 2008 Im just attmepting to complete the hello world tutorial from Autodesk for the express version of C#; but already I have become stuck and cannot find in the properties for my project the option to start external programs in the debug menu. Can anyone help? Quote
CmdrDuh Posted October 28, 2008 Posted October 28, 2008 you need to manually create a user file, that points to your exe. BRB I will go get you an example Quote
wannabe Posted October 28, 2008 Author Posted October 28, 2008 1) Test in AutoCAD To test this in AutoCAD we can have Visual Studio start a session of AutoCAD. Right click on “Lab1” project in Solution Explorer and select “Properties”. In the Lab1 Property Pages dialog select ‘Debug’, check ‘Start External Program’ and use the ellipses button and browse to acad.exe. After changing this setting, hit F5 key to launch a session of AutoCAD. The “NETLOAD” command is used to load the managed application. Type NETLOAD on the AutoCAD command line to open the “Choose .NET Assembly” dialog. Browse to the location of “lab1.dll” (..\lab1\bin\debug), select it and then hit open. Enter “HellowWorld” on the command line. If all went well, the text “Hello World” should appear. Switch to Visual Studio and add a break point at the line: ed.WriteMessage(“Hello World”). Run the HelloWorld command in AutoCAD again and Thats the Autodesk training literature i downloaded. It makes it seem as though there should be an option to debug with an external program. But in my debug tab there is nothing there. I tried the project and even the class properties incase I was doing it wrong. Quote
CmdrDuh Posted October 28, 2008 Posted October 28, 2008 your not doing it wrong, Microsoft removed that option from the express editions to try and get you to upgrade and pay $$$ make a file with the same name as your proj file and put this txt in it Program C:\Program Files\AutoCAD Civil 3D 2008\acad.exe n:\ Program C:\Program Files\AutoCAD Civil 3D 2008\acad.exe n:\ ProjectFiles en-US false like Helloworld.proj.user Quote
CmdrDuh Posted October 28, 2008 Posted October 28, 2008 And change the paths to be your pathing structure Quote
wannabe Posted October 28, 2008 Author Posted October 28, 2008 Ok, thanks for that. I'll give it a shot in the next hour once im free. Cheers. Quote
wannabe Posted October 28, 2008 Author Posted October 28, 2008 Any chance you could run through that in a step by step manner, being a bit more detailed? My apologies, sorry. Quote
CmdrDuh Posted October 29, 2008 Posted October 29, 2008 here is a shorter version. and the page I got it from. I will also add the cs files you need so you can see the example. Program C:\Program Files\AutoCAD 2007\acad.exe Autodesk debugging page Quote
wannabe Posted October 29, 2008 Author Posted October 29, 2008 Im actually using ACAD 2008 at home. Will I just need to amend the 2007 in the code or is there more to it than that? Quote
CmdrDuh Posted October 29, 2008 Posted October 29, 2008 here are some pics that walk you through the major steps. pics.zip Quote
CmdrDuh Posted October 29, 2008 Posted October 29, 2008 and here is the C# code. I am posting the entire solution, as that was the easiest to zip HelloWannaBe.zip Quote
jkristia Posted October 29, 2008 Posted October 29, 2008 I have a couple of questions regarding C# / AutoCAD. #1 - is it possible to create a plugin which can be added to any of the menus or panels? #2 - is it possible to create dialogs which will behave like the 'array' dialog, where it will disappear to let you select and then re-appear? #3 - is it possible to create and add additional 'draw' tools, or can it only does the API only work on existing object ? Maybe someone can point me to some online tutorials and document taion ? Quote
CmdrDuh Posted October 29, 2008 Posted October 29, 2008 1, yes, your tools can be added to toolbars, panels, pulldowns etc. 2, yes, similiar to the way VBA works 3, depends on what you want. Quote
CmdrDuh Posted October 29, 2008 Posted October 29, 2008 Im actually using ACAD 2008 at home. Will I just need to amend the 2007 in the code or is there more to it than that? thats it, just edit that path Quote
jkristia Posted October 29, 2008 Posted October 29, 2008 1, yes, your tools can be added to toolbars, panels, pulldowns etc.2, yes, similiar to the way VBA works 3, depends on what you want. Can you point me to where I can find more information about the API ? (I'm not asking about the coding itself, that I have no problems with). edit edit edit .... a quick googling for 'AutoCAD API' pointed me to autodesk developer center'. I will take a look there first Quote
wannabe Posted November 5, 2008 Author Posted November 5, 2008 Finally got round to attempting this but im stuck between steps four and five. I have the files you sent me. But what do I do with them now? Am I meant to copy them to the C# express install folder, because it is not arranged the way yours is in the illustration. Quote
wannabe Posted November 5, 2008 Author Posted November 5, 2008 Although the debug starts autocad when I load up your code. So if i keep thinking i should be able to figure this out myself - not that you havent helped me a lot already. Quote
wannabe Posted November 5, 2008 Author Posted November 5, 2008 ok i copied the file into my project and now it works. Although, being honest, I dont fully understand waht i've done. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.