use Form for mutiple drawings (setfocus)

use Form for mutiple drawings (setfocus)

j_troquay_9GRNTV6LTYZG
Explorer Explorer
365 Views
5 Replies
Message 1 of 6

use Form for mutiple drawings (setfocus)

j_troquay_9GRNTV6LTYZG
Explorer
Explorer

i have a form that calls 2 iRules: sheetsize+ and sheetsize-

obviously to make sheet size bigger/smaller.

iRules and Form are stored in the drawing file itself for several reasons.

 

problem:

1. the Form opens when creating or opening drawing one. it works.

2. when creating or opening another drawing, the Form stays focussed on drawing one.

 

result:

the iRule does not seem to work when in drawing 2, but it runned the iRule still on drawing one.

 

question:

if and how can you set the focus of the Form to the drawing at hand? (without closing the form and reopen it, as I need to do now)

0 Likes
366 Views
5 Replies
Replies (5)
Message 2 of 6

dhanna
Enthusiast
Enthusiast

I haven't tried it, but I would look into making the form create the new sheet then set the new sheet as active. That might be overly simplified and it is possible that methodology isn't supported.. but that's what I would try next.

0 Likes
Message 3 of 6

SebastienOuellet
Participant
Participant

You can make a rule to open the desired form, that way you will be able to close the opened form when opening the one on focus

 

Try
	iLogicForm.Close("FORM")
Catch
End Try
	
iLogicForm.Show("FORM")

 

 


Logo MCMCAD
https://mcmcad.com/
0 Likes
Message 4 of 6

j_troquay_9GRNTV6LTYZG
Explorer
Explorer

The problem is that there is no itrigger available that detects that you switch to another tab (drawing).

 

Opening/closing drawing already opens and closes the form, as these are available itriggers using similar code you suggested (thanks for that)

Message 5 of 6

Curtis_Waguespack
Consultant
Consultant


Hi @j_troquay_9GRNTV6LTYZG,

iLogic Functions are designed to look at the document the rule is in, and therefore will not work for this.

 

But if you use API calls ( rather then iLogic functions) and ActiveEditDocument you can get around this.

 

For instance if I have this rule in Drawing1.idw and a form in that file with a button for that rule, I can open the form, run the rule in Drawing1.idw, then change to Drawing2.idw and it will work.

 

Curtis_Waguespack_0-1686926758545.png

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveEditDocument

Dim oSheet As Sheet = oDoc.ActiveSheet

If oSheet.Size = DrawingSheetSizeEnum.kADrawingSheetSize Then
	oSheet.Size = DrawingSheetSizeEnum.kBDrawingSheetSize
Else
	oSheet.Size = DrawingSheetSizeEnum.kADrawingSheetSize 
End If

MsgBox(oDoc.FullFileName)

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 6 of 6

j_troquay_9GRNTV6LTYZG
Explorer
Explorer
I check it out next week, and get back to report my findings here. Thanks.
0 Likes