Global form iProperties lagging

Global form iProperties lagging

k.hendrickx
Advocate Advocate
322 Views
3 Replies
Message 1 of 4

Global form iProperties lagging

k.hendrickx
Advocate
Advocate

Hi all,

 

I've been at it for a few days setting up some programming to keep (time)track of our projects.

Now all the technical stuff is working as it should be, but one thing that I just can't seem to get working is to update the global form used to control everything.

 

So the basic idea is that users will have a global form open at all times which (should in theory) show them a bunch of custom iProp's from the assembly they are working on.

khendrickx_5-1728917970453.png

Now in first instance this seems to work, however when starting a new project the iProp's in the form remain linked to the previous file.

khendrickx_6-1728918012759.png

 

Only after closing and showing the form again do the properties "update" to the new project.

khendrickx_7-1728918017099.png

 

Okay, so I know it's dirty, but I added a line that during the creation process closes the form and only at the end reopens it again after all the required custom properties are created in the assembly file... but this doesn't do a thing apparently, the form just reopens still referring to the iProp's of the previous document.

khendrickx_9-1728918334911.png

 

Does anyone know how to "brute force" an update of the form's iProperties?

 

Thanks in advance!

0 Likes
Accepted solutions (1)
323 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @k.hendrickx.  The 'global' iLogic Form will focus on whichever document happens to be 'active' when it initially gets launched, and will remain focused on that same document until it is closed, no matter if you switch to other documents while it remains open.  Plus, if you are initially launching the form, then closing it, then doing some other stuff, then launching it again, all from a single iLogic rule, then it will likely focus on the same document again when it gets launched the second time also, due to how document focus works in iLogic rules.  You will notice that the command for launching an iLogic form does not have any document reference control associated with it.  You may simply need to make sure that a different document is truly 'active' when you launch the form again.  That is not always easy though, when an assembly is involved.  Usually when you launch either a rule or a form while an assembly is active, that assembly will remain the active document, even while iterating through all other referenced documents that are invisibly open in the background, and doing something to/with them.  This may require saving & closing the assembly, launching the form while another document is visibly active, then opening the assembly again, but I am not 100% sure.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

WCrihfield
Mentor
Mentor
Accepted solution

I just thought of something that might help you to launch an iLogic global form in a way that may give you more control over which document that form will be focused on when you launch it.  It utilizes the relatively new ILowLevelSupport.CreateObjectProvider Method, which allows us to specify a Document object, and provides us with a IStandardObjectProvider Interface object that we can use to initialize most of the common iLogic rule objects.  When we then use that 'SOP', the objects we initialize from there will remain focused on the Document we specified, instead of the 'default' document that the rule would normally be focused on.  Below is an example of how to use this, but you will need to change "Assembly1" to the FullDocumentName of the Document you want to use, and change "Basic Properties" to the name of your global iLogic form.  The 'ThisApplication.Documents' collection contains all 'open' Documents, even if there is no document tab for them.  This will include documents that any of the visibly open documents are currently referencing, which are usually not visible anywhere but the number in the status bar, if that is showing.

Dim oDoc As Inventor.Document = ThisApplication.Documents.ItemByName("Assembly1")
Dim SOP As IStandardObjectProvider = iLogicVb.CreateObjectProvider(oDoc)
Dim FRV = SOP.iLogicForm.ShowGlobal("Basic Properties", FormMode.NonModal)

This seemed to work OK in a simple local test, so hopefully it will work OK for you also.  However, I think this technique has only been around since around the 2021 or 2022 version of Inventor.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 4

k.hendrickx
Advocate
Advocate

Wow... just added this to the code and (so far) it seems to be working perfectly.

Much appreciation, I'm fairly certain I would have never come up with that piece of code 😂

 

0 Likes