Global Form to create and edit Parameters in any assembly

Global Form to create and edit Parameters in any assembly

b.tarek
Enthusiast Enthusiast
640 Views
3 Replies
Message 1 of 4

Global Form to create and edit Parameters in any assembly

b.tarek
Enthusiast
Enthusiast

Hi, I want to use a global form for any assembly opened at the moment that'll take the parameters inserted in it and create custom properties based on them.

 

For ex. I press iTrigger or open the global form directly, it opens with empty areas/placeholders to type in my parameters like work order number and once I press apply or done (or a rule button) it saves the values I've entered as custom iProperties into all the components in the assembly.

 

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

A.Acheson
Mentor
Mentor
Accepted solution

Hi @b.tarek 

Can you attach your sample code you have worked on? You can do this without code if you save your custom iproperties in the assembly and part template. Then when you open the form on a new document the iprop is allready there and you just input a value. 

 

Here is the rule you need to add to the global form.

Create the rule and add rule button the the form. Thus when applied will take the iproperty specified and send to all iproperties in referenced documents. If your documents don't have the custom iproperty then you will need to add this which is an extra step. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 4

b.tarek
Enthusiast
Enthusiast

Thank you so much Alan, didn't think of using the custom iProperties in the template file.

 

I have written the rule for another assembly but was just having problems applying it to all the other assemblies created, this solves it thanks again.

0 Likes
Message 4 of 4

A.Acheson
Mentor
Mentor

Hi @b.tarek 

Great to hear, if it has solved it mark the post as solved so others know what has worked. Or indeed post your finished code and steps required to make it work..

Here is the API sample for adding iproperties written in VBA. Once you have the custom property sets...

 

    ' Get the active document.
    Dim invDoc As Document = ThisApplication.ActiveDocument
    
    ' Get the user defined (custom) property set.
    Dim invCustomPropertySet As PropertySet = invDoc.PropertySets.Item("Inventor User Defined Properties")
      
    ' Create the properties.
    Dim invProperty As [Property] = 
Try
invProperty = invCustomPropertySet.Item("Test")
invProperty.Value = "Test" Catch
invProperty = invCustomPropertySet.Add("Test", "Test Value")
End Try

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan