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
Solved! Go to Solution.
Solved by rossano_praderi. Go to Solution.
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
Hello Balaji,
I found the old post and did replaced the file now. It would be gread to delete files.
Thanks
Georg
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
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
Hello Rossano,
thank you very much. Thats exactly what I am looking for 🙂
Georg
Sorry if my reply was misleading.
I had interpreted your query as that of directly deleting the file references.
Regards,
Balaji
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
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.
Can't find what you're looking for? Ask the community or share your knowledge.