明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 550|回复: 0

Customizing ScriptPro 2.0 to process drawings not present in the AutoCAD editor

[复制链接]
发表于 2011-2-24 11:30 | 显示全部楼层 |阅读模式
It’s time to wrap up the series on batch-reporting Registered Application IDs. For reference, here’s how we got to where we are today:
The broader point of today’s post – other than simply to deliver on step 4, above – is to demonstrate that there are definitely simple options when it comes to architecting and building your own batch-processing tool. It’s quite possible that ScriptPro 2.0 does what you want, out of the box, but in our case it does not: we do not want to load a drawing into the AutoCAD editor to process it, we want to run a custom command to load drawings in side databases in order to process them more quickly.
But as the full source code for ScriptPro 2.0 is available on Autodesk Labs, it’s a simple matter of editing it for our own purposes. I won’t go into great detail on the changes that were needed – most of which were cosmetic in nature – but I will list a few areas:
  • Changed the name of the application from ScriptPro 2.0 to RegAppReport
  • Stripped down the UI of the main dialog
    • Reduced unwanted items from the ribbon (load SCP, for instance)
    • Removed the script selection box and associated code
    • I didn’t bother changing the options dialog, at all, but I did change the load/save of the drawing lists not to include that information
  • Removed the code to open the selected document in the AutoCAD editor
  • Customized the code to call our XRA command – rather than SCRIPT – passing in the DWG we want to process via the command-line
  • Added some code to copy the file placed at C:\RegAppData.xml to the executable location, where our XSLT resides
    • I also decided to back up the previous contents of this file, in case they were needed
    • We could also have specified the XML as an argument to the command, but felt it less disruptive (in terms of changes to the previous implementation) to do it this way
  • We give the option of automatically launching the XML report (rendered to HTML, of course) after processing
It should be noted that the code developed in the previous posts, defining the XRA command, should be built into a plugin and set up to load automatically into AutoCAD at startup or when the XRA command is called (you can, of course, set this up programmatically).
Here are the C# source project and executable files for the modified ScriptPro 2.0 application.
Here’s the application in action…

[/url]

[url=http://through-the-interface.typepad.com/.a/6a00d83452464869e20147e231f64d970b-pi]




And finally the results…


It’s altogether possible to extend this application to actually – even selectively – purge RegAppIds from drawings, but that’s being left as an exercise for the reader.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-18 10:36 , Processed in 0.154692 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表