Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Internal Validation Error on documentReference.getLatesetVersion in subassembly

p.seem
Advocate Advocate
1,773 Views
5 Replies
Message 1 of 6

Internal Validation Error on documentReference.getLatesetVersion in subassembly

p.seem
Advocate
Advocate

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.

0 Likes
1,774 Views
5 Replies
Replies (5)
Message 2 of 6

goyals
Autodesk
Autodesk

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
0 Likes
Message 3 of 6

p.seem
Advocate
Advocate
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?
0 Likes
Message 4 of 6

p.seem
Advocate
Advocate

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.

0 Likes
Message 5 of 6

goyals
Autodesk
Autodesk

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
0 Likes
Message 6 of 6

Anonymous
Not applicable

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 

 

0 Likes