VB类和AutoCad [英] VB Class and AutoCad

查看:89
本文介绍了VB类和AutoCad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio2008.
尝试调试从AutoCad调用的VB类.
我已经告诉VS执行AutoCAD,但是AutoCAD挂起.

有什么想法吗?

Using Visual Studio 2008.
Trying to debug a VB Class which gets called from AutoCad.
I have told VS to execute AutoCAD, but AutoCAD hangs.

Any ideas why?

推荐答案

Stuart Nathan 写道:

确定. 我的班级"被设计为对AutoCad进行处理",并设置了要在AutoCad中使用的各种工具.
我仍然无法通过告诉VS启动外部程序来调试我的课程.

但是我发现了至少如何附加AutoCad流程.
现在,我至少可以逐步通过.
但是为什么它在这里失败了.
将objWriter设为新System.IO.StreamWriter("c:\ debug.txt")
objWriter.Write(a)
objWriter.Close()
错误消息是:System.Reflection.TargetInvocationException:调用的目标引发了异常. ---> System.UnauthorizedAccessException:拒绝访问路径"c:\ debug.txt" .

OK. My Class is designed to be "inprocess" to AutoCad and sets up various tools to be used inside AutoCad.
I still cannot debug my class by telling VS to start external programme.

But I have discovered how to at least get the AutoCad process to attach.
Now I can at least step through.
But why does it fail here.
Dim objWriter As New System.IO.StreamWriter("c:\debug.txt")
objWriter.Write(a)
objWriter.Close()
error message is:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access to the path ''c:\debug.txt'' is denied.

这只是权限问题.将您从中写入文件的.Net用户的访问权限设置为完全控制".我的建议是不要在C:中也不要在Root路径中写日志.将文件移到另一个驱动器.
仅供参考
如何设置,查看,更改或删除文件和文件夹的特殊权限 [如何在ASP.NET应用程序中实现模拟 [《 AutoCAD .NET开发人员指南》 [ ^ ]
在AutoCAD中介绍VB.NET [ AutoCAD和.NET入门 [

Its just permission issue. Set the access permissions to "Full control" for the .Net user from where you are writing the files. My suggestion is don''t write the logs in Root path also in C:. Move the file into another drive.
FYI
How to set, view, change, or remove special permissions for files and folders[^]
How to implement impersonation in an ASP.NET application[^]

For Autocad, see these
AutoCAD .NET Developer''s Guide[^]
Introduction to VB.NET in AutoCAD[^]
Getting started with AutoCAD and .NET[^]


这篇关于VB类和AutoCad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆