Merging two rules

Merging two rules

Anonymous
Not applicable
320 Views
2 Replies
Message 1 of 3

Merging two rules

Anonymous
Not applicable

Hi to all,
I have two rules. One writes the material name in the user's iProperties and the other writes the stock number in the "Stock number" iProperties. Both take information from the materials database. I need to merge these two rules to run at the same time.

The first rule

Dim oDoc As PartDocument = ThisDoc.Document
iProperties.Value("Custom", "Materiál") = oDoc.ActiveMaterial.DisplayName

 The second rule

If ThisApplication.ActiveDocumentType <> kPartDocumentObject Then Exit Sub

Dim oDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument

Dim oMat As Asset
oMat = oPartDoc.ActiveMaterial

iProperties.Value("Project", "Stock number") = oMat.Item("physmat_Comments").Value
321 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor

is this what you are looking for:

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then Exit Sub

Dim oDoc As PartDocument = ThisDoc.Document
Dim oMat As Asset = oDoc.ActiveMaterial

iProperties.Value("Custom", "Material") = oDoc.ActiveMaterial.DisplayName
iProperties.Value("Project", "Stock number") = oMat.Item("physmat_Comments").Value

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

0 Likes
Message 3 of 3

Anonymous
Not applicable

Hello and thank you. I already understand why it didn't work for me.

0 Likes