+发表新主题
dnfon 发布于2006-8-30 15:18 66 次浏览 3 位用户参与讨论
跳转到指定楼层
Option Explicit
' COPYRIGHT DASSAULT SYSTEMES 2000
Dim Language As String
Language="VBSCRIPT"
Sub CATMain()
Dim oPartDocument As PartDocument
Set oPartDocument = CATIA.Documents.Open("D:CatiahelpEnglishonlineCAAScdPriUseCasessamplesPad.CATPart")
   Dim oPart As Part
    Set oPart =  CATIA.ActiveDocument.Part

    ' Retrieve the part body of the document containing the pad to be used
    Dim oBody As Body
    Set oBody = oPart.Bodies.Item  ( "MechanicalTool.1" )

    ' Retrieve the pad of the body
    Dim oPad As Pad
    Set oPad = oBody.Shapes.Item  ( &quotad.1" )

    ' Retrieve the vertical edges of the pad to be filleted
    Dim oEdge1 As Reference
    Set oEdge1 = oPart.CreateReferenceFromBRepName  ( "REdgeEdge:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;1)));None:());Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;2)));None:());None:(Limits1:();Limits2:()));WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport)", oPad )

    Dim oEdge2 As Reference
    Set oEdge2 = oPart.CreateReferenceFromBRepName  ( "REdge:(Edge:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;2)));None:());Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;3)));None:());None:(Limits1:();Limits2:()));WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport)", oPad )

    Dim oEdge3 As Reference
    Set oEdge3 = oPart.CreateReferenceFromBRepName  ( "REdge:(Edge:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;3)));None:());Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;4)));None:());None:(Limits1:();Limits2:()));WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport)", oPad )

    Dim oEdge4 As Reference
    Set oEdge4 = oPart.CreateReferenceFromBRepName  ( "REdge:(Edge:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;4)));None:());Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;1)));None:());None:(Limits1:();Limits2:()));WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport)", oPad )

    ' Define the fillet to be created with the first edge
    Dim oEdgeFillet1 As ConstRadEdgeFillet
    Set oEdgeFillet1 = oPart.ShapeFactory.AddNewEdgeFilletWithConstantRadius  ( oEdge1, 1, 5.000000 )

    ' Add the others edges to be filleted
    oEdgeFillet1.AddObjectToFillet oEdge2
    oEdgeFillet1.AddObjectToFillet oEdge3
    oEdgeFillet1.AddObjectToFillet oEdge4

    ' Define the fillet radius to 5 mm
    oEdgeFillet1.Radius.Value = 5.000000

    ' Define the fillet to be propagated to all the tangent contiguous edges
    oEdgeFillet1.EdgePropagation = 1

    ' Update the document
    oPart.Update

    ' Retrieve the top face of the pad to be filleted
    Dim oTopFace As Reference
    Set oTopFace = oPart.CreateReferenceFromBRepName  ( "RSur:(Face:(Brp:(Pad.1;2);None:());WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport)", oEdgeFillet1 )

    ' Retrieve the bottom face of the pad to be filleted
    Dim oBottomFace As Reference
    Set oBottomFace = oPart.CreateReferenceFromBRepName  ( "RSur:(Face:(Brp:(Pad.1;1);None:());WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport)", oEdgeFillet1 )

    ' Define the fillet to be created with the first face
    Dim oEdgeFillet2 As ConstRadEdgeFillet
    Set oEdgeFillet2 = oPart.ShapeFactory.AddNewEdgeFilletWithConstantRadius  ( oTopFace, 1, 15.000000 )

    ' Define the fillet radius to 5 mm
    oEdgeFillet2.Radius.Value = 5.000000

    ' Add the other face
    oEdgeFillet2.AddObjectToFillet oBottomFace

    ' Update the document
    oPart.Update

End Sub
回复

使用道具 举报

已有3人评论

qiuqiuq520 发表于 2006-8-31 18:45:28
请问LZ,这个能做什么
回复

使用道具 举报

分手的拥抱 发表于 2006-9-2 07:25:34
利用宏录制功能可以减少操作,每次操作只需简单修改,然后执行宏。
回复

使用道具 举报

张飞鸿 发表于 2006-9-5 15:30:00
真是高手啊
回复

使用道具 举报

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

本版积分规则

QQ| Archiver|手机版|小黑屋| 碧波制图网 Stonespider

Copyright © 2021-2023 Kangli Wu   All Rights Reserved.

Powered by Discuz! X3.5( 苏ICP备18011607号-1 )

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