iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 26769|回复: 10
打印 上一主题 下一主题

有关CATIA二次开发的一个问题,请大家指教

[复制链接]
跳转到指定楼层
楼主
发表于 2006-3-8 15:22:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

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

x
以下是一个小程序,最后两段就是问题啦,蛮奇怪的,有高手指教吗?
Option Explicit
' COPYRIGHT DASSAULT SYSTEMES 2000

' *****************************************************************************
'   Purpose:       Create A Product Structure document containing
'                        an external component.
'   Assumtions:   Opens CAAPstHull.CATPart in the CATDocView
'   Author:
'   Languages:   VBScript
'   Locales:        English
'   CATIA Level:  V5R6
' *****************************************************************************


Sub CATMain()

    ' -----------------------------------------------------------------------------------------------
    ' Optional: allows to find the sample wherever it's installed
     Dim sDocPath As String
     sDocPath = CATIA.SystemService.Environ("CATDocView")
     If (Not CATIA.FileSystem.FolderExists(sDocPath)) Then
       Err.Raise 9999, , "No Doc Path Defined"
     End If
    ' ------------------------------------------------------------------------------------------------
   
    'Create a new product document object by adding a document with the Product
    'type to the document collection of the CATIA application.
    Dim oProductDoc As Document
    Set oProductDoc = CATIA.Documents.Add("roduct")

    'Retrieve the root product.
    Dim oRoot As Product
    Set oRoot = oProductDoc.Product

    'Retrieve the root product collection of products.
    Dim oRootCol As Products
    Set oRootCol = oRoot.Products

    'Open the Part Document
    Dim oPartDoc As Document
    Set oPartDoc = CATIA.Documents.Read("D:\图\1\1\Jin41200.CATProduct")
   

    'Add a new component from the already opened part document.
    Dim oNewComponent As Product
    Set oNewComponent = oRootCol.AddExternalComponent(oPartDoc)
   
    Dim rProduct As Product
    Set rProduct = oNewComponent.Products.Item(1).ReferenceProduct
   
    Dim MyProduct As Product
    Set MyProduct = oRootCol.AddNewComponent("roduct", "111")
   
'-----------------------下面两段改名字没反应,改不动,我试过树型里第一层以下的名称都改不动---------------------------------
    Dim MyNewProduct As Product
    Set MyNewProduct = oNewComponent.Products.AddComponent(rProduct)
    MyNewProduct.Name = "444"
   
    Set MyNewProduct = MyProduct.Products.AddNewProduct("222")
    MyNewProduct.Name = "333"
   
   
End Sub
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2006-3-8 15:48:16 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
板凳
 楼主| 发表于 2006-3-8 15:54:57 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
地板
发表于 2006-3-8 16:59:51 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
5
 楼主| 发表于 2006-3-8 17:04:33 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
6
 楼主| 发表于 2006-3-8 17:04:57 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
7
发表于 2006-3-9 11:28:13 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
8
发表于 2006-3-9 11:32:46 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
9
发表于 2006-3-9 18:23:17 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
10
 楼主| 发表于 2006-3-10 14:05:57 | 只看该作者

马上注册登录,享用更多网站功能!

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

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-10-1 17:37 , Processed in 0.015658 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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