Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modify external rule to do another function

0 REPLIES 0
Reply
Message 1 of 1
Ray_P
247 Views, 0 Replies

Modify external rule to do another function

I have these 2 external rules that work just fine by themselves I want to combine them. I have all parts triggerd to run the rule below to change the styles. Now I want to add another rule to it. I have tried snippets (add rule) but I get declaration errors. The rule I want to add changes the owner and designer to current user on save.

And it looks like this

iProperties.Value("Project", "Designer") = ThisApplication.GeneralOptions.UserName iProperties.Value("Summary", "Author")  = ThisApplication.GeneralOptions.UserName

 

Wher do I insert the new lines of code without destroying something that already works??

 

 

'THIS RULE GETS CURRENT STYLE COPIES TO CUSTOM PROP 06-MATERIAL 'ALSO IF THE PROPERTY "08-WEIGHT" IS MISSING IT WILL ADD TO CUSTOM PROPERTIES LIST 'SET TRIGGER TO BEFORE SAVE Sub Main()     'iProperties.Value("Custom", "PropertyName")  'iProperties.Value("Custom", "CustomName") = "New Value"  'iProperties.Value("Custom", "08-weight") = Round(iProperties.Mass,2) & " lbs"      ' copy sheet metal style to custom prop  iProperties.Value("Custom", "06-material") = SheetMetal.GetActiveStyle()     InventorVb.DocumentUpdate()   '  mass = iProperties.Mass   ' FindOrCreateProperty("08-weight", mass)   ' iProperties.Value("Custom", "08-weight") = Round(iProperties.Mass,2) & " lbs" End Sub

Function FindOrCreateProperty(propName As String, propValue As Object)      ' Get the current document.      oDoc = ThisDoc.Document     ' Get the user defined (custom) property set     Dim propSet As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties")     Dim invProperty As Inventor.Property     ' See if the property alreay exists.  If it does, don't change the value.     For Each invProperty In propSet       If (invProperty.Name = propName) Then Return invProperty     Next     ' Create the property     invProperty = propSet.Add(propValue, propName) End Function

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report