Autodesk Fusion Programmatic Material Property and Light Manipulation

Using Fusion (formerly Fusion 360) python scripting, I am trying to generate some orthographic and isometric views as .pngs given a .step file.

This is what I have so far (these are 2 of the 4 images generated):

iso
front

I am having trouble with two things:

  • Programmatically changing the RGB color and the roughness setting of this CAD object
  • Programmatically turning off the shadows on the ground and near the edges and bends of the object

I have attempted to solve both of these by consulting the docs, as you will see in my script, to no avail. Any help or guidance would be much appreciated. Code is commented by AI for readability.

import adsk.core, adsk.fusion, adsk.cam, os, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        design = app.activeProduct
        importManager = app.importManager

        # Define file path and output directory
        file_path = r'pathtostep.step'
        output_folder = r'outputpath'

        # Import the STEP file
        stepOptions = importManager.createSTEPImportOptions(file_path)
        rootComp = design.rootComponent
        importManager.importToTarget(stepOptions, rootComp)

        # Load a local material library and get an appearance
        materialLibs = app.materialLibraries
        matLib = materialLibs.load(r'pathtoAPISampleMaterialLibrary2.adsklib')
        appear = matLib.appearances.itemByName("Steel - Satin")  # Adjust appearance name as necessary

        # Copy the appearance into the design
        newAppear = design.appearances.addByCopy(appear, f'{appear.name}_Copied')

        # Apply the appearance to all bodies
        allBodies = rootComp.bRepBodies
        for body in allBodies:
            body.appearance = newAppear

        # Setup camera
        camera = app.activeViewport.camera
        camera.cameraType = adsk.core.CameraTypes.OrthographicCameraType

        # Define views
        views = {
            'Front': adsk.core.ViewOrientations.FrontViewOrientation,
            'Top': adsk.core.ViewOrientations.TopViewOrientation,
            'Right': adsk.core.ViewOrientations.RightViewOrientation,
            'Iso': adsk.core.ViewOrientations.IsoTopRightViewOrientation
        }

        # Adjust scene settings for no specular reflections and no shadows
        renderManager = design.renderManager
        sceneSettings = renderManager.sceneSettings
        sceneSettings.backgroundSolidColor = adsk.core.Color.create(255, 255, 255, 0)  # White background
        sceneSettings.ambientLightIntensity = 0.8
        sceneSettings.reflectionsEnabled = False
        sceneSettings.shadowsEnabled = False

        # Process each view
        for view_name, orientation in views.items():
            camera.viewOrientation = orientation
            app.activeViewport.camera = camera
            app.activeViewport.refresh()
            app.activeViewport.fit()

            sceneSettings.shadowsEnabled = False

            # Save images
            image_path = os.path.join(output_folder, f"{view_name}_render.png")
            app.activeViewport.saveAsImageFile(image_path, 384, 384)

    except Exception as e:
        if ui:
            ui.messageBox('Failed:n{}'.format(traceback.format_exc()))

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật