Frame Generator IF end treatment exists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm looking to create a rule that searches frame members and determines if the have been modified (miter, notch, etc.) so I can extract that member info and use it for something.
If a member has just been cut to a length and is not modified in any other way, it is straight cut of stock. When we miter, notch, modify that part in any way it is no longer just a stock cut and I need to extract that information for company purposes.
I have already created a rule to cycle thru everything in the document, extract the individual names, file names, paths, etc. however I cannot find a way to flag end treatments. they are not treated as "features" that can be tested to be active as I thought.
I also tried using code to create the "CUTDETAIL1" custom iproperty in the parts (which is populated "out of the box" by frame gen when a treatment is applied) with no luck extracting that data either via code.
Any assistance would be great and appreciated, in either calling the end treatments directly or extracting the custom iProperty data for cuts. I have triple checked and the custom iProperty (CUTDETAIL1) for the member DOES exist and holds data (Value = "Miter 45.00 deg") , however my code is not pulling it for some reason. is value is just blank in my message box everytime, where it is populated everytime i check it manually.
My code is below for reference:
---
Sub Main() Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Call Iterate(oAsmDoc.ComponentDefinition.Occurrences, 1) End Sub Public Declare Sub Sleep Lib "kernel32"(ByVal dwMilliseconds As Long) Private Sub Iterate(Occurrences As ComponentOccurrences, Level As Integer) 'Iterate through Assembly Dim oOcc As ComponentOccurrence For Each oOcc In Occurrences 'Find Parts in Assembly Dim oNAME As String = oOcc.Name Dim oPN As String = iProperties.Value(oNAME, "Project", "Part Number") Dim oFILE As Document = oOcc.Definition.Document Dim oFNAME As String = oFILE.FullFileName 'find the postion Of the last backslash In the Path FNamePos = InStrRev(oFNAME, "\", -1) 'get the file name with the file extension Name = Right(oFNAME, Len(oFNAME) -FNamePos) 'get the file name (without extension) ShortName = Left(Name, Len(Name) -4) 'get the path of the folder containing the file Folder_Location = Left(oFNAME, Len(oFNAME) -Len(Name)) Dim CUT1 As String Try CUT1 = iProperties.Value(oFILE, "Custom", "CUTDETAIL1") Catch customPropertySet = oFILE.PropertySets.Item("Inventor User Defined Properties") customPropertySet.Add("", "CUTDETAIL1") CUT1 = iProperties.Value(oNAME, "Custom", "CUTDETAIL1") End Try MsgBox("LEVEL: " & Level _ & vbLf & "DISPLAY: " & oNAME _ & vbLf & "PN: " & oPN _ & vbLf & "FULL PATH: " & oFNAME _ & vbLf & "FILE NAME: " & Name _ & vbLf & "PART NAME: " & ShortName _ & vbLf & "FOLDER: " & Folder_Location _ & vbLf & "CUT: " & CUT1) ' Check to see if this occurrence represents a subassembly ' and recursively call this function to traverse through it. If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then Call Iterate(oOcc.SubOccurrences, Level + 1) End If Next End Sub
---