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: 

Data provided in the OnPopulateFileMetaData Event not correctly processed

1 REPLY 1
Reply
Message 1 of 2
thomas_jamnik
924 Views, 1 Reply

Data provided in the OnPopulateFileMetaData Event not correctly processed

Hi all!

 

We've developed an Addin for Inventor 2012 that intercepts all events that generate file names for new assemblies, parts and drawings in Inventor.

 

Therefore we also intercept the Application.FileUIEvents.OnPopulateFileMetadata event.

In general everything works just fine as expected.

 

The exception to this rule is when the mentioned event is raised by Inventors Copy Components and Mirror Components  commands. The relevant Code loops through the FileMetadataObjects parameter provided by the

OnPopulateFileMetadata event, sets the FullFileName and FileName properties according to the data provided by the user and marks the event as handled if no errors had occurred. If I do so this works perfectly well if the user had selected just one component to copy.

For any more components Inventor wants to reuse the first one and therefore copies / mirrors just one component and reuses this component depending on the count of components the user has selected. The attached screen shot illustrates this problem using Copy Components. Also the structure of the used assembly (as an image) is attached. The behavior described does not depend on the assembly structure.

 

It seems that the same approach works perfectly well when used in another context such as the Frame Generator. The files get the indented names and everything works fine but not in context of Copy / Mirror

 

To isolate the problem I’ve created a sample Addin that reproduces the error. The Addin simulates the process by attaching the suffix “Copy” to the original file name and tries to store the new part in the same directory the original comes from. The class that covers this is also attached to below and only depends on .NET and Inventor. The useless loop at the end of the OnPopulateFileMetadata method is used for debugging purposes to verify that the data has really arrived in the file meta data object (just quick & dirty :))

I tried several things with the code (the one attached):

=>  Using different looping techniques (although from a C# perspective they all should do the same)

=>  Trying to set the FileMetaData.FullFileName property only

=>  Omitting to set the *Overridden properties of FIleMetaData to true (although this should not affect the resulting file names)

As expected the result was always the same. Hope you can help me with that issue!

 

Best Regards!

 

1 REPLY 1
Message 2 of 2

Hi thomas,

 

As replied, I cannot reproduce the issue. I have sent you the relevant test data-set. Please check if you find anything I missed.

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

Post to forums  

Autodesk Design & Make Report