Auto Sort on Update in Partslist in idw

Auto Sort on Update in Partslist in idw

dominiek_vanwest
Advocate Advocate
660 Views
9 Replies
Message 1 of 10

Auto Sort on Update in Partslist in idw

dominiek_vanwest
Advocate
Advocate

Hi,

 

The code for sorting a Partslist in an idw is something like this:

  Partslist.Sort("ITEM", False, Nothing, Nothing, Nothing, Nothing)

However, I don't see an option to check the 'Auto Sort on Update' checkbox.

 

How can I do this?

 

Thanks in advance,

Dominiek

0 Likes
661 Views
9 Replies
Replies (9)
Message 2 of 10

BrandonBG
Collaborator
Collaborator

I can't find it either.

 

There is "DrawingPartsListUpdateCtxCmd" in the command manager which might be useful, but I'm not sure what the context is.

 

Have you tried setting up a trigger to re-sort the parts list table when something changes?

 

BrandonBG

0 Likes
Message 3 of 10

dominiek_vanwest
Advocate
Advocate

You mean with iLogic?

That might be possible, but I have a few hundred standard drawings to adjust....

Also, that will make the file a bit larger I guess.

 

Dominiek

 

 

0 Likes
Message 4 of 10

BrandonBG
Collaborator
Collaborator

You could write an external rule that wouldn't increase the file size.

 

Brandon

0 Likes
Message 5 of 10

Vladimir.Ananyev
Alumni
Alumni

Agree with Brandon.

External iLogic rule would be the simpliest way to run PartsList.Sort function in drawings that wouldn't increase the file size.

 

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 6 of 10

dominiek_vanwest
Advocate
Advocate

Sorry for not replying back immediately, I was 2 weeks on holiday.

 

I'm not sure how to do it with iLogic. In my application, I make that drawing with that PartsList, but I also immediately check it in to the Vault.

How can I get the iLogic rules to run in between my programming code? And how would the iLogic rules look like?

 

Thanks in advance,

Dominiek

0 Likes
Message 7 of 10

Vladimir.Ananyev
Alumni
Alumni

You need three lines of code to execute Inventor command:

 

VBA:

Dim ctrl As ControlDefinition
Set ctrl = ThisApplication.CommandManager.ControlDefinitions("DrawingPartsListUpdateCtxCmd")
ctrl.Execute

In iLogic rule you should remove 'Set' from the second line.

 

Here is the good overview on running Inventor commands using the API

http://modthemachine.typepad.com/my_weblog/2009/03/running-commands-using-the-api.html


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 8 of 10

dominiek_vanwest
Advocate
Advocate

Thank you for the reply.

But now I get a message in Inventor: Parts list may contain explicit user overrides that are not in a frozen state. Processing an update now will remove explicit user overrides.

And if I click OK I do not see the checkbox 'Auto Sort on Update' checked.

How can I avoid the message showing and the checkbox checked?

 

Thanks in advance,

Dominiek

 

PS: Your info did help for something else, for getting my view to Isometric view. I used to do it with Sendkeys("F6"), but if the screen was not active, it would not work. But with your info it works everytime now. Thanks!

0 Likes
Message 9 of 10

Vladimir.Ananyev
Alumni
Alumni

Could you restore removed explicit user overrides using referenced BOMRow data?


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 10 of 10

dominiek_vanwest
Advocate
Advocate

@Vladimir.Ananyev wrote:

Could you restore removed explicit user overrides using referenced BOMRow data?


What do you mean exactly?
0 Likes