C#ATIA

↑タイトル詐欺 主にFusion360API 偶にCATIA V5 VBA(絶賛ネタ切れ中)

穴テンプレートのオペレーション部を考える2

時間が経ちましたが、こちらの続きです。
穴テンプレートのオペレーション部を考える1 - C#ATIA

穴テンプレートのオペレーション部のこちら

    <holeData operationType="drill" toolDiameterRatio="1.000000" version="1.0">
      <holeMapping>
        <segment index="2"/>
      </holeMapping>
    </holeData>

operationType部分の文字を取得する関数を作成しました。

def get_hole_data_operation_type(
        ope: cam.Operation,
) -> str:

    supportedTypes = [
        "drill",
        "bore",
        "circular",
        "thread",
    ]

    strategy = ope.strategy
    if not strategy in supportedTypes: return ""

    if strategy == "drill":
        cycleType = ope.parameters.itemByName("cycleType").value.value

        if cycleType == "drilling":
            return "drill"
        elif cycleType == "counter-boring":
            return "drill"
        elif cycleType == "chip-breaking":
            return "drill"
        elif cycleType == "deep-drilling":
            return "drill"
        elif cycleType == "break-through-drilling":
            return "drill"
        elif cycleType == "gun-drilling":
            return "drill"
        elif cycleType == "reaming":
            return "ream"
        elif cycleType == "boring":
            return "boringBar"
        elif cycleType == "boring":
            return "boringBar"
        elif cycleType == "stop-boring":
            return "boringBar"
        elif cycleType == "fine-boring":
            return "boringBar"
        elif cycleType == "back-boring":
            return "boringBar"
        elif cycleType == "tapping":
            return "rightTap"
        elif cycleType == "right-tapping":
            return "rightTap"
        elif cycleType == "left-tapping":
            return "leftTap"
        elif cycleType == "circular-pocket-milling":
            return "flatEndMill"
        elif cycleType == "bore-milling":
            return "flatEndMill"
        elif cycleType == "thread-milling":
            return "milcc"
        elif cycleType == "probe":
            return "invalid"        
        else:
            return ""
    else:
        return strategy

僕が調べた感じではこんな感じです。恐らく・・・。

対応しているオペレーションは、ドリルの全てのサイクルタイプです。
2Dの"ねじ" "ボア" "円形" の3タイプも穴テンプレートとして
認められているので、こちらも対応させています。