Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there, I am trying to rename components via the API. this is what I tried but it doesn't seem to work. making a new file with two components and running the below code gives me this output. any help would be appreciated:
found component Component1:1
tried to rename to Comp1
but it is Component1:1
found component Component2:1
tried to rename to Comp2
but it is Component2:1
components = adsk.fusion.Design.cast(app.activeProduct).rootComponent.allOccurrences
indx = 1
for c in components:
cname = c.name
newName = "Comp{}".format(indx)
c.name = newName
indx+=1
print("found component {} \ntried to rename to {} \nbut it is {}".format(cname,newName,c.name))
Solved! Go to Solution.