Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to mark iAssembly or iPart dirty so that members regenerate?

5 REPLIES 5
Reply
Message 1 of 6
cadull_rb
606 Views, 5 Replies

How to mark iAssembly or iPart dirty so that members regenerate?

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

5 REPLIES 5
Message 2 of 6
jdkriek
in reply to: cadull_rb

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
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 6
cadull_rb
in reply to: jdkriek

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

Message 4 of 6
adam.nagy
in reply to: cadull_rb

Hi Cadull,

 

Could you provide an iPart with that custom feature which when changed does not cause a regeneration?

 

Thank you,

Adam

 



Adam Nagy
Autodesk Platform Services
Message 5 of 6
cadull_rb
in reply to: adam.nagy

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.

Assembly1ClientFeatures.JPG

 

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.

Assembly2NoClientFeatures.JPG

 

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

Message 6 of 6
cadull_rb
in reply to: cadull_rb

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report