-2

プローブが両方のパーツと接触するように、プローブのような球を 2 つのパーツ間で移動する必要があります。そして、パーツの接触点を見つけ、それらの距離を測定し、この距離に基づいてパーツにフィレットを作成する必要があります。パーツ間で球体を移動することはできましたが、球体はパーツ間を移動しています。したがって、制約に関して移動しようとしています

Catia Product の操作ツールを自動化しようとしています。vba を使用して、Catia の拘束に関してパーツを移動するコマンドまたはメソッドはありますか?

または

vba を使用して 2 つのパーツ間の衝突を見つける方法はありますか?

解決策を楽しみにしています。

ありがとうございました!!!

4

1 に答える 1

0

これは、衝突の解決策を見つけることができるリンクです。

わかりました、ここでコードを見たいと思います:-)

CATScript で干渉を計算するには:

    Sub CATMain()

    ' get root product of document
    Dim RootProd As Product
    Set RootProd = CATIA.ActiveDocument.Product

    ' retrieve selection object of active document
    Dim objSelection As Selection
    Set objSelection = CATIA.ActiveDocument.Selection

    ' get two selected objects
    If (objSelection.Count2 <> 2) Then
    MsgBox "Before running the script you must select two products to compute clash for", vbOKOnly, "No products selected"
    Exit Sub
    End If

    Dim FirstProd As Product
    Dim SecondProd As Product

    Set FirstProd = objSelection.Item2(1).Value
    Set SecondProd = objSelection.Item2(2).Value

    ' create groups for clash computation
    Dim objGroups As Groups
    Set objGroups = RootProd.GetTechnologicalObject("Groups")

    Dim grpFirst As Group
    Dim grpSecond As Group

    Set grpFirst = objGroups.Add()
    Set grpSecond = objGroups.Add()

    ' add selected products to groups
    grpFirst.AddExplicit FirstProd
    grpSecond.AddExplicit SecondProd


    ' get access to Clashes collection
    Dim objClashes As Clashes
    Set objClashes = RootProd.GetTechnologicalObject("Clashes")

    ' create new clash
    Dim newClash As Clash
    Set newClash = objClashes.Add()

    ' set new clash to be computed between two groups (two selected products)
    newClash.FirstGroup = grpFirst
    newClash.SecondGroup = grpSecond

    newClash.ComputationType = catClashComputationTypeBetweenTwo

    ' compute clash
    newClash.Compute

    End Sub 
于 2016-01-13T18:33:26.507 に答える