iLogic access to Filename iProperty

iLogic access to Filename iProperty

Anonymous
Not applicable
437 Views
1 Reply
Message 1 of 2

iLogic access to Filename iProperty

Anonymous
Not applicable

Hi,

I would like to copy filename to several iProperties field. I have for example part or assembly which name is "18174.014.0199 - Wall (North)". Can you write me iLogic rule that writtes:

"18174.014.0199" to iProperties/Project/Part number

"Wall" to iProperties/Summary/Subject

"North" to iProperties/Project/Description

Sometimes i have filename just with part number and subject ("18174.001.0002 - Tunnel").

Can this rule search all the parts and assemblies within main assembly and writtes values for all of them?

Best regards

0 Likes
438 Views
1 Reply
Reply (1)
Message 2 of 2

clutsa
Collaborator
Collaborator
'specify word splitting characters "space" and "dash"
Dim Separators() As Char = {" "c, "-"c} 
Sentence = ThisDoc.FileName(False) 'without extension
Words = Sentence.Split(Separators)
For Each wrd In Words
	If wrd Like "#####.###.####" Then iProperties.Value("Project", "Part Number") = wrd
	If wrd Like "[!(]??*" Then iProperties.Value("Summary", "Subject") = wrd
	If wrd Like "(*)" Then iProperties.Value("Project", "Description") = wrd
Next

I literally put this together with nothing but the like operator found here...

https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/like-operator

and code from the snippets in the iLogic editor.

I don't mean to be rude but in the future please make an attempt to write the code and then come back with questions. Yes this can be made to loop thru all the sub parts (you'll use the ComponentDefinition and Occurences) those are some key terms you can search to try to figure out how. Come back with what you get figured out and we can help piece it together.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes