Inventor does not think an update is required for iAssembly members after changes to attributes on a client feature are saved. In our workflow we avoid rebuild all because it causes subassemblies to change, so we force an update by changing a parameter. Through the API is there a good way to indicate that our change was significant enough for members to need updating?
Regards,
cadull
You can change the Dirty status to "True"
Dim oAssDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oPart As PartDocument oPart = oAssDoc.ComponentDefinition.Occurrences(1).Definition.Document 'Set Part Dirty oPart.Dirty = True Dim sMsg As String sMsg = "Assembly Dirty: " & oAssDoc.Dirty & vbCr sMsg = sMsg & "Part Dirty: " & oPart.Dirty MsgBox (sMsg)
Here's a neat one to set them all dirty:
Dim oAssDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oRefDoc As Document For Each oRefDoc In oAssDoc.AllReferencedDocuments oRefDoc.Dirty = True Next
Hi Jonathan,
Thank you for the response. Sorry for the confusion of term - by member I meant the files that are generated from the iAssembly or iPart, rather than the component occurrences within an assembly. Setting the dirty flag on the factory does not cause the members to need regenerating.
My thought at the moment is to add a revision column to the table and change the value in each row that needs regenerating (i.e. rows that do not exclude the client feature).
Regards,
cadull
Hi Cadull,
Could you provide an iPart with that custom feature which when changed does not cause a regeneration?
Thank you,
Adam
Hi Adam,
I generalised the question to include iParts, but for now we only have client features in iAssemblies. I've attached a sample iAssembly (Assembly1.iam) along with an assembly that includes the generated members (Assembly2.iam).
I created Assembly2 before adding my client features (Link1 Start/Finish) to Assembly1.
Now Assembly2 doesn't have access to the client features because the generated members have not been updated, but Inventor does not think an update is required.
My approach to solve this at present is to add a revision column to the table and apply a GUID in the rows requiring an update.
Regards,
cadull
While changing values in the factory table has been successful in causing members to update, it can take some time if the table has many rows. I now have another approach that is faster, ensures the ModelGeometryVersion changes and works on normal parts and assemblies also to trigger an update in referencing documents. Having this functionality executed from a button is very convenient after making design view representation changes, instead of the common workaround of editing and restoring a parameter value.
Within a ChangeProcessor set to kShapeEditCmdType:
For parts - create and delete a fixed WorkPoint at the origin (the workpoint creation causes the ModelGeometryVersion to change).
For assemblies - create and delete a fixed WorkPoint constrained at the origin (the constraint creation causes the ModelGeometryVersion to change).
Point origin = application.TransientGeometry.CreatePoint(); switch(document.DocumentType) { case DocumentTypeEnum.kPartDocumentObject: PartDocument part = (PartDocument)document; part.ComponentDefinition.WorkPoints .AddFixed(origin) .Delete(); break; case DocumentTypeEnum.kAssemblyDocumentObject: AssemblyDocument assembly = (AssemblyDocument)document; AssemblyComponentDefinition definition = assembly.ComponentDefinition; WorkPoints points = definition.WorkPoints; WorkPoint point = points.AddFixed(origin); definition.Constraints .AddMateConstraint(point, points[1], 0) .Delete(); point.Delete(); break; }
Regards,
cadull