Access Derived part's Base Component's iProperties

Access Derived part's Base Component's iProperties

Nejc.Leban
Advocate Advocate
871 Views
4 Replies
Message 1 of 5

Access Derived part's Base Component's iProperties

Nejc.Leban
Advocate
Advocate

Hi everyone.

 

I'm looking for a way to access the iProperties of the Base component of a Derived part and copy them to the Derived part. I've looked through the forum, but I didn't find a way to do it.

 

Thanks,

 

Nejc

 

Accepted solutions (1)
872 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Public Sub main
	Dim A As Inventor.PartDocument = ThisDoc.Document
	Dim b As Inventor.Document = A.ReferencedDocuments.Item(1)
	
	CopyModelPropertiesToDerivedPart (ThisApplication,A,b)
	End Sub
	
    Public Sub CopyModelPropertiesToDerivedPart(oInvApp As Inventor.Application, oDoc As Inventor.Document, oInvRefDoc As Inventor.Document)

        Dim prop As Inventor.Property
        Dim propset As Inventor.PropertySet
        Dim RoutineInheritProperties As Inventor.Property
        Dim DimensionDirty As Boolean = False

        For Each propset In oInvRefDoc.PropertySets

            For Each prop In propset

                Try
						oDoc.PropertySets.Item(propset.DisplayName).Add(prop.Expression,prop.DisplayName)
                    
                Catch ex As Exception

                    Try
						
						oDoc.PropertySets.Item(propset.DisplayName).Item(prop.DisplayName).Expression = prop.Expression
                        

                    Catch ex2 As Exception

                    End Try

                End Try

            Next
        Next

    End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 3 of 5

Nejc.Leban
Advocate
Advocate

Man, that's awesome. 🙂

 

Thanks.

0 Likes
Message 4 of 5

Jarno_marasBL4DC
Participant
Participant

I keep getting an error when I run this rule. I read that it has something to do with the office version on my computer. Do you know the fix to this issue? My coding skills are near-to non-existing.

 

Error code:

"System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)"

 

Thank you in advance!

0 Likes
Message 5 of 5

Jarno_marasBL4DC
Participant
Participant

I keep getting an error when I run this rule. I read that it has something to do with the office version on my computer. Do you know the fix to this issue? My coding skills are near-to non-existing.

 

Error code:

"System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)"

 

Thank you in advance!

0 Likes