Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Strange behaviour of Appearances.addByCopy method

1 REPLY 1
SOLVED
Reply
Message 1 of 2
VismantasKizelis
278 Views, 1 Reply

Strange behaviour of Appearances.addByCopy method

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()))

1 REPLY 1
Message 2 of 2

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 360 Developer
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report