Find us on Google+ A Friday Tip: Find and Replace in iLogic ~ Inventor Tales

Friday, January 11, 2013

A Friday Tip: Find and Replace in iLogic

“The squeaky wheel doesn't always get greased; it often gets replaced”
John Peers

Over many years I've spent staring bleary eyed typing at a computer screen, two of the skills I've gotten pretty good at are typing, and the copy and paste hot keys (those are CTRL+C & CTRL+V if you're not familiar).

But there are times that I've found this doesn't help me.  I use the methods I'm used to because they're comfortable.

That was what happened this morning, I was replacing a bunch of variables in iLogic and starting copying and pasting away.

Then it hit me.... Like a palm to the face it hit me!



There are Search and Replace tools in iLogic!

I've been copying and pasting a bunch of entries when I could have just used Search and Replace to get them all in one shot!

The real files I was working on are proprietary, so I can't show it here.  So standing in for the proprietary files is a woodworking jig that I'm driving with iLogic. 

It's a generic template I created for cutting shapes in boards.  It's designed to be copied with Autodesk Vault's copy design tool.  Then iLogic is used to change the dimensions of the base and positions of the handles, stop, and clamps to fit the board being cut.

The jig.  iLogic drives the dimensions and positions of the components

Here's an example of the code that's driving the jig.

'These parameters drive the Base Dimensions
Parameter("Cloudlift Fixture Base Test:1", "Width") = Base_Width
Parameter("Cloudlift Fixture Base Test:1", "Length") = Base_Length
Parameter("Cloudlift Fixture Base Test:1", "Length") = Base_Thickness



'These parameters drive the Spacing between handles.
Parameter("Cloudlift Fixture Base Test:1", "Handle_Spacing") = Handle_Spacing

What I really need to do is swap "Cloudlift Fixture Base Test:1"" with "Cloudlift Fixture Base dev:1", to reflect the change I made in a components name in the browser.

The component's new name in the browser


I could copy and paste this with very little trouble.  But in the file I was working with (the one I can't show), I had at least fifty entries that needed to be changed.

Now that isn't nearly as easy!


Fortunately, I realized that I could Search and Replace the data before my "Copy & Paste" habit got the best of me.

The dialog box below shows the Search and Replace tab ready to go.  I have the text I want to find, and the text I want to replace all setup.


Since I want to change all the appearances of "Cloudlift Fixture Base Test:1" in this rule, I chose the "Replace All in this Rule" option.

Boom!  That's it, I'm done!
Search and replace has done it's job!

So what did I learn? Or rather "relearn"? 

Don't get too comfortable.  Every once in a while I need to take a step back and see if there's a better way to do what I'm doing. 

I think if there's anything I'm grateful for this Friday, it's that I had my little epiphany before I started my "Copy and Paste" insanity.  It saved me a nice little chunk of time, and a whole lot of headache!



1 comment:

  1. I think there is a different way that might save you a lot more time. Change the name of the part in the browser bar (this will not affect the part name). If you use copy design and change the file names that okay because the browser bar name will always stay the same. Now you can use the same code but it looks at the browser bar name. This way you never have to use find and replace for anything.

    There is another way that works even better but it uses a lot of set up and code to make it work. If I get some free time later I will try to post it on here.

    Hope this helps

    ReplyDelete