Problem updating excel driven assembly

Problem updating excel driven assembly

RodrigoEiras
Advocate Advocate
1,535 Views
14 Replies
Message 1 of 15

Problem updating excel driven assembly

RodrigoEiras
Advocate
Advocate

I have looked at many posts with similar names, but I think this is a slightly different issue.

 

I have an assembly where some parts, and some subassemblies are driven by an excel file and some iLogic rules. When the values in the excel file change and the file is saved, the following is happening:

 

1.- First the rules in the assembly run, so the subassemblies and are suppressed/unsuppresed and updated properly

 

2.- Once this has happened, then the main part of the assembly updates, as it gets new parameters from the excel file.

 

3.- So the final result is that the options are properly sized and suppressed/unsuppressed (step 1), but they are not in the right position as the skeleton sketches placed in the main part have updated later in step 2.

 

Is there any easy way to trigger the update once the parts in the assembly have been updated?.

 

Thanks in advance and best regards.

 

(I am using Inventor Professional 2015)

 

 

 

 

0 Likes
1,536 Views
14 Replies
Replies (14)
Message 2 of 15

Anonymous
Not applicable
You can check for the flag "Dirty" uder Document object to check if the document is Modified. Based on that you can manage the sequence of the ilogic rule to be triggered
0 Likes
Message 3 of 15

RodrigoEiras
Advocate
Advocate

 

Hi Santosh,

 

Thank you for your answer. I have written the rule below, but I am not able to trigger it properly. Could you help me with that?

 

Best regards

 

 

Rodrigo

 

 

SyntaxEditor Code Snippet

Dim oAssembly As AssemblyDocument

oAssembly = ThisDoc.Document


If oAssembly.Dirty()=True Then
    InventorVb.DocumentUpdate()
Else

End If
0 Likes
Message 4 of 15

Anonymous
Not applicable
Hi Rodrigo,

Let me know if i understand your sequence right

When the Run runs on the Top Assembly.
1. Its subassemblies are updated
2. parts directly referencing the top assembly is updated from excel file
3. Finally the Top assembly is updated

Also let me know up to what steps you are successful..
0 Likes
Message 5 of 15

RodrigoEiras
Advocate
Advocate

 

Hi Santosh,

 

I am representing different arrangements of an assembly using an excel file. So once I select the right type in the excel file all parameters are updated in the excel file. When I save the excel file:

 

  1. Parts and subassemblies (linked directly to the Excel file) are properly updated
  2. iLogic rules in Parts and Assembly are running properly, so the applicable subassemblies are unsuppressed and the not applicable ones are suppressed

 

But I have one subassembly that is positioned using a skeleton sketch from one of the parts. It seems this constraint is not properly updated, so the subassembly is not going to the new position. As soon as I press the update button, or manually run the rule I sent to you, it goes to the right position, but I am not able to achieve that automatically.

 

I hope I have explained the problem clearly. Otherwise, just tell me.

 

 

Rodrigo

 

0 Likes
Message 6 of 15

Anonymous
Not applicable

Hi Rodrigo

 

This seems to be a sequence issue. Compare the sequence followed manually to the Automation rule. Does that match?

0 Likes
Message 7 of 15

RodrigoEiras
Advocate
Advocate

 

It seems the part with the skeleton sketch is updating after all the rest of parts and subassemblies have updated, and this may be causing the problem. It seems the solution could be:

 

1.- To trigger the assembly update after the last updating part has updated

 

2.- To write some rule to force the part with the skeleton sketch to update in first place.

 

But I don't know how to write the right code to perform any of these two actions 😞

 

 

0 Likes
Message 8 of 15

Anonymous
Not applicable
Use the Document object Rebuild or Update to perform the update/rebuild.
You are the best judge as i am unaware of the code you have written.
0 Likes
Message 9 of 15

RodrigoEiras
Advocate
Advocate

 

Hi Santosh,

 

I see the problem is not in the update code, but in how to trigger it in the right moment. Any idea?

 

Regards

Rodrigo

 

0 Likes
Message 10 of 15

Anonymous
Not applicable

Embed the Rebuild code at the end of the ilogic rule where the skeleton part is updated/rebuilt

0 Likes
Message 11 of 15

RodrigoEiras
Advocate
Advocate

 

Hi Santosh,

 

The problem is the parts is not updated throught an iLogic rule, but it automatically updates when the Excel file is modified and saved. So I don't know where to embed the code.

 

Regards

Rodrigo

 

0 Likes
Message 12 of 15

Anonymous
Not applicable
Share your ilogic code....
0 Likes
Message 13 of 15

RodrigoEiras
Advocate
Advocate

 

It seems I am not able to explain myself properly 😞

 

 

0 Likes
Message 14 of 15

mslosar
Advisor
Advisor

Can't you trigger a rule based on 'any parameter change' that calls a new iLogic function that basically just executes Rebuild all?

 

I'll also add that I had a similar problem (i think). My solution was to toss in a rule similar to above that opened all the offending parts/assemblies, this caused them to update on their own, saved, closed file.

 

Seemed to solved this issues i had of an assembly with about 8 sub's and more sub-subs in it 🙂

0 Likes
Message 15 of 15

RodrigoEiras
Advocate
Advocate

 

Hi mslosar,

 

I think your last comment may be the right solution, although I have tried to acces the part from the assembly without success. Below you can find the code I was trying to use. Could you help me with that?

 

Regards

 

Rodrigo

 

SyntaxEditor Code Snippet

'Opens CoverPlate.ipt and force updating

Dim oAssy As AssemblyDocument
Dim oPartDoc As PartDocument
Dim oDocs As Documents
Dim vDocRoute As String


oAssy = ThisDoc.Document
oDocs = oAssy.Documents()

oPartDoc = oDocs.Open("CoverPlate.ipt", False)


oPartDoc.Activate()
oPartDoc.Rebuild()
oPartDoc.Save()
oPartDoc.Close()
0 Likes