找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?在线3D打印服务,一键上传,自动报价 
查看: 12491|回复: 0
打印 上一主题 下一主题

[求助] 新人求问catia编程方面问题

[复制链接]
跳转到指定楼层
1
发表于 2013-12-5 22:45:18 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
'COPYRIGHT DASSAULT SYSTEMES 2000-2001
Option Explicit
Dim Language
Language="VBSCRIPT"

'*****************************************************************************
' Purpose:      This macro calls the kinematics solver
'               and applies the computed motion to a
'               part of the mechanism
'               in a specific product document
' Assumptions:  The product document used as input is result of the
'               CAAKiiMechanismCreation use case
' Author:      
' Languages:    VBScript
' Version:      V5R6
' Locales:      US English
'*****************************************************************************

Sub CATMain()

    '==================================================================
    ' 1-Prolog
    '==================================================================
    '------------------------------------------------------------------
    ' 1.a-Declare required variables: command set, motion matrix
    '------------------------------------------------------------------
    Dim dValcmd(1)
    Dim dMotion(11)

    '------------------------------------------------------------------
    ' 1.b-Retrieve the root product
    '------------------------------------------------------------------
    Dim oRootProduct
    Set oRootProduct = CATIA.ActiveDocument.Product

    '------------------------------------------------------------------
    ' 1.c-Retrieve the Mechanisms as a TechnologicalObject of the Product
    '------------------------------------------------------------------
    Dim cTheMechanisms
    Set cTheMechanisms = oRootProduct.GetTechnologicalObject("Mechanisms")

    '------------------------------------------------------------------
    ' 1.d-Take 1st mechanism found, and first moving part
    '------------------------------------------------------------------
    Dim oFirstMechanism
    Set oFirstMechanism = cTheMechanisms.Item(1)


    '==================================================================
    ' 2-Retrieve number of moving parts, and first one
    '==================================================================
    Dim iNbProd
    iNbProd = oFirstMechanism.NbProducts

    Dim oMovingPart
    Set oMovingPart = oFirstMechanism.GetProduct(1)


    '==================================================================
    ' 3-Retrieve current command values
    '==================================================================
    oFirstMechanism.GetCommandValues dValcmd


    '==================================================================
    ' 4-Solve for other command values
    '==================================================================
    '------------------------------------------------------------------
    ' 4.a-Create another command set
    '------------------------------------------------------------------
    dValcmd(0) = dValcmd(0) + 10

    '------------------------------------------------------------------
    ' 4.b-Apply the command set
    '------------------------------------------------------------------
    oFirstMechanism.PutCommandValues dValcmd


    '==================================================================
    ' 5-Retrieve motion for a part after solving and apply it
    '==================================================================
    '------------------------------------------------------------------
    ' 5.a-Retrieve motion for a part after solving
    '------------------------------------------------------------------
    oFirstMechanism.GetProductMotion oMovingPart,dMotion
    '------------------------------------------------------------------
    ' 5.b-Apply the motion to the part
    '------------------------------------------------------------------
    oMovingPart.Move.Apply dMotion

End Sub

上面这是CATIA自带的程序  但是运行多个运动副机构的时候在oFirstMechanism.GetCommandValues dValcmd出现错误 求高手指点



该贴已经同步到 我就是小黑人的微博

本帖子中包含更多资源

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

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-9-23 20:10 , Processed in 0.024979 second(s), 15 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

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