Strange doc.FullFileName

Strange doc.FullFileName

JoAntt
Enthusiast Enthusiast
825 Views
9 Replies
Message 1 of 10

Strange doc.FullFileName

JoAntt
Enthusiast
Enthusiast

Hi

In vb.net inventor 2018

 

I get this strange doc.FullFileName

"**C:\VaultWork\1.iam*LocalDocs*x0biyzm4fYmuvurkmP1tln1vqQd*A221033-MD-CHUTE-41L01_20210914.iam"

 

doc.DisplayName looks like this

A221033-MD-CHUTE-41L01_20210914.iam

 

Why is this happening?

0 Likes
Accepted solutions (1)
826 Views
9 Replies
Replies (9)
Message 2 of 10

WCrihfield
Mentor
Mentor

Hi @JoAntt.  It looks to me like you must be using Vault.  I am no expert in Vault right now, but I'm pretty sure that when you 'check out' a file to work on, it creates a temporary 'local' copy of the file.  Then when you are done working on the file, and go to 'check in' the file, it saves that local file back into the Vault area, then gets rid of the local copy.  I assume what you are seeing is the file location and file name of the temporary local copy of the file, while it is 'checked out'.  I know this is a fairly simplistic sounding explanation, but that is my guess/opinion about why you are seeing that odd looking file name.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 10

JoAntt
Enthusiast
Enthusiast

I dont think this i a vault thing.

I have narrowed it down to imported step files that is imported as reference model.

But now the question is, how can i detect and handle this type of files?

I cant find anything like ComponentDefinition.IsContentMember or type  for reference models.

 

JoAntt_0-1641829407325.png

 

 

0 Likes
Message 4 of 10

jjstr8
Collaborator
Collaborator

I'm not sure where the odd filename is coming from.  Vault doesn't use a temporary file that I'm aware of.  Checking out a file clears the read-only flag on the local file and changes its status on the Vault server.  @JoAntt :  Does doc.FullDocumentName return the same value?  The API documentation doesn't really explain the difference between FullFileName and FullDocumentName, but they've been equivalent every time I've seen during debugging.

0 Likes
Message 5 of 10

WCrihfield
Mentor
Mentor

Good theory @JoAntt.  I had not thought of that.  Here is a little bit of iLogic code for exploring any potentially 'imported' components in an assembly.  There are several ways of doing it though.

oADoc = ThisAssembly.Document
oADef = oADoc.ComponentDefinition
oOccs = oADef.Occurrences
For Each oOcc As ComponentOccurrence In oOccs
	If oOcc.IsAssociativelyImported Then
		MsgBox("The component named " & oOcc.Name & vbCrLf & _
		"is 'AssociativelyImported'.", , "")
		'oOcc.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName
	End If
	If oOcc.DefinitionDocumentType = DocumentTypeEnum.kForeignModelDocumentObject Or 
		oOcc.DefinitionDocumentType = DocumentTypeEnum.kSATFileDocumentObject Then
		MsgBox("The component named " & oOcc.Name & vbCrLf & _
		"Is either a 'Foreign Model' document, or a 'SAT' file document.",,"")
	End If
Next
oImpComps = oADef.ImportedComponents
For Each oIC As ImportedComponent In oImpComps
	MsgBox("The component named " & oIC.Name & vbCrLf & _
		"is an 'ImportedComponent'.",,"")
Next

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 10

JoAntt
Enthusiast
Enthusiast

It presents itself as assembly document, not sat not anything else but assembly.
Nothing seams do be out of the ordinary except the FullDocumentName and FullFileName.

0 Likes
Message 7 of 10

jjstr8
Collaborator
Collaborator

If you're enumerating AllReferencedDocuments, it looks like you can check IsEmbeddedDocument to skip embedded imports.  Also, AssociativeForeignFilename has the full path to the original import file.  Neither property are in the API help, but they aren't hidden, so I assume they're somewhat safe to use long term.  I'm on 2019, but I'm guessing those properties are available in 2018.

0 Likes
Message 8 of 10

JoAntt
Enthusiast
Enthusiast
Accepted solution

That seams to work! thank you!

 

Dim AssemblyDoc As AssemblyDocument = TheDoc ' Must be assembly
If AssemblyDoc.IsEmbeddedDocument = true Then
       msgbox("Its embedded!")
end if

 

0 Likes
Message 9 of 10

xAce20159
Community Visitor
Community Visitor

Hi @JoAntt @jjstr8 @WCrihfield is there any chance that I can access the correct FullDocumentName and FullFileName of the Imported Occurrence? This will be a big Help. Hoping for the positive response. Thank you 

0 Likes
Message 10 of 10

WCrihfield
Mentor
Mentor

Hi @xAce20159.  Since this can be a complicated subject to look into, and there are several very similar sounding terminology, it would be best if you included a good screen captured image of what you are talking about.  It would also be very helpful if you fully described the manual steps you took to include that object into your assembly.  That will tell us more about what type of object it is, and how to look for it.  There are already some code examples above showing how to look into certain types of things labeled as 'imported' in an assembly, but we can certainly expand on those examples, or include new examples, if needed.

 

Below is another similar iLogic rule example for exploring similar stuff in an assembly, but it is designed to write its findings out into the iLogic Log window.  However, the iLogic Log window must already be visible before running this rule, or it will not be able to capture the feedback.  Then, after running it, check within the iLogic Log window for the results, if any.

Sub Main
	Dim oADoc As AssemblyDocument = TryCast(ThisDoc.Document, Inventor.AssemblyDocument)
	If oADoc Is Nothing Then Logger.Debug(iLogicVb.RuleName & " exited (no AssemblyDocument obtained)") : Return
	Dim oICs As ImportedComponents = oADoc.ComponentDefinition.ImportedComponents
	If oICs.Count > 0 Then
		For Each oIC As ImportedComponent In oICs
			Dim sFDN As String = String.Empty
			Try : sFDN = oIC.ReferencedDocumentDescriptor.FullDocumentName : Catch : End Try
			Logger.Info(vbCrLf & "FullDocumentName = " & sFDN & vbCrLf & _
			"IsLinkedToFile = " & oIC.LinkedToFile & vbCrLf & _
			"IsEmbedded = " & oIC.IsEmbedded & vbCrLf)
		Next oIC
	End If
	Dim oOccs As ComponentOccurrences = oADoc.ComponentDefinition.Occurrences
	For Each oOcc As ComponentOccurrence In oOccs
		Dim sFDN, sFFN As String, bIsEmbedded, bIsLinked As Boolean
		If oOcc.IsAssociativelyImported Then
			sFFN = oOcc.AssociativeForeignFilename
			Logger.Info(vbCrLf & "Occurrence named " & oOcc.Name & vbCrLf & _
			"IsAssociativelyImported = True" & vbCrLf & _
			"AssociativeForeignFilename = " & sFFN & vbCrLf)
		ElseIf oOcc.HasAssociativeImportedComponent Then
			Dim oIC As ImportedComponent = oOcc.ImportedComponent
			Try : sFDN = oIC.ReferencedDocumentDescriptor.FullDocumentName : Catch : End Try
			Logger.Info(vbCrLf & "Occurrence named " & oOcc.Name & vbCrLf & _
			"HasAssociativeImportedComponent = True" & vbCrLf & _
			"FullDocumentName = " & sFDN & vbCrLf & _
			"IsLinkedToFile = " & oIC.LinkedToFile & vbCrLf & _
			"IsEmbedded = " & oIC.IsEmbedded & vbCrLf)
		End If
	Next oOcc
End Sub

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes