Hello, maybe a simple question but i can´t find a way to crack this problem. I have a document constituted by various subAssemblies, i want that all the parts in those subAssemblies to have a iproperty based in the name of sub assembly so i can keep track in the drawings.
Solved! Go to Solution.
Hello, maybe a simple question but i can´t find a way to crack this problem. I have a document constituted by various subAssemblies, i want that all the parts in those subAssemblies to have a iproperty based in the name of sub assembly so i can keep track in the drawings.
Solved! Go to Solution.
Solved by Andrii_Humeniuk. Go to Solution.
Hi @pg47328. It sounds like you want the parts to know about the assemblies they are being used in. This is the type of functionality that is usually only available with Vault. It is generally bad practice to write assembly level data back down to the part level because it can lead to lots of errors and/or incorrect or outdated data later. If parts knew about every assembly they were being used in, then in theory, the part's file size would get larger every time it gets added into another assembly, and the part file would need to be updated every time it is used in an assembly.
Can you give an example of why you need assembly related data to be stored down within the parts, and how that relates to the drawings you mentioned?
Wesley Crihfield
(Not an Autodesk Employee)
Hi @pg47328. It sounds like you want the parts to know about the assemblies they are being used in. This is the type of functionality that is usually only available with Vault. It is generally bad practice to write assembly level data back down to the part level because it can lead to lots of errors and/or incorrect or outdated data later. If parts knew about every assembly they were being used in, then in theory, the part's file size would get larger every time it gets added into another assembly, and the part file would need to be updated every time it is used in an assembly.
Can you give an example of why you need assembly related data to be stored down within the parts, and how that relates to the drawings you mentioned?
Wesley Crihfield
(Not an Autodesk Employee)
Hello, thanks for the quick response.
I have a multiple stud frames in inventor (Wall1,...), each one have x number of studs, and when i create the drawings views for each stud, for monitoring purpose, i want to have a parameter in my Parts List with the name of the sub assembly that the part comes.
Hello, thanks for the quick response.
I have a multiple stud frames in inventor (Wall1,...), each one have x number of studs, and when i create the drawings views for each stud, for monitoring purpose, i want to have a parameter in my Parts List with the name of the sub assembly that the part comes.
Hi @pg47328 . This code writes in the description of the detail the name of the subassembly to which it is included. Do you need a list of subassemblies that include a part?
Sub main
Dim oDoc As Document = ThisApplication.ActiveDocument
If TypeOf oDoc Is AssemblyDocument Then
Dim oADoc As AssemblyDocument = oDoc
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oTM As TransactionManager = ThisApplication.TransactionManager
Dim newTM As Transaction = oTM.StartTransaction(oADoc, "CreatPropertyNameParent")
Call WritaNameForPart(oADef.Occurrences)
newTM.End()
Else
MessageBox.Show("Active document is not AssemblyDocument.", "Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)
End If
End Sub
Private Function WritaNameForPart(ByVal oOccs As ComponentOccurrences)
For Each oOcc As ComponentOccurrence In oOccs
If Not oOcc.Suppressed Then
If TypeOf oOcc.Definition.Document Is PartDocument Then
Dim oOccDoc As PartDocument = oOcc.Definition.Document
If oOccDoc.IsModifiable Then
oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value = oOcc.ParentOccurrence.Name
End If
Else
Call WritaNameForPart(oOcc.SubOccurrences)
End If
End If
Next
End Function
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
Hi @pg47328 . This code writes in the description of the detail the name of the subassembly to which it is included. Do you need a list of subassemblies that include a part?
Sub main
Dim oDoc As Document = ThisApplication.ActiveDocument
If TypeOf oDoc Is AssemblyDocument Then
Dim oADoc As AssemblyDocument = oDoc
Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
Dim oTM As TransactionManager = ThisApplication.TransactionManager
Dim newTM As Transaction = oTM.StartTransaction(oADoc, "CreatPropertyNameParent")
Call WritaNameForPart(oADef.Occurrences)
newTM.End()
Else
MessageBox.Show("Active document is not AssemblyDocument.", "Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)
End If
End Sub
Private Function WritaNameForPart(ByVal oOccs As ComponentOccurrences)
For Each oOcc As ComponentOccurrence In oOccs
If Not oOcc.Suppressed Then
If TypeOf oOcc.Definition.Document Is PartDocument Then
Dim oOccDoc As PartDocument = oOcc.Definition.Document
If oOccDoc.IsModifiable Then
oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value = oOcc.ParentOccurrence.Name
End If
Else
Call WritaNameForPart(oOcc.SubOccurrences)
End If
End If
Next
End Function
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
It seems to work fine, thank you. I only have one question, for representing this value in the parts list of the drawing is preferable to have it as an iproperty or as a description as in your code.
It seems to work fine, thank you. I only have one question, for representing this value in the parts list of the drawing is preferable to have it as an iproperty or as a description as in your code.
In principle, it does not matter, write where it is more convenient for you. In a specific situation, I chose the description because it seemed convenient to me in the given circumstances.
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
In principle, it does not matter, write where it is more convenient for you. In a specific situation, I chose the description because it seemed convenient to me in the given circumstances.
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
Can't find what you're looking for? Ask the community or share your knowledge.