I want to open parts or component occurrences in a separate window from the assembly having only a specific user parameter (let's say "Pipe_Standatd") and change the parameter values("Pipe_Standatd=ASME") and save it then close that part.
please help me with the logic code.
Do you have some more details?
Maybe some screenshots about what you mean?
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
You should be able to do this without opening the part. The part is all ready open in the context of the assembly.
'Get the active assembly.
Dim AsmDoc As AssemblyDocument = ThisDoc.Document
'Get the assembly component definition.
Dim AsmDef As AssemblyComponentDefinition = AsmDoc.ComponentDefinition
'Get all of the leaf occurrences of the assembly.
Dim LeafOccs As ComponentOccurrencesEnumerator = AsmDef.Occurrences.AllLeafOccurrences
'Iterate through the occurrences and print the name.
For Each Occ As ComponentOccurrence In LeafOccs
Dim occDef As PartComponentDefinition = Occ.Definition
Dim OccDoc As PartDocument = occDef.Document
If OccDoc.IsModifiable Then
Logger.Info(Occ.Name)
occDef.Parameters.Item("Pipe_Standard").Value = "ASME"
End If
Next
In your initial post you mention ilogic and external rules. Why would you want to use VBA?
Can you please post the whole workflow including what the rules will be doing. The process is not clear.
With document found from occurrence you can open the occuurence in its own document.
Dim ActiveDoc As Document = ThisApplication.Documents.Open( FullDocumentName As String, [OpenVisible] As Boolean ) As Document
'DO SOMETHING WITH DOCUMENT
Can't find what you're looking for? Ask the community or share your knowledge.