Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic Save as, replaced item

2 REPLIES 2
Reply
Message 1 of 3
Log0ut
397 Views, 2 Replies

iLogic Save as, replaced item

Hi

 

I've come up with the following iLogic rule:

oDoc = ThisDoc.Document
aDoc = ThisApplication.ActiveDocument
oFilePath = Left(aDoc.FullDocumentName, InStrRev(aDoc.FullDocumentName, "\"))
SubFolder = "\Koost\"
oPath = oFilePath & SubFolder
oName = "Koost"
oNR = "1"

If Not System.IO.Directory.Exists(oPath) Then 
    System.IO.Directory.CreateDirectory(oPath)
End If

oProject_Filenames = System.IO.Directory.GetFiles(oPath)

For Each oOpenFiles As String In oProject_Filenames
	If oOpenFiles.Contains(oName) Then
		oNR = oNR + 1
	End If
Next

If oNR < 10 Then
		oNR = "00" + CStr(oNR)
	ElseIf oNR < 100 Then
		oNR = "0" + CStr(oNR)
	Else 
		oNR = CStr(oNR)
End If

oType = ".ipt"
oFullFileName = oPath & oName & oNR & oType
oDoc.SaveAs(oFullFileName, False)

Everything seems to work fine, untill i use more than one part in an assembly. If i close and reopen my assembly, somehow all parts, what i have placed after first item, are replaced with same part. Watch the video. Any ideas?

2 REPLIES 2
Message 2 of 3
Log0ut
in reply to: Log0ut

Seems that saving assy, every time after inserting part, solves my problem

aDoc.Save

 

Message 3 of 3
Log0ut
in reply to: Log0ut

Hi

This problem still exists. Not all the time but most of time. I have tried to find pattern when and what conditions it happen but with no luck.

Do anybody have any idea what causing this behavior?

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report