Jump to content

Recommended Posts

Posted

And now it wont work in CAD lol. What a joke.

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • wannabe

    19

  • CmdrDuh

    15

  • jkristia

    2

  • ASMI

    1

Top Posters In This Topic

Posted

what is it doing? did you netload the dll file?

Posted
ok i copied the file into my project and now it works. Although, being honest, I dont fully understand waht i've done.

If you look at picture 3, you have created a command called "Helloworld" When you type that in, it runs the code below that, which creates an editor object, and feeds it the string "Wanabe's first App" to the command line

Posted

I copied your file into my lab1 project. Then it successfully built the dll in my debug folder. Autocad then starts and i netload the lab1.dll from my debug folder. When i type in HelloWorld it says unknown command.

 

The code is as per the manual and there are no errors.

Posted

Your code works fine. So maybe I have misunderstood what is required when copying the file to enable me to run it in CAD.

 

All I did was copy your file with all the AutoCAD shortcuts into my folder; Im guessing thats wrong.

Posted

when you say you copied the file into project, did you copy the dll or open the solution and copy from the cs file?

Posted
when you say you copied the file into project, did you copy the dll or open the solution and copy from the cs file?

 

I copied the csproj.user file from the file you sent me into my own version of the Hello World command (called Lab1).

 

the debug then worked perfectly; loading AutoCAD in the same way as it did from your file. Subsequently I went into my debug folder and the Lab1.dll was there so I NETLOAD it.

 

But, when I type in HelloWorld its an unknown command.

 

I had both our codes open side by side (class1.cs) and apart from the text that displays on the commandline (Hello World for and Wannabe... for you) the code is the same.

 

So, in short, the debug loads CAD but my command is unknown - but your command works and loads perfectly. Therefore, is this probably an issue with copying the file from one folder to another (the file that had the code in to load AutoCAD as the debug program?

Posted

Still puzzled with this one. Driving me mad.

 

I think I will have to continue the training using your code and establish what went wrong with mine at a later date.

Posted

2 things, did you add the references to the 2 dll files from the Autocad folder and set local to false? Second, can you zip up your project and email it to me at cmdrduh@gmail.com ?

Posted

You're an excellent help. You have mail.

Posted
> wannabe

 

.NET training video from Autode$k http://usa.autodesk.com/adsk/servlet/index?id=1911627&siteID=123112

 

When we will see the first line of your code? :D

 

LOL

 

As funny as it may seem. Not too long from now (I hope a few months time) I will be fairly well educated in the philosophy of C# (through research and practice) and will have done a few basic programs.

 

So by then I will be looking form some basic CAD requirements that you may have for me.

 

If you want to make it as professional as possible i.e you're the customer and I am the programmer who also runs the business, that would be excellent from my point of view. To get me thinking and acting out in the environment I aspire, and aim, to be in.

 

thanks for the link.

 

 

EDIT: Just as practice, as I don't expect to produce code worthy of profit for a long time.

Posted

I should have found that video myself. But cheers, its a great help to my theory and practical education.

Posted

acmgd is set to copy local TRUE. change that and recompile and see what happens

Posted

Here is Wannabe's code, which appears to be correct, except for the copy local part

[size=2][color=#0000ff]
using[/color][/size][size=2] System;
[/size][size=2][color=#0000ff]using[/color][/size][size=2] System.Collections.Generic;
[/size][size=2][color=#0000ff]using[/color][/size][size=2] System.Linq;
[/size][size=2][color=#0000ff]using[/color][/size][size=2] System.Text;
[/size][size=2][color=#0000ff]using[/color][/size][size=2] Autodesk.AutoCAD.ApplicationServices;
[/size][size=2][color=#0000ff]using[/color][/size][size=2] Autodesk.AutoCAD.EditorInput;
[/size][size=2][color=#0000ff]using[/color][/size][size=2] Autodesk.AutoCAD.Runtime;
[/size][size=2][color=#0000ff]namespace[/color][/size][size=2] Lab1
{
[/size][size=2][color=#0000ff]public[/color][/size][size=2] [/size][size=2][color=#0000ff]class[/color][/size][size=2] [/size][size=2][color=#2b91af]Class1
[/color][/size][size=2]{ 
[[/size][size=2][color=#2b91af]CommandMethod[/color][/size][size=2]([/size][size=2][color=#a31515]"HelloWorld"[/color][/size][size=2])]
[/size][size=2][color=#0000ff]public[/color][/size][size=2] [/size][size=2][color=#0000ff]void[/color][/size][size=2] HelloWorld()
{
[/size][size=2][color=#2b91af]Editor[/color][/size][size=2] ed = [/size][size=2][color=#2b91af]Application[/color][/size][size=2].DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage([/size][size=2][color=#a31515]"Hello World"[/color][/size][size=2]);
}
}
}

[/size]

Posted

For some reason I only thought the other CAD reference needed to be set as false.

 

Thanks for your comments.

Posted

HelloWorld() should be static

dan

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...