Python中使用KCS_ATT模块处理Tribon用户定义属性及异常管理.pdfVIP

  • 0
  • 0
  • 约3.97千字
  • 约 4页
  • 2026-02-04 发布于北京
  • 举报

Python中使用KCS_ATT模块处理Tribon用户定义属性及异常管理.pdf

3.31通用

通过语句importkcs_att,这些函数可以在Python程序中使用。然后,这些

函数可以被为kcs_att.函数名。在使用新函数之前,请仔细阅读函数描述。

用户定义的属性使得在Tribon产品信息模型中用户指定的数据成为可能。

使用Tribon工具包首选项程序,可以创建属性模板。属性模板描述了在

属性中的数据类型。属性模板可以包含以下任意数量的内容:

•整数

•实数

•字符串

•日期和时间

•外部文件

在函数描述中,斜体参数表示可选参数。如果省略,则使用该参数的默认值。

以下描述的几个函数使用了一个目标参数。目标参数应为以下之一:

•模型类表示一个模型。

•None表示当前绘图。

•ElementHandle类表示一个绘图视图。

对于某些模型类型,允许在模型及其的部分上附加用户定义的属性。在这

种情况下,将Model.PartId设置为零表示模型本身。

3.3.2异常处理

Vitesse用户定义属性接口使用异常处理。这意味着如果在运行时发生错误,

将设置一个异常。可以使用Python语言的“try‑except”结构捕获该异常。

_

然后可以通过检查kcsatt.error的值来确定错误类型。异常也会显示在

Vitesse日志窗口中,该窗口可以通过Vitesse日志窗口命令,并可以选

择写入日志文件。异常的含义可以在相应函数的描述中找到。

3.3.1General

ThefunctionsaremadeavailableinthePythonprogrambytheinsertionofthe

statementimportkcs_att.Thefunctionsarethenreferredtoaskcs_att.function

name.Beforeusinganewfunction,pleasecarefullyreadthefunctiondescription.

User-definedattributesmakesitpossibletostoreuserspecifieddataintheTribon

ProductInformationModel.UsingtheTribonToolkitPreferenceprogram,attribute

temtescanbecreated.Anattributetemtedescribeswhatkindofdatathatisstored

inanattribute.Anattributetemtecancontainanynumberofthefollowing:

•Integernumber

•Realnumber

•String

•Dateandtime

•Referencetoanexternalfile

Inthefunctiondescriptions,parametersinItalicmeansoptionalparameters.Ifomitted,

adefaultvalueforthatparticularparameterisusedinstead.

SeveralofthefunctionsdescribedbelowusesaTargetparameter.Thetargetparameter

shouldbeoneofthefollowing:

•Modelclassindicatesamodel.

•Noneindicates

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档