Strange behaviour of Appearances.addByCopy method

Strange behaviour of Appearances.addByCopy method

VismantasKizelis
Enthusiast Enthusiast
662 Views
1 Reply
Message 1 of 2

Strange behaviour of Appearances.addByCopy method

VismantasKizelis
Enthusiast
Enthusiast

Hello

 

Working on add-in for Fusion360 I found a strange behaviour of Appearances.addByCopy method.

I work on Windows 10 machine. The same bug reproduces on both c++ and py scripts

Steps to reproduce:

  1. Open some document
  2. Write the script to copy any appearance from library to current design using Appearances.addByCopy method
  3. Copy the same appearance several times providing different display name each time

Results:

  1. Sometimes everything wokrs as expected
  2. Sometimes adding new copy of appearance to design overwrites another appearance that was added previously
  3. Sometimes new name is ignored and appearance is added to design with original name

In screencast you can see, that same script, that should add six appearances to design, in first document adds three appearances, in second and third documents adds two appearances (but one appearance has wrong name), in other documents script acts as expected. 

83f6ecea-41bb-4023-b545-bbcecae0f4b4

 

Do not know why screencast does not show, so here is the link https://autode.sk/2so4YeR

 

py script:

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

 

def run(context):

ui = None

try:

app = adsk.core.Application.get()

ui = app.userInterface

 

materialLibs = app.materialLibraries

 

matLib = materialLibs.item(1)

appear = matLib.appearances.item(0)

 

des = adsk.fusion.Design.cast(app.activeProduct)

 

#Next lines should add six appearances to current design

des.appearances.addByCopy(appear, "A")

des.appearances.addByCopy(appear, "A1")

des.appearances.addByCopy(appear, "A2")

des.appearances.addByCopy(appear, "A3")

des.appearances.addByCopy(appear, "A4")

des.appearances.addByCopy(appear, "A5")

 

except:

if ui:

ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

Accepted solutions (1)
663 Views
1 Reply
Reply (1)
Message 2 of 2

marshaltu
Autodesk
Autodesk
Accepted solution

Hello,

 

Thank you for reporting the issue to us. UP-39107 has been logged to track the issue in our internal system.

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>