elvint 发表于 2012-10-5 17:05

ANSOFT脚本PropHost问题

本帖最后由 elvint 于 2012-10-5 17:22 编辑

1 PropHost 及其意义
Callback Scripting Using PropHost Object
Callback scripts are scripts that can be set in the Property Dialog for individual properties by clicking the button in the Callback column and choosing a script that is saved with the project. Callback scripts can contain any legal script commands including general Ansoft script function calls (e.g. GetApplication(), …). In addition, they can call functions on a special object named PropHost. The PropHost represents the PropServer (owner of properties) that contains the Property that is calling the Callback script. Therefore, the Callback script can use the PropHost's functions to query or set other properties in the same PropServer.

Definitions
<propName> = text string
<value> = double
<valueText> = text string
<fileName> = full path file name
<choices> = string containing menu choices separated by commas
<initialChoice> = string containing initial choice for menu; must be one of the <choices>
<scriptName> = string containing name of script stored in project
<bool> is 1 for true or 0 for false

通过帮助可以看到,Callback script 和PropHost's functions 可以实现很强的功能。
2 PropHost 的应用中的错误
列举帮助中有关PropHost 对象的一个功能实例:
PropertyExists
Finds named property and returns its property type.Returns 1 if property exists in any tab, 0 if it does not.
Syntax: PropertyExists(<propName>)
Example: a = PropHost.PropertyExists( "W1");
returns 1 since this property is present on DefinitionParams tab

如果在其他脚本命令正确的前提下运行这条语句,运行这个命令时,会提示 PropHost这个对象没有定义。
3 问题
1) Callback script 是什么脚本,是否可以自行编辑?说它由Project保存的Script是指什么意思?
2) Ansoft的PropHost对象如何定义?
这个问题让人很糊涂,且Ansoft并未直接给出一个定义的实例,希望有经验的人不吝赐教,也希望有同样问题的人能进行讨论。

wuyiniao11 发表于 2013-5-13 10:29

楼主解决了类似的问题了吗?我也想知道,求联系
页: [1]
查看完整版本: ANSOFT脚本PropHost问题