Copy all Custom iProperties

Copy all Custom iProperties

kennyj
Collaborator Collaborator
1,546 Views
4 Replies
Message 1 of 5

Copy all Custom iProperties

kennyj
Collaborator
Collaborator

I found this post:

https://forums.autodesk.com/t5/inventor-customization/ilogic-copy-iproperties-formula/td-p/5812353

 

 

Where @Balaji_07 provided this snippet:

 

'--------------Start iLogic Rule "Copy iProperties"

Sub Main()
Dim oCompDoc As Document
Dim oProp As String
Dim oPropSet As PropertySet
oCompDoc = ThisApplication.ActiveDocument

oPropSet = oCompDoc.PropertySets.Item("Inventor User Defined Properties")

iProp = oPropSet.Item("Specification").Expression

iProperties.Value("Custom", "Specifications") = iProp
End Sub

 

'---------------End iLogic Rule

 

I want to get ALL of the Custom iProperties, not just one or two as shown above.  Any assistance would be appreciated.

 

To add to the bonus round; I'd like to actually LINK the Custom iProperties between the derived parts.  From the Idea Stations and other posts, this does not look like it has been solved yet, though...

 

Thank you in advance,

 

Kenny Johnson

0 Likes
Accepted solutions (1)
1,547 Views
4 Replies
Replies (4)
Message 2 of 5

rjay75
Collaborator
Collaborator

What are you copying them too. Are you just interested in copying from one document to another? Or to newly added iProperties?

 

0 Likes
Message 3 of 5

kennyj
Collaborator
Collaborator

Thank you, Rodney.

 

I am trying to copy iProperties from a part file to a part file, or an assembly file to an assembly file.

 

 

We have "Library" parts that are either parts or assemblies, derived into part files.  We want to copy the custom properties from the library into the derived parts so that information is available as the parts are used.

 

Derived parts do not allow you to link/derive iProperties, so I'm trying to automate a copy solution.

 

Thank you again,

 

Kenny

 

 

0 Likes
Message 4 of 5

HermJan.Otterman
Advisor
Advisor
Accepted solution

Hello Kenny,

 

try this code from the derivedcomponent

 

 

Dim derivedComponent As Inventor.Document = Thisapplication.ActiveDocument

'if there is only one reference:

Dim referencedComponent As Inventor.Document = derivedComponent.ReferencedDocuments(1)

Dim deriPorps As PropertySet = derivedComponent.PropertySets.Item("Inventor User Defined Properties")

Dim refiProps As PropertySet = referencedComponent.PropertySets.Item("Inventor User Defined Properties")

Dim oProp As Inventor.Property

For Each oProp In refiProps

Try

deriPorps.Add(oProp.Value, oProp.Name)

Catch ex As Exception

deriPorps.Add(oProp.Value)

End Try

Next

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 5 of 5

kennyj
Collaborator
Collaborator

@HermJan.Otterman,

 

This worked like a charm.  Thank you for your assistance.

 

Kenny

0 Likes