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: 

InternalValidationError of Occurrence deleteMe

1 REPLY 1
SOLVED
Reply
Message 1 of 2
FabisFusionTutorials
269 Views, 1 Reply

InternalValidationError of Occurrence deleteMe

Hello,

 

What my script does so far:

- Insert a Component from File (has a jointOrigin)

- Duplicates the inserted Component with 

 

occurence = rootComp.occurrences.addExistingComponent(sourceComponent, adsk.core.Matrix3D.create())

- gets a Occurence and takes the jointOrigin of the imported component 

- uses createForAssemblyContext(occurence) to get the jointOrigin of the Copy

 

jointInput = joints.createInput(occurence.component.allJointOrigins[jointOriginIndex].createForAssemblyContext(occurence), secondJoinOrigin)

- create a joint

- add the occurence to my global array of occurences 

 

what I try to do:

- iterate through my global variable occurences

- delete all occurence of the created copies who were joined:

    for occurence in occurences:
        if occurence.isValid and occurence.component.name == sourceComponent.name:
            occurences.remove(occurence)
            occurence.deleteMe()

- create new occurences and joints for each selected jointOrigin

 

the first times it works as expected and after selecting the 4th jointOrigin I get this error:

fuserror.PNG

InternalValidationError findObjectPath(this, objPath)

 

How can i delete the occurences on a save way and prevent the Error?

 

 

1 REPLY 1
Message 2 of 2

Solution:

 

- Iterate over a copy of the occurences

 

    for occurence in list(occurences):
        if occurence.isValid and occurence.component.name == sourceComponent.name:
            occurences.remove(occurence)
            #occurence.isLightBulbOn = False
            occurence.deleteMe()

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