Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Replace Componamt - File Path Location in ilogic

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Dan.Ruby
1385 Views, 2 Replies

Replace Componamt - File Path Location in ilogic

Hi all,

 

I'm trying to replace a component within an assembly using ilogic, however my project file is always called something different. Is there a way to change only this part of the file string? I'm new to ilogic and any help would be appreciated. 

 

(1201000 needs changed to the current project name 1201001)

 

Component.Replace("230 SBF Wheel Assembly CCW:1","O:\Inventor Projects\1201000\Workgroup\Wheel\230 Wheel\CW\230 SBF Wheel Assembly CW.iam", True)

 

 

Thanks!

 

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Dan.Ruby

If you make a new string

 

Dim strProjectName as String

 

and then set it to a value

 

strProjectName = "1201000"

 

Then you could do this

 

Component.Replace("230 SBF Wheel Assembly CCW:1","O:\Inventor Projects\" & strProjectName  & "\Workgroup\Wheel\230 Wheel\CW\230 SBF Wheel Assembly CW.iam", True)

 

And programmatically change strProjectName

 

strProjectName = "1201001"

 

And then the call would be the same

 

Component.Replace("230 SBF Wheel Assembly CCW:1","O:\Inventor Projects\" & strProjectName  & "\Workgroup\Wheel\230 Wheel\CW\230 SBF Wheel Assembly CW.iam", True)

 

If you were smart about how you organized it, you could use a for loop and run through your projects.

Message 3 of 3
salariua
in reply to: Dan.Ruby

Thanks to dkatz for the solution.

Dan can't you use the pat of the assembly as a reference? instead of entering something all the time?

 

Dim oPath As String
oPath = ThisDoc.Path & "\"

MessageBox.Show("Path: " & oPath, "iLogic")

 

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!

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

Post to forums  

Autodesk Design & Make Report