[bug?] Inserted mesh name was hidden in parametric mode

[bug?] Inserted mesh name was hidden in parametric mode

Daisuke.Inokuma1
Participant Participant
516 Views
3 Replies
Message 1 of 4

[bug?] Inserted mesh name was hidden in parametric mode

Daisuke.Inokuma1
Participant
Participant

When inserting a mesh via my script while parametric mode, the mesh name does not insert to the component tree.
This behavior was not seen before the latest Fusion (version 2.0.10440).

 

How can I resolve it? Thanks in advance.

 

import adsk.core, adsk.fusion, traceback

_app: adsk.core.Application = adsk.core.Application.get()
_ui: adsk.core.UserInterface = _app.userInterface


def run(context):
    try:
        root: adsk.fusion.Component = _app.activeProduct.rootComponent

        isParametric = _app.activeProduct.designType == adsk.fusion.DesignTypes.ParametricDesignType
        if isParametric:
            baseF = root.features.baseFeatures.add()
            baseF.startEdit()

        root.meshBodies.add("C:/temp/ball.stl", adsk.fusion.MeshUnits.MillimeterMeshUnit)

        if isParametric:
            baseF.finishEdit()

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

In Direct ModeIn Direct ModeIn Parametric ModeIn Parametric Mode 

0 Likes
Accepted solutions (1)
517 Views
3 Replies
Replies (3)
Message 2 of 4

kandennti
Mentor
Mentor
Accepted solution

Hi @Daisuke.Inokuma1 .

 

Even in parametric mode, you don't need to use the BaseFeature.

def run(context):
    try:
        root: adsk.fusion.Component = _app.activeProduct.rootComponent

        isParametric = _app.activeProduct.designType == adsk.fusion.DesignTypes.ParametricDesignType
        # if isParametric:
        #     baseF = root.features.baseFeatures.add()
        #     baseF.startEdit()

        root.meshBodies.add("C:/temp/ball.stl", adsk.fusion.MeshUnits.MillimeterMeshUnit)

        # if isParametric:
        #     baseF.finishEdit()

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

BRepとかだけっぽいっすよ。

0 Likes
Message 3 of 4

Daisuke.Inokuma1
Participant
Participant

kandenntiさん、いつもフォーラムやブログで大変お世話になっております!

メッシュの挿入ではベースフィーチャの開始は不要だったのですね、なるほどです。
そして、本バージョンからペナルティでツリーにメッシュが入らなくなったのですね…笑

 

理解しました。ご回答ありがとうございました!

Thank you for your valuable answer!

0 Likes
Message 4 of 4

kandennti
Mentor
Mentor

@Daisuke.Inokuma1 さん

 

>そして、本バージョンからペナルティでツリーにメッシュが入らなくなったのですね…笑

イヤ、普通にツリーにメッシュボディとして入りましたよ。

 

BaseFeatureのEdit内は何かちょっと特別な感じがします。

そもそもGUIでEdit状態ではメッシュが扱えないと思うので、その辺でも

良くない事が起きるのだと思いますよ。

0 Likes