Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete unresolved files

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
GeorgK
8369 Views, 9 Replies

Delete unresolved files

Hello together,

 

I have a phantom "unresolved reference" in an assembly. I could not see it in the assembly. When I open the assembly I get an error message that a file is missing. In the assembly I could find it with this code:

 

https://forums.autodesk.com/autodesk/attachments/autodesk/78/546430/1/UnresolvedFiles.txt

 

Is it possible to delete it with a peace of code?

 

Thank you very much

 

Georg

9 REPLIES 9
Message 2 of 10
Balaji_Ram
in reply to: GeorgK

Hi Georg,

 

Sorry, the FileDescriptor does not permit removing the file reference.

 

But, you can replace the reference if you do have an backup or a old file that shares its heritage.

 

http://adndevblog.typepad.com/manufacturing/2012/08/replace-the-file-reference-by-inventor-api.html

 

Does the file descriptor "FullFileName" return a file path that you recognise ?

That should return the last known path for a file reference that is missing.

 

Regards,

Balaji

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 10
GeorgK
in reply to: Balaji_Ram

Hello Balaji,

 

I found the old post and did replaced the file now. It would be gread to delete files.

 

Thanks

 

Georg

 

 

Message 4 of 10
Balaji_Ram
in reply to: GeorgK

Hi Georg,

 

Glad that you replaced the file reference.

 

I think, providing the delete on the File reference can cause more issues that it solves.

File references are best managed internally by Inventor since it would be quite easy to get things wrong with file references.

 

Also, I think it is for this reason that Inventor API does not let us delete it manually.

 

Regards,

Balaji

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 10
rossano_praderi
in reply to: GeorgK

Hi Georg,

if I've understood your question...this is my answer...

 

I don't think you need more explanations about the follow code, if you need I'm there

 😉

 

Public Sub DelOccurrence()
    Dim oAsmCompDef As AssemblyComponentDefinition
    Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
    Dim ref As ComponentOccurrence
For Each ref In oAsmCompDef.Occurrences
    If ref.ReferencedDocumentDescriptor.ReferenceMissing = True Then
        ref.Delete
    End If
Next
End Sub

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 6 of 10
GeorgK
in reply to: rossano_praderi

Hello Rossano,

 

thank you very much. Thats exactly what I am looking for 🙂

 

Georg

Message 7 of 10
Balaji_Ram
in reply to: GeorgK

Sorry if my reply was misleading.

 

I had interpreted your query as that of directly deleting the file references.

 

Regards,

Balaji

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 8 of 10
maximeURGVK
in reply to: Balaji_Ram

Hi,

i got this error messageDELETE LOST REF.PNG

Message 9 of 10

If you doesn't use anything else than this subroutine ("DelOccurence") the simple solution is to replace "Public Sub DelOccurence" with "sub Main" and remove the "Set" statement.

 

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 10 of 10
Anonymous
in reply to: maximeURGVK

Hi, hope this answer works besides the long time you've been posted.

 

You are working in the wrong environment. This code it's supposed to work very fine in VBA, not in iLogic.

iLogic runs pretty similar VBA but with limitations.

Give the chance to work combining both solutions and you will see how easy those codes works for your intentions.

 

Cheers.

Tags (1)

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

Post to forums  

Autodesk Design & Make Report