ilogic Search and Replace part names

ilogic Search and Replace part names

Anonymous
Not applicable
495 Views
2 Replies
Message 1 of 3

ilogic Search and Replace part names

Anonymous
Not applicable

Heey there,

 

I was wondering if there is a possibility to replace a part of a part name.

For example:

 

I read the current project number with:

currentproject = Left(iProperties.Value("Project", "Part Number"),5)

 Then i want to replace the number (only the first five digits) in all the ilogic rules.

Parameter("20115-0202-000:1", "test") = test 

In the code above i want to replace the number 20115 by the currentproject number(let's say 12345). 

 

I know it's possible to do the search and replace but that's to much work when it's needs to be done everytime that I start a new project. Thats why  I was wondering if its possible to programm this step.

 

I am looking forward to hear from you!

 

 

Greeting from the Netherlands!

Bianca

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

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Anonymous 

Are you looking for something like  this?

currentproject = Left(iProperties.Value("Project", "Part Number"), 5)
For Each oRule As iLogicRule In iLogicVb.Automation.Rules(ThisDoc.Document)
	If oRule.Name <> iLogicVb.RuleName
		oRule.Text = oRule.Text.Replace("20115", currentproject)
	End If
Next

The rule loops through each rule in the document and replaces "20115" with the string stored in variable currentproject

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution
currentproject = Left(iProperties.Value("Project", "Part Number"),5)
Dim string1 As String
string1 = CStr(currentproject) + "-0202-000:1"
Parameter(string1 , "test") = test

 I found out that this also works and isn't relliable of the starting number.

For example if i change the project number twice or even more the programm will stil work as it should.