Get appearance and put into custom property for IDW
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- パーマリンクを表示
- 印刷
- 報告
Hi
Im trying to adjust a rule to add the Appearance value, to a custom property so i can add it to my IDW title block.
I know I can get the value from parts by using iProperties.PartColor, but that only works when the active document is a part.
I want to have the rule go through all sub parts and assys, and put the appearance into a custom property called Surface.
If I break it up it contains 2 challenges.:
When standing on topassy
1. For sub parts, the rule must retrieve the appearance value of a sub part, and put it into the parts custom property called surface.
2. For sub assys, the rule must retrieve the appearance value from the first part (anyone will do), in a sub assy. as it is the parts, that are colored in an assy, and not the assy itself. And also put that in the assys custom property called surface
hope my question makes sence, and that it can be solved failry easy 🙂
here is the code i want it embedded into.:
Dim openDoc As Document Dim docFile As Document Dim assemblyDoc As AssemblyDocument Dim assemblyDef As AssemblyComponentDefinition Dim partQty As ComponentOccurrencesEnumerator Dim FNamePos As Long Dim docFName As String Dim Ordre As String Dim Surface As String ThisApplication.StatusBarText = "Jeg arbejder... rolig nu.!" openDoc = ThisDoc.Document Ordre = iProperties.Value("Project", "Project") Ordre = InputBox("Er " & Ordre & " det rigtige ordre nr? Ellers skriv det rigtige", "Ordre nummer", Ordre) iProperties.Value("Project", "Project") = Ordre 'Surface = InputBox("bestem farve","Rød",Surface) If openDoc.DocumentType = kAssemblyDocumentObject Then For Each docFile In openDoc.AllReferencedDocuments FNamePos = InStrRev(docFile.FullFileName, "\", -1) docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos) If docFile.IsModifiable = True Then assemblyDoc = openDoc assemblyDef = assemblyDoc.ComponentDefinition partQty = assemblyDef.Occurrences.AllReferencedOccurrences(docFile) Try If partQty.Count <> iProperties.Value(docFName, "Custom", "PCS") Then iProperties.Value(docFName, "Custom", "PCS") = partQty.Count End If Catch iProperties.Value(docFName, "Custom", "PCS") = partQty.Count End Try Try If Ordre <> iProperties.Value(docFName, "Project", "Project") Then iProperties.Value(docFName, "Project", "Project") = Ordre End If Catch iProperties.Value(docFName, "Project", "Project") = Ordre End Try 'This is the new code 'sub part If docFile.DocumentType = kPartDocumentObject Then Surface = iProperties.PartColor MessageBox.Show(Surface, "Title") Else 'sub assy End If Try If Surface <> iProperties.Value(docFName, "Custom", "Surface") Then iProperties.Value(docFName, "Custom", "Surface") = partQty.Count End If Catch iProperties.Value(docFName, "Custom", "Surface") = partQty.Count End Try End If Next ThisApplication.StatusBarText = "Ready" Else MessageBox.Show("Du kan KUN køre denne regel i en Assembly", "Forkert Filtype",MessageBoxButtons.OK,MessageBoxIcon.Exclamation) End If
Using
Inventor Premium 2013
/LSA-Skan