Message 1 of 5
Ilogic, referencing frame info
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Disclaimer, I'm not great at ilogic. I just have an idea of what questions to ask.
I've had to rethink the code I've got. What I'm trying to do now is reference the category, standard, family, size, material, and appearance of a frame member so that when all these are selected, it'll produce the description I need.
This is the code I have now.
Sub Main() Dim oAsm As AssemblyDocument = ThisDoc.Document Dim oTransaction As Transaction = ThisApplication.TransactionManager.StartTransaction(oAsm, "FG stock to part number") For Each oDoc As Document In oAsm.AllReferencedDocuments If oDoc.DocumentInterests.HasInterest("{AC211AE0-A7A5-4589-916D-81C529DA6D17}") _ AndAlso oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject _ AndAlso oDoc.IsModifiable _ AndAlso oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Count > 0 Dim occName As String = oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Item(1).Name Dim oDesc As [Property] = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description") Try Select Case GetFamilyName(oDoc) Case "ANSI L (Equal angles)" oDesc.Value = "L" & Parameter(occName, "G_H") & " x " & Parameter(occName, "G_H") & " x " & RoundToFraction(Parameter(occName, "G_T"), 0.03125, RoundingMethod.Round) & " x " & Round((Parameter(occName, "B_L") * 25.4), 2) & " mm" Case "ANSI L (Unequal angles)" 'And "Angles" oDesc.Value = "L" & Parameter(occName, "G_W") & " x " & Parameter(occName, "G_H") & " x " & RoundToFraction(Parameter(occName, "G_T"), 0.03125, RoundingMethod.Round) & " x " & Round((Parameter(occName, "B_L") * 25.4), 2) & " mm" Case "ANSI ASTM" oDesc.Value = "ROUND ø" & Parameter(occName, "G_H") & " x " & Round((Parameter(occName, "B_L") * 25.4), 2) & " mm" Case "ANSI AISC HSS (Rectangular)" oDesc.Value = "HSS" & Parameter(occName, "G_H") & " x " & Parameter(occName, "G_H") & " x " & RoundToFraction(Parameter(occName, "G_T"), 0.03125, RoundingMethod.Round) & " x " & Round((Parameter(occName, "B_L") * 25.4), 2) & " mm" Case "ANSI AISC HSS (Square)" oDesc.Value = "HSS" & Parameter(occName, "G_W") & " x " & Parameter(occName, "G_H") & " x " & RoundToFraction(Parameter(occName, "G_T"), 0.03125, RoundingMethod.Round) & " x " & Round((Parameter(occName, "B_L") * 25.4), 2) & " mm" End Select Catch End Try End If Next oTransaction.End 'End the trasaction End Sub Function GetFamilyName(oDoc As PartDocument) As String Try Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition Dim propSet As PropertySet = oDef.Document.PropertySets.Item("{B9600981-DEE8-4547-8D7C-E525B3A1727A}") Dim oContentCenter As ContentCenter = ThisApplication.ContentCenter Return oContentCenter.GetContentObject("v3#" & propSet.Item("FamilyId").Value & "#").DisplayName Catch Return "" End Try End Function