iLogic Copy and update iProperties

iLogic Copy and update iProperties

jnewon
Advocate Advocate
696 Views
1 Reply
Message 1 of 2

iLogic Copy and update iProperties

jnewon
Advocate
Advocate

Hi All, Thanks for reviewing my question.

Currently I use an external iLogic rule to copy parts I need from a Library to a Job folder. The rule uses a text file to define the list of parts required. The parts copied are all renamed the reflect the job. It works great. I would like to incorporate an iProperty updated routine after I copy a part the the new location.  I need a routine when given the full file path "sFile" and job number "sJob" to open the file and update the iProperties.Value("Project", "Project") = sJob of every copied part. This routine would run in the copy loop to update each part. Don't know if this is possible. I have tried opening the file but can't gain access to the iProperties.

 

This routine will help by not needing to every part and manually change the properties later.

 

Public Sub updateFileProperties(sFile As String, sJob As String)
	
	????
End Sub

Rule is attached.

 

Thanks again for your help.

 

John

0 Likes
Accepted solutions (1)
697 Views
1 Reply
Reply (1)
Message 2 of 2

jnewon
Advocate
Advocate
Accepted solution

Hi All,

Thanks for trying but I got it figured out. See below subroutine I used to solve my problem. While working the routine I ran into another issue of the files being read-only. This is because of the files being copied from a library. I solved this with a shell command to remove the read-only attribute.  Maybe this routine will help someone else down the road.

 

John

 

Public Sub updateFileProperties(sFile As String, sJob As String, sJobDesc As String)
	Dim oPart As PartDocument
	
	'[DEBUG==>MessageBox.Show("set file attribute", "DEBUG 1-4:UPDATE FILE PROPERTIES",MessageBoxButtons.OK)
	']
	Shell("attrib.exe " &Chr(34) & sFile & Chr(34) & " -r")'<-- REMOVE READ ONLY FILE ATTRIBUTE
	
	'[DEBUG==>MessageBox.Show("OPEN PART FILE", "DEBUG 2-4:UPDATE FILE PROPERTIES",MessageBoxButtons.OK)
	']
	oPart = ThisApplication.Documents.Open(sFile, True)
	
	'[DEBUG==>	MessageBox.Show("SET IPROPERTIES", "DEBUG 3-4:UPDATE FILE PROPERTIES",MessageBoxButtons.OK)
	']
	oPart.PropertySets.Item("Design Tracking Properties").Item("Project").Value = sJob
		
	'[DEBUG==>MessageBox.Show("SAVE/CLOSE PART FILE", "DEBUG 4-4:UPDATE FILE PROPERTIES",MessageBoxButtons.OK)
	']
	
	oPart.Save
	oPart.Close
	
End Sub