Bulk iProperty Copying Performance

Bulk iProperty Copying Performance

Anonymous
Not applicable
720 Views
4 Replies
Message 1 of 5

Bulk iProperty Copying Performance

Anonymous
Not applicable

Hi all,

 

I'm in the depths of my iLogic code to try improve performance. I have around 6000 lines of code and I have been using the stopwatch function to get some pretty good performance feedback.

I've found some useful tips in the API (like using 'For Each *** In *** instead for For i to ***.Count). I now have 2 areas left to reduce processing time - 1. excel lookups and writes to a register 2. Bulk iProperty copying to lower level part.

 

1. We are moving away from excel and implementing SQL, I am hoping this will help reduce lookup times.

 

2. This is where I need some advice. I need to copy approx. 100 iProperties down to a child component so that the lower level component refelcts it's parent.

 

Currently I am simply doing :

 

iProperties.Value("BLANK", "Custom", "BLANK_GDIM"iProperties.Value("Custom", "BLANK_GDIM")

 

The process is taking around 0.6 seconds to complete ( It's already pretty quick, I know! I'm looking in every corner to try improve performance!)

 

I've come across 'flushtofile' in the API, but looks like it's apprentice only which is no good to me!

 

Does anybody know any tips / tricks to improve the speed of setting iProperties?

 

I have a target to get the entire processing time to sub 1 sec, I'm currently on around 1.8sec, so any other performance tips / tricks would be appreciated.

 

FYI - I am running :

Xeon 3.20GHz (8 core)

24GB RAM

Windows 7 64bit

Inventor 2011 SP1

Page file 36GB to SSD

Inventor library info on SSD

 

Thanks,

 

Tom

 

0 Likes
721 Views
4 Replies
Replies (4)
Message 2 of 5

MjDeck
Autodesk
Autodesk

If you have a lot of statements in one rule, you might be able to improve performance by combining them into a single transaction.  Here's a sample:

Dim txnMgr As Inventor.TransactionManager = ThisApplication.TransactionManager
Dim txn1 As Inventor.Transaction = txnMgr.StartTransaction(ThisDoc.Document, "Copy iProperties")
Try
    ' Copy iProperties
Catch 
    txn1.Abort()
   Throw
End Try
txn1.End()

 It's important to either End the transaction or Abort it if it produces an error.

The API help has information about transactions.

 


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Are you sure iLogic is the best tool for the job?

 

VBA can be written as a tool that you choose to run whenever you like.

Typically iLogic runs every time a specified event fires in Inventor, for example file load.

 

1.  How big is this lookup you are accessing?  Using any external program is SLOW.  Especially Excel which takes time to load.

Access is quicker to load but not if you but I if your lookup list is not too great you might want to roll your own lookup using a dictionary object in full VB.NET.  Another option would be to use a sequel server which runs in the background so you are not launching a program.

 

2. I use a very small iLogic to load iProperties in mass.  Basically I have separate program that creates a small text file once with the iProperties and gives it a consistent name.  my iLogic which runs on part file load first checks if the folder containing the master assembly for this file.  if the file does not exist the iLogic ends.  If it detects the text file it loads the iProperties into the part file.  This takes almost no time.

 

Perhaps you could do something along these lines.

 

3. Apprentice is many many times faster at setting iProperties than Inventor.  This is because Apprentice is tiny itself and only loads the iProperty section an inventor file.  You cannot use the apprentice API from within Inventor however.   You can however create a standalone compiled program that uses apprentice and Shell to it from Inventor iLogic or VBA.  The part files cannot be open in Inventor when you do this.

 

Thinking on this a bit more I guess I would probably create the entire program to do all you want external to Inventor.  Probably in VB.NET Express which is free then run it manually whenever you need to.

 

 

0 Likes
Message 4 of 5

Anonymous
Not applicable

Thanks for the quick reply guys.

 

Mike,

 

Thanks for that, it did improve performance ever so slightly, every little helps! It's a good thing to know for me going forward, I can see a few areas where I can implement this.

 

Gruff,

 

I think iLogic has to be the correct tool for me. We are in partnership with our ERP supplier who have built an interface between Inventor and the ERP system. Their program opens up Inventor and runs the iLogic rules to build the model. The results of the model are then fed back into the ERP system.

 

I've got every rule turned to 'Don't Run Automatically' to hopefully avoid it being triggered unnecessarily.

 

1. The lookups are currently at around 1000 rows in excel, the database will grow as new products are developed. In a few years time I expect the database will be at around 10,000 rows. We've decided to go with SQL in the hope that it is:

a) more stable

b) will allow multicore access (as we ideally want many concurrent sessions of Inventor running at the same time and looking upto and writing to the database)

c) will be considerably quicker than excel.

We have someone writing the code to change our lookups from excel to SQL as we have no experience with SQL yet.

 

2. That sonds like a good process. My iProperties already exist at the lower level and just need the values updating following loookups and calculations from it's parents iLogic.

 

3. I've been looking into apprentice too. Not sure if the lower level components load automatically in the assembly? I presume so, meaning apprentice isn't possible for me.

 

Thanks for your help guys.

 

Cheers,

Tom

0 Likes
Message 5 of 5

Anonymous
Not applicable

I'm not sure this can help you or not, just my opinion.

I think that if you write program in VB.Net then convert it to Add-In, maybe you can save time and error.

From my experiment, I use Window Form to connect to IV and run my program, if I run program to create (SIMPLE) about 140 part and 8 assembly or more, an error will appear.

 

However, when I put my program into add-in, it run very very well with (COMPLEX) more than 500 part and 10 assembly. Error doesn't happens.

Maybe you can test and feel!

If you create a button in somewhere easy to find, user only needs to click one time.

With iLogic, you must Right Click, Run Rule (2 times) (if you have Rule Browser), or you must choose Manage Tab, Rule Browser, Right click, Run Rule (4 times) (if you don't employ Rule Browser).

 

Personally, iLogic is a brief code of VB.NET. I think in VB.NET you can debug better.

 

Hope this can help you save time!

0 Likes