Foldername to Project ipropertie

Foldername to Project ipropertie

jostroopers
Collaborator Collaborator
1,008 Views
7 Replies
Message 1 of 8

Foldername to Project ipropertie

jostroopers
Collaborator
Collaborator

I make a copy design from vault basic.
I put the model in a folder called 202020.jostroopers_0-1607329066377.png

I open the main assy and with a rule I want to have the folder name, 202020, taken over by the ipropertie Project.
Is this possible with an ilogic code?
Can / will someone help me with that?

 

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
Accepted solutions (2)
1,009 Views
7 Replies
Replies (7)
Message 2 of 8

FINET_Laurent
Advisor
Advisor
Accepted solution

Morning,

 

I suppose there is a quicker way to this but here is my go :

 

Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

Dim oDocPath As String = oDoc.FullFileName
Dim oDocName As String = oDoc.DisplayName

	Dim oDocPath2 As String = Split(oDocPath, "\" & oDocName)(0)

		Dim FolderName As String = oDocPath2.Remove(0, oDocPath2.LastIndexOf("\") + 1) 

iProperties.Value("Project", "Project") = FolderName

Regards,

 

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 3 of 8

bradeneuropeArthur
Mentor
Mentor

Edit.

I understood wrong!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 4 of 8

jostroopers
Collaborator
Collaborator

Thanks Finet.

 

How will it go if I create some subfolders in the root folder 202020.
I still want the iproperty to point to the root directory.
So if I put a model in the folder 163000 and 163005, the iproperty, Project, should still take the value 202020 in these models.

 

jostroopers_0-1607333028652.png

 

 

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes
Message 5 of 8

FINET_Laurent
Advisor
Advisor
Accepted solution

This whould go like this :

 

Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

Dim oDocPath As String = oDoc.FullFileName
Dim oDocName As String = oDoc.DisplayName

	Dim oDocPath2 As String = Split(oDocPath, "\" & oDocName)(0)
		
		Dim FolderName As String = oDocPath2.Remove(0, oDocPath2.LastIndexOf("\"))
		
			Dim oDocPath3 As String  = Split(oDocPath2,FolderName)(0)
		
				Dim FolderName2 As String = oDocPath3.Remove(0, oDocPath3.LastIndexOf("\") + 1)
		
iProperties.Value("Project", "Project") = FolderName2

The thing is, you need 2 rules for both cases... Is it an issue in your case ?

If yes you might need to take a different aproach.

 

Regards,

 

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 6 of 8

jostroopers
Collaborator
Collaborator

@FINET_Laurent Super thanks.
This is no problem. If I have one model in an order, I use rule number 1. If I have several models that are placed in subfolders in an order, I use rule number 2.

 

Kind Regards.

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
Message 7 of 8

FINET_Laurent
Advisor
Advisor

@jostroopersGlad I could help 😄 !

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 8 of 8

jostroopers
Collaborator
Collaborator

@FINET_Laurent 

I made a change and now the second code is not working.

Instead of the folder 163000 I now use 02_9_Vast Daklicht.
Now the ipropertie 'Project' gets the value 02_9_Vast Daklicht instead of 202020.
Is that because of the different value of the sub folder?

 

jostroopers_0-1640690507536.png

 

 

Mvg Jos
Youre drawings are as good as the symbols that compleet them.....
0 Likes