Using iLogic to update iProperties Description

Using iLogic to update iProperties Description

EScales
Advocate Advocate
589 Views
2 Replies
Message 1 of 3

Using iLogic to update iProperties Description

EScales
Advocate
Advocate

So, I have a bunch of parameters created in a part and use an iLogic form to select which features are to be turned on/off, size, etc.  I have that part all working fine.  I have one last thing I'm trying to work out.  What I'm doing is using iLogic to update the iProperties "Description" based on what parameters are turned on/off, etc. I don't even have a problem with that really, but I'm getting picky with adding commas in the description, between the parameters.  It works fine as long as I have several parameters turned on.  But if I turn everything off and just have my base part, I still get the unwanted commas at the end of the description.  Is there a way to add the commas only when there are parameters that need separated, and suppress the commas when all the parameters are turned off?  Here are a couple screen shots to show what I have.

 

2017-01-20_1508.png2017-01-20_1535.png2017-01-20_1512.png

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

tolgay.hickiran
Advisor
Advisor
Accepted solution

So i think i've found you a solution,

 

This code checks if the values of the attributes are empty or not and depending on the information, it adds or leaves the Description property.

 

First i created

 

I created a custom property named  "emptytest" and left it empty for this purpose.

 

I'm going to add the screencast too where i explain the solution in detail

 

 

iProperties.Value("Project", "Description") = "" 'clears the value
'MessageBox.Show(iProperties.Value("Custom", "emptytest")) 'check if the value is actually empty from a textbox

Dim i As Integer
i = 0
Dim a As New ArrayList
a.add(d0)
a.add(d1)
a.add(iProperties.Value("Custom", "emptytest"))
'MsgBox a.item(1)
MessageBox.Show(a.Item(i) & ": was found!", "iLogic")
'Dim a(1 To 2) As String
'a(1) = d0
'a(2) = d1

For i = 0 To 2
If i = 0 Then
	If String.IsNullOrWhiteSpace(a.item(i)) = False Then
	iProperties.Value("Project", "Description") = a.item(i)
	Else If iProperties.Value("Project", "Description") = ""
	End If
Else 
	If String.IsNullOrWhiteSpace(iProperties.Value("Project", "Description")) = False
		If String.IsNullOrWhiteSpace(a.item(i)) = False Then
		iProperties.Value("Project", "Description") = iProperties.Value("Project", "Description") & " , " & a.Item(i)
		Else iProperties.Value("Project", "Description") =iProperties.Value("Project", "Description")
		End If
	End If
	
'iProperties.Value("Project", "Description") = iProperties.Value("Project", "Description") & " , " & a.Item(i)
End If
Next

Some worthwhile ideas
Copy Design should rename ilogic Rules too!
Why Nastran In-CAD doesn't have an SDK?IMPLEMENTED!

Tolgay Hickiran
Founding Partner
SignatureSignature

website
emailskypelinkedinyoutubeemail

0 Likes
Message 3 of 3

EScales
Advocate
Advocate

Thanks for the help.  I was able to get something working based on your example.  I had to change my approach a bit, but your use of "String.IsNullOrWhiteSpace" sparked my interest.

Thanks again!