Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
1) I did the following script to copy and paste some properties of the 3D to the 2D but it doesn't work when I save the 2D. If I launch the macro manually it works but can you help me to have it automatically please.
Public Sub AutoSave_MigrateProperties() ' // Normal properties // ' The following properties must be migrated: "Title", "Description", "Company", "Project" and "Part Number" ' As these properties already exist in the source (3D) and the receiver (2D), we must associate them ' WARNING: The properties are contained in the item: "Item(number which indicate the part containing the desired property)" Dim drawDoc As DrawingDocument Set drawDoc = ThisApplication.ActiveDocument drawDoc.PropertySets.Item(1).Item("Title").Value = drawDoc.Sheets.Item(1).DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(1).Item("Title").Value drawDoc.PropertySets.Item(2).Item("Company").Value = drawDoc.Sheets.Item(1).DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(2).Item("Company").Value drawDoc.PropertySets.Item(3).Item("Description").Value = drawDoc.Sheets.Item(1).DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(3).Item("Description").Value drawDoc.PropertySets.Item(3).Item("Project").Value = drawDoc.Sheets.Item(1).DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(3).Item("Project").Value drawDoc.PropertySets.Item(3).Item("Part Number").Value = drawDoc.Sheets.Item(1).DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(3).Item("Part Number").Value ' // Custom properties // ' The following properties must be migrated: "Cat. level1" and "Cat. level2" ' For the custom propertiy, a test must be done to check if the property exists Dim invProp As Inventor.Property Dim strSourcePropVal As String On Error Resume Next For Each invProp In drawDoc.Sheets.Item(1).DrawingViews.Item(1).ReferencedDocumentDescriptor.ReferencedDocument.PropertySets.Item(4) drawDoc.PropertySets.Item(4).Item(invProp.Name).Value = invProp.Value If Err Then Err.Clear Call drawDoc.PropertySets.Item(4).Add(invProp.Value, invProp.Name) End If Next End Sub
2) Once the point 1 is fixed, Is it possible to put the macro on all the 2D contained in Vault?
3) I have heard that I can do a macro or an Add-in (dll) for this job. What is the best choice?
Thank you,
Sylvain
Solved! Go to Solution.