Problems with iProperties applied by iLogic to Parts starting out of an Assembly.

Problems with iProperties applied by iLogic to Parts starting out of an Assembly.

stigler
Advocate Advocate
289 Views
2 Replies
Message 1 of 3

Problems with iProperties applied by iLogic to Parts starting out of an Assembly.

stigler
Advocate
Advocate

 

.....it is not possible to create an answer in this board!!!

 

Hi there! It's my mistake - I wrote it in German!

 

 

Hello! I'll bring this post up again - I'm already despairing!

 

I want to create custom iProperties with value " " (no entry) from an assembly in all parts of the assembly.

 

"Increased penalties": If the iProperty already exists, the value should NOT be overwritten! I made this entry for an iProperty ("ZZZZ") as a test - works as desired with the following "external rule" named:

 

"Erstelle iProperties für Bauteile einer Baugruppe"

 

----------------------------------------------------------

Dim odrawdoc As Document

odrawdoc = ThisApplication.ActiveDocument

 

 

customPropertySet = odrawdoc.PropertySets.Item("Inventor User Defined Properties")

 

 

Try

    oTest = customPropertySet.Item("ZZZZ")

Catch

    customPropertySet.Add("", "ZZZZ")

End Try

----------------------------------------------------------------

But now I'm failing to apply this rule to all components of an assembly via the "snippet" specified by ssyXENBT in the article linked above! The iProperty is only ever created in the assembly!

 

How do I get Inventor to actually provide the iProperty to the components identified via the "snippet"? Are these two rules "not" compatible?

I have found other rules in the forum, but unfortunately they ignore the existence of "valued" iProperties and then overwrite their values.

 

Many thanks for your help

0 Likes
Accepted solutions (1)
290 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

you have to loop over all the documents referenced by the assembly. You can do that like this:

Dim doc As AssemblyDocument = ThisDoc.Document

For Each refDoc As Document In doc.AllReferencedDocuments
    Dim customPropertySet = refDoc.PropertySets.Item("Inventor User Defined Properties")
    Try
        Dim test = customPropertySet.Item("ZZZZ")
    Catch
        customPropertySet.Add("", "ZZZZ")
    End Try
Next

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

stigler
Advocate
Advocate

Hello JelteDeJong!

Thank You for your answer! It works!!

 

Have a nice week,

 

stigler

 
0 Likes