- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to find a way to retrieve parts that use only structural profiles, which are located in the Content Center under the Structural Profile category. With the approach I've taken, I can ignore Plates, but for example, if a part is a Screw, it still enters the list.
Sub Main()
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim fileTXT = System.IO.File.CreateText(ThisDoc.Path & "\SaveFOlder\materialProfiles.txt")
For Each oDoc In oAsmDoc.AllReferencedDocuments
' Se for arquivo de Montagem Ignora
If oDoc.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
Continue For
End If
' Se for arquivo de chapa ignora
If oDoc.ComponentDefinition.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
Continue for
End If
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim materialProfile As String
materialProfile = oDef.Material.Name
If materialProfile = "Genérico" Then Continue For
If materialProfile = "GRATING" Then Continue For
Dim codeProfile As String
codeProfile = System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)
Dim stockNumber As String
stockNumber = iProperties.Value(System.IO.Path.GetFileName(oDoc.FullFileName), "Project", "Stock Number")
Dim quantityProfile As Integer
quantityProfile = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Count
fileTXT.WriteLine(codeProfile & " - " & stockNumber & quantityProfile)
Next
fileTXT.Close()
End sub
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Content Center Parts contain unique iProperties that can be parsed to evaluate which family they are a part of.
Here is a post from Mod The Machine that covers digging into the Content Center properties. It might get you on the right track to pulling out the Family and determining if they are Structural or not?
https://modthemachine.typepad.com/my_weblog/2012/02/getting-data-from-content-center.html
Best of Luck
---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Leonardo_Czuy. The quickest way to tell if a part is associated with the Content Center is by checking its PartComponentDefinition.IsContentMember property value (ReadOnly Boolean). If True, you can proceed to check within the extra PropertySet(s) (PartDocument.PropertySets) for additional Content Center related information about it. There is a PropertySet named "Content Library Component Properties" with around 10 properties in it you can look into. There is also sometimes one called "ContentCenter", but that one may only contain one Property named "IsCustomPart" with an Integer type value (most likely 1 for true, or zero for false).
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello @WCrihfield
When i create a Structure Shape i am using Structural Frames with Frame Generator, i wanna this profiles for export to txt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
From you last post you want to filter frame generator parts from this post here there is a function where you can query if a part is used in frame generator.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Leonardo,
As alluded to earlier, you can use the fact that content center parts contain property information to quickly determine whether a component occurrence came from somewhere in the structural shapes content folder.
As mentioned, use the ComponentDefinition.IsContentMember property to determine if the part is from the content center, and if required, check the only property in the PropertySets.Item(6) property set to determine if the part is a custom or standard content center part.
Although not visible through the user interface, the design tracking property set contains a few properties that only hold information if the part comes from the content center. The "Categories" property [ PropertySets.Item(3).ItemByPropId(56) ] has a complete xml description of the specific content center part.
This xml information is stored as a text string, accessible through the Value property of this Inventor property. Since you are only looking to find if this came from the structural shapes folder in the content center, you just need to check to see if this text string contains the unique identifier for the Structural Shapes folder. The attached text file is a portion of this text string and you can see the information on the CC folder is right at the top. The "Structural Shapes" display name is likely to be localized for the current language but the Internal Name of this folder will always be the same.
To check if the part is from the Structural Shapes CC folder, use something like the following.
If PropertySets.Item(3).ItemByPropId(56).Value.Contains("089c4875-fa83-4c05-b084-43b9cc11f5ed") Then
' this part is from the structural shapes CC folder
End If
Note: Apply appropriate error handling with all code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report