首页 热点资讯 义务教育 高等教育 出国留学 考研考公

catia二次开发求助

发布网友 发布时间:2022-04-22 04:53

我来回答

1个回答

热心网友 时间:2023-10-15 09:01

首先,因为你的这个SPAWorkbench是当前ActiveDocument的.
你当前的活动文档就是你需要测量的2个产品的父文档.它是个Proct.
在Proct里创建Reference只有CreateReferenceFromName可以用的.
这个函数的使用需要写出你想创建Reference的特征的Brep Name.函数的说明如下:

Func CreateReferenceFromName(

CATBSTR
iLabel) As

Reference

Creates a reference from a name. A reference is an object that can stand for
any geometrical object. Creating references is necessary for adding constraints
between two components using Brep elements of the representations of these
components.

Parameters:

iLabel
The path of the Brep element to use in the constraint. This path is passed
as a character string comprising the component path from the root proct to the
component concerned, concatenated to the Brep element path in the proct's
representation. Components are separated using "/", and the proct path is
separated from the Brep using "/!".

Returns:
The created reference
Example:
This example creates a reference from the path of a Brep element in the
Prod2 proct located below the Root root proct. The face is
located in the Pad.1 pad and limited by the Circle.1 circle.
Dim Ref As Reference
Ref = Prod2.CreateReferenceFromName("Root/Prod2/!Face:(Brp:(Pad.1:0(Brp:(Circle.1))):None())")

你用的 Part.CreateReferenceFromObject只能在零件级的文档内使用.
这个用了也没用.你的Proct得不到这个在part里创建的Reference.因为不是一个文档.

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com