Hello,
i got a question about the change of iproperties in a assembly. My assembly contains sub-assemblys on different levels and i want to change every .ipt part number to a part of the filename.
The first Rule i got:
iProperties.Value("Project", "Part Number") = Split(ThisDoc.FileName(False),"-")(+1)
and the idea to get it in all .ipt´s:
'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document Dim docFile As Document 'kAssemblyDocumentObject = 12291 If openDoc.DocumentType = 12291 Then 'Iterate though the part files in the assembly For Each docFile In openDoc.AllReferencedDocuments 'kPartDocumentObject = 12290 If docFile.DocumentType = 12290 Then 'set part number to file name (without extension) If docFile.FileName(False) = "*-*-*" Then docFile.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = Split(ThisDoc.FileName(False),"-")(+1) End If End If Next Else MessageBox.Show("Use Assembly") End If
All i get is "system.missingmemberexception no default member found for file name". It would be great if somebody here could help me with this problem.
Solved! Go to Solution.
Solved by MechMachineMan. Go to Solution.
Try:
System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) instead of oDoc.FileName
Also,
add a try/catch around the fetching of the filename in case the file has not been saved yet.
Good luck.