2006年10月13日星期五

从定制AutoCAD软件菜单的痛苦中逃离

翻译下面一篇cadalyst的Lynn Allen的文章。翻译水平比较一般,只好凑合看看了:)
http://management.cadalyst.com/cadm...l.jsp?id=170617

Circles and Lines: Taking the Pain Out of Customizing AutoCAD Menus,If you are new to customizing AutoCAD, CUI is for you.
圆和线∶从定制AutoCAD软件菜单的痛苦中逃离--

如果你对AutoCAD软件的定制不熟悉,CUI是对你最好的工具。

Oct 14, 2005
By: Lynn Allen
Cadalyst
Customization has changed in AutoCAD 2006. You no longer have to know the cryptic code of the ACAD.MNS file. You no longer need to figure out the difference between the MNU, MNS, MNR, MNL and MNX
file (yikes!). Now it's as easy as drag and drop -- very similar to that which you've experienced with the friendly AutoCAD toolbars. Those of us who have been customizing our menus for quite some time were skeptical at first. We (sadly) know the difference between all those scary file types. But now ever
yone has a chance to participate in the power of customizing -- and isn't that much better? Let's share the wealth a little!
AutoCAD2006 在定制方面已经发生了变化。你不再需要认识类似密码一样的acad.mns文件了。你不再需要明白mnu,mns,mnr,mnl,mnx之间的区别了。 现在它就如同拖放一样简单了,很类似于你在友好的AutoCAD工具栏那里得到的体验。我们这些长期以来自定义菜单的老家伙起先都是不相信的。我们曾经 (悲伤地)认识到这些令人恐怖的文件之间的差别。但是现在人人都有机会和权利去定制菜单了--这不是更好么?让我们一起来看看这笔财富!


The new CUI (Customization User Interface) has received some bad press, primarily because it's different. Those of you who know how to program menus the old way aren't forced to change -- you can still create your menus and then transfer them into the CUI. The new ACAD.CUI file is XML based, as opposed to the ASCII text files of the past. XML gurus technically can edit the XML file directly, but it's REALLY not recommended. This article will primarily focus on users who are new to the customizing process and who want to gain a little more control over their AutoCAD environment.

因 为它的不同以往,新的CUI(定制用户界面)已经受到了一些坏的批评。那些知道如何定义程序菜单的高手不愿意改变,但是仍然可以建立你的菜单文件再把他们 转为换成将他们转换成cui。新的cad.cui文件是建立在xml的基础上的,这个和以前的ASCII文本文件不一样。虽然xml
gurus技术可以直接地编辑xml文件,但是我们不推荐这种方法。本文的主要目的集中在那些希望定制和想获得更多AutoCAD环境控制的新手。


Jump In!
The CUI is a one-stop shop for customizing. Here you can customize your toolbars, your pull-down menus, your right-click shortcut menus and your keyboard shortcuts (accelerators). You can even customize your tablet menus, image tile menus and the good old screen menu (listed under Legacy in the
dialog box). The one thing you won't use the CUI for is the tool palette -- that's still done dynamically directly on the palette.
进入!
CUI 是个定制的一站式大商店。在这里你可以定制你的工具栏、你的下拉菜单、你的右键快捷菜单和你的快捷键(加速)。你甚至可以定制你的数字化仪菜单、图像平铺 菜单和古老的屏幕菜单。但有一样东西你不会使用CUI来完成的,那就是工具调色板,因为它仍然需要在palette调色板上直接完成。


To get started, simply execute the CUI command. Key it in or right-click on any toolbar and select Customize from the menu. In general, the types of menus are listed in the upper left corner of the CUI, the AutoCAD commands are listed in the lower left corner, and the actual customizing will occur on the right side (figure 1).

要开始的话,仅需执行CUI命令。键入这个命令,或者在工具栏上右击并选择定制。通常菜单类型是列在CUI的左上角、AutoCAD命令是列在左下角,实际定制出现在右边(图表1)。



Figure 1. The CUI dialog box.
图1 CUI对话框

Let's add another pull-down menu of our favorite commands to the existing AutoCAD menu.
Select Menus from the CUI to display a list of the current pull-down menus. Right-click on any of the menus, and select New to create a new pull-down. Enter "Favorites" as the title. This will place our menu at the end of the list. Drag the new menu between Tools and Draw (figure 2). Now you're ready to drag and drop your favorite commands into your new menu.

让 我们把我们的喜爱的命令(命令收藏夹)的下拉菜单加入到现有的AutoCAD软件菜单中。从CUI中选择菜单显示一列当前的下拉菜单。在任何菜单右击,选 择new(新建)建立一新下拉菜单。输入"Favorites"(收藏夹)作为标题。这会在列表的末端放置我们的菜单。拖该菜单到Tools工具和 Draw绘画之间(图2),现在你就可以拖放你喜爱的命令到你的菜单里了。


Figure 2. Creating a new pull-down menu in the CUI.
图形⒉在CUI建立一新下拉菜单。

Simply select your commands one by one from the list in the lower left corner. I've added Trim, Copy, Move, Offset and Insert for my list (figure 3). Select the command and then drag and drop them to the Favorites menu. You can key in the first letter of the command you want, and the CUI will jump to the commands that begin with that letter. After adding them to your menu, feel free to move them around to get them in the desired order. Select OK to save and exit the dialog box, and then take a look at your masterpiece!
只须一个接一个从该列表的左下角选择你的命令然后拖放就可以了,我已经添加Trim,Copy, Move, Offset和Insert到我的列表中(图3),选择该命令然后把拖放他们到收藏夹菜单中。你可以键入你需要命令的第一字母,然后CUI会跳到那些由那 字母开始的命令(译注:在中文cad2006中我发现不能这样)。在添加它们到你的菜单以后,就可以按照你要求的次序来移动它们。选择OK保存和退出对话 框、然后看看你的杰作!


Figure 3. A sample customized menu of favorite commands.
图形⒊一个定制喜爱命令的菜单样品。

Location,Location, Location
So is your new menu in the right location? Probably not.
Even though the CUI displays it in the right location in the list, your Favorites menu is probably the very last menu -- what's up with that? If you go back into the CUI and select your new menu, you'll see that the new menu has an alias of POP12 (or something similar). Each of the pull-down menus has a number assigned to it. The File menu is POP1, Edit is POP2, etc. This is the order the pull-down menus will display. So even though you drag your menu to a different location,it's still hard-coded to move to the end. You can manually change the various numbers to get it in the proper location or just leave it at the end.

位置、位置、位置
你 的菜单在正确的位置么?大概没有。即使CUI显示它在列表的正确位置、你的收藏夹菜单是大概还是在最后的菜单,为什么?如果你回到CUI里面并选择你的菜 单、你将看到新菜单已经有一个别名叫pop12(或其他类似的)。每一个下拉菜单都已经分配了一数字,比如文件菜单是POP1,编辑菜单是POP2等等, 这个是下拉菜单将显示的次序。所以,即使你硬拉你的菜单到一不同的位置处、它仍然会固执的跑到最后。你可以人工地改变数字使得它去到正当的位置或就让它放 在最后。

You are currently editing the AutoCAD menu (ACAD.CUI). If you decide to upgrade to the next release of AutoCAD, you'll find that the corresponding ACAD.CUI will override this one, and it will be very difficult for you to migrate your precious customizing. For this reason, you might find it better to create a partial menu.
It's easy to insert a partial menu into this and subsequent releases of AutoCAD.
The Express Menu is an example of a partial menu -- it's simply added into the AutoCAD menu environment. Let's look at the procedure for that (only slightly different and just as easy!).

你 现在正在编辑的是AutoCAD菜单(acad.cui),如果你决定升级到下一个AutoCAD版本,那么你将发现对应的acad.cui会替换现在这 个cui,这将使得移植你最喜欢的定制变得非常困难。为此你最好建立一局部的菜单。而将一局部的菜单插入到这个版本和以后版本的AutoCAD是很容易 的。Express
菜单就是一局部的菜单的例子,它只须添加到AutoCAD菜单环境里面。让我们看看这个流程(仅仅稍有不同但也非常简单)

Partial Menus
From the upper left corner of the CUI, select Partial CUI Files. You'll find a partial menu called Custom that Autodesk has earmarked for you to use for your own customization purposes. Select Custom, and then follow very similar steps as before. Select Menu/ (right-click) / New/ Menu. Name this one Favorites2 and add the commands just as before (figure 4).

局部菜单
从CUI 的左上角选择局部的CUI文件。你将发现一个叫做Custom的局部菜单,这个是Autodesk专门给你作定制用的。选择Custom,然后遵循如前所 述的非常类似的步骤。选择菜单/(右击)/新/菜单。把这个命名为favorites2并且如前面一样添加该命令(图4)。


Figure 4. Creating a partial menu in the CUI.
图形⒋建立一局部的菜单在该CUI。

So Favorites2 should now be the last of the pull-down menus. We used to be able to specifically control where the partial menus appeared within the pull-downs with the Menuload command, but if that functionality still exists in AutoCAD 2006,
I couldn't find it. It's not the end of the world, but it would be nice if we could control where the partial menus landed. You can still control them through AutoLISP for you LISPers out there.

那么favorites2现在是最后一个下拉菜单了。我们曾经能够通过Menuload命令来明确地控制局部的菜单出现在下拉菜单的哪个部分,但是我却找不到这个功能了,虽然menuload还存在于AutoCAD
2006里面的话。尽管还没到山穷水尽的地步,但是如果我们可以控制局部的菜单的位置的话那该多好啊。当然你仍然可以通过autolisp来控制它们。


Just a quick look at the other tools in the customization section of the CUI (figure 5): you can load a partial CUI file from disk by selecting the first tool. The second tool lets you save all of your current customization files (can't make out what the difference is between this and Apply).

下面再稍微对CUI的定制部分瞄一眼(图5)。你可以通过选择第一个图标工具来从一个磁盘中载入一个局部的的CUI文件。而第二个图标工具让你保存所有你的当前的定制文件(还弄不懂这和Apply的区别)。




Figure 5. Tools in the customization section of the CUI.
图形⒌在CUI定制部分的工具


Figure 6. The Display Filters dialog box controls what appears in the CUI dialog box.
图形⒍显示过滤器对话框控制什么将出现在CUI对话框中。

The last tool displays the dialog box displayed in figure 6. The Display Filters dialog box allows you to control just exactly what displays in the CUI dialog box (making it easier for you to work on the different customization types). If you're only working on menu customization, you might choose to turn off toolbars, mouse buttons,legacy, etc. This is very similar to the layer filter concept.
For those of you who are transferring your old menus into AutoCAD 2006, be sure to install Service Pack 1. This will ensure your menus are imported into AutoCAD in the best possible shape.
This is just an introductory look at the new CUI. Next month we'll dive deeper and take a look at some of the other sections.
Happy customizing and happy AutoCAD-ing!

图形⒍展示了图5中最后一个图标工具显示的对话框,显示过滤器的对话框允许你控制哪些东西在CUI对话框中显示(这方便你对不同的定制类型进行操作),如果你是仅仅是对菜单定制的话,那么你可以关掉工具栏、鼠标按纽、传统设置等等,这很类似于层过滤器概念的。
对那些传递你的老菜单到AutoCAD2006里的,切切要安置Service
Pack 1.这会确保你的菜单是完美的带进AutoCAD中。
这只是一个新CUI的简介。下月我们将钻研其他的部分。
幸福的定制和幸福地使用AutoCAD。

By
qjchen