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: 

Internal Validation Error on documentReference.getLatesetVersion in subassembly

5 REPLIES 5
Reply
Message 1 of 6
p.seem
1039 Views, 5 Replies

Internal Validation Error on documentReference.getLatesetVersion in subassembly

All,

 

I've encountered another case where I always hit an internal validation error, even on new data.

The simplest path to reproduce the problem is as follows:

 

Create a new design, with a single body in it, save it as A.

 

Create a new design, save it as B. In design B, create a new component called C.  Add a reference instance of A into C. Save B.

 

Open document A, make a change, and save it.

 

Open document B, and run the following script:

 

        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        curDoc = app.activeDocument
        docRef = curDoc.documentReferences.item(0)
        if docRef.isOutOfDate:
            docRef.getLatestVersion() 

This always throws "RuntimeError: 2 :InternalValidationError : res" on getLatestVersion.

 

Note that it works as expected if A is in B directly.  I only see the error if the XRef inside a sub-assembly of the main model.

 

I've attached a screenshot for clarity.

 

Thanks for any suggestions.

5 REPLIES 5
Message 2 of 6
goyals
in reply to: p.seem

Thank you for posting it along with detailed steps. I am able to reproduce it. Created UP-40530 in our internal bug-tracking system to track it. There is following workaround if you want to try

 

docRefDataFile = docRef.dataFile

docRefDataFile.latestVersionNumber



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 6
p.seem
in reply to: goyals

Thanks for looking into it. I'm a little unclear on your workaround. This isn't a function that returns the latest version (like data file.latestVersion), this is one that updates the link to the latest version. Like choosing "get latest version" in the UI. I don't think your workaround dies that, does it?
Message 4 of 6
p.seem
in reply to: p.seem

If you meant something along the lines of:

docRef.version = docRef.dataFile.latestVersionNumber

(instead of docRef.getLatestVersion), the former also causes an internal validation error.

Message 5 of 6
goyals
in reply to: p.seem

My suggested workaround was just to get the version number. You are right docRef.version API is allow throwing error. It is for same reason. I will try to fix them all in one go. Thanks for posting it.



Shyam Goyal
Sr. Software Dev. Manager
Message 6 of 6
vincent84FJV
in reply to: p.seem

Hi ,

I have a similar issu:

With a python script, i modify a design which has a drawing.

And when I try to update the drawing it doesn't work. Nothnig happen :

Here is a piece of the code :

            i=0
            while fichier.name!='My-xxxx-drawing':
                fichier=dossier.dataFiles.item(i)
                i=i+1

            fichier_copie = fichier.copy(dossier3)
            fichier_copie.name='LPL-'+str(int(long_prim_longi_ext))+'-ext'

            testtt = app.documents.open(fichier_copie,True)
            originett=app.activeDocument.documentReferences.item(0) 
           
            ui.messageBox('nom : '+originett.dataFile.name)  #to check if it is the good one (and the result is good)
 
            originett.getLatestVersion

            app.activeDocument.saveAs('LPL-'+str(int(long_prim_longi_ext))+'-ext-fini', dossier3, fichier_copie.name, fichier_copie.name)

            app.activeDocument.close(True)

 

Have you some ideas for this issue ? or another way to do what I want ?

And is it possible to export with python script the drawing in dxf or dwg file on my computer?

 

Thank you 

 

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