几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(VB.NET/C#) (http://www.dimcax.com/hust/forumdisplay.php?f=176)
-   -   【转帖】请教怎么样在后台判断dwg文件可写 (http://www.dimcax.com/hust/showthread.php?t=10026)

yang686526 2009-04-22 12:53 PM

【转帖】请教怎么样在后台判断dwg文件可写
 
请教怎么样在后台判断dwg文件可写
www.dimcax.com
请教怎么样在后台判断dwg文件可写
请教高手,我要写一个后台的批处理,最后需要保存我要怎么判断需要处理的dwg文件没有被锁定或只读?如果只读的话就不处理
代码: using system; using system.io; class testrw { public static void main(string[] args) { filestream fs = new filestream("xxxx.dwg文件", filemode.openorcreate, fileaccess.write); if (fs.canread && fs.canwrite) { console.writeline("myfile.txt can be both written to and read from."); } else if (fs.canwrite) { console.writeline("myfile.txt is writable."); } } }
可以这样直接读取文件判断dwg文件啊?谢谢啊 cad自己没有函数吗?
你加'using system.io; '就可以了. 不就是 filestream fs = new filestream("xxxx.dwg文件", filemode.openorcreate, fileaccess.write); if (fs.canread && fs.canwrite) { ........................... } else if (fs.canwrite) { .............................. }
我的意思的cad自己的方法里面没有判断的吗?比如map读取的时候会有一个dwl文件提示锁定了dwg


所有的时间均为北京时间。 现在的时间是 03:58 AM.