iLogic - Open a document and change his iProperty

iLogic - Open a document and change his iProperty

Anonymous
Not applicable
1,726 Views
3 Replies
Message 1 of 4

iLogic - Open a document and change his iProperty

Anonymous
Not applicable

Hello,

 

I'm using Inventor 2013 Pro, and I use iLogic to change some iProperty of my parts (ipt).

 

With iLogic, I'd like to open a part (ipt) in an other folder, change his iProperty, save it and close it.

 

My code is :

Dim redDoc As String = "red.ipt"
Dim redPath As String = "G:\CAO\00 - Production\99 - Tests (BER)\tttttt\"
Dim oDoc As String

oDoc = ThisApplication.Documents.Open(redPath+redDoc, True) 
iProperties.Value(oDoc, "Project", "Description") = "Description changed !"
InventorVb.Application.activedocument.Save
InventorVb.Application.activedocument.Close (True)

 

Why it doesn't work ?

 

 

Best regards

0 Likes
Accepted solutions (1)
1,727 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

Hello Ronald,

 

You have mentioned the document as string which leads to the error. I've modified your code which works perfectly for me.

 

 

Dim oPath As String
oPath = "G:\CAO\00 - Production\99 - Tests (BER)\tttttt\"
Dim oPartName As String
oPartName = "red.ipt"
Dim opart As PartDocument
opart = ThisApplication.Documents.Open(oPath+oPartName, True)
Dim oDescription As String
oDescription = "Description123"
opart.PropertySets.Item("Design Tracking Properties").Item("Description").Value = oDescription
opart.Save
opart.Close

If you find this answer helpful to you please accept it as solution Smiley Wink

 

Cheers,

SK.

 

 

 

 

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Yes it works perfectly, thanks !!

0 Likes
Message 4 of 4

Anonymous
Not applicable

I got an error with the IAM when I try to replace some parts, I think it's the same mistake but don't know the correct command :

 

NewIAM = ThisApplication.Documents.Open(NewEnsemble, True)
NewIAM.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = NoOutil
NewIAM.Replace(OldPart, NewPath+NewPart, True)
NewIAM.Save
NewIAM.Close

 

OldPart, NewPath and NewPart are String variables.

0 Likes