Form opens additional modal with the same form...?

Form opens additional modal with the same form...?

EdvinTailwind
Collaborator Collaborator
476 Views
4 Replies
Message 1 of 5

Form opens additional modal with the same form...?

EdvinTailwind
Collaborator
Collaborator

Please note: I'm new to iLogic but have some previous experience of coding (PHP & JS, mainly), but wouldn't call myself a programmer of any sort. 🙂

 

I have this rather simple script that does what it's supposed to, but there's this annoying behavior that I don't understand how to get rid of.

 

It's an assembly where you can choose between some values (defined in Parameters "PapersizePosition") to change the constraint between two components. It's a rule which I have also added to a modal form. In the form the options are radio buttons, which is perfect for this, but before the actual change is done, another modal/popup shows requiring me to re-do the same thing I just did.

If the rule is run by itself only the second modal is opened. Is that where the issue is?

 

Can I somehow keep 2 but get rid of 3 in this screen-shot?

 

EdvinTailwind_0-1646669076549.png

 

The code:

PaperSelect = InputListBox("VĂ€lj pappersstorlek", 
	MultiValue.List("PapersizePosition"), _
	PapersizePosition, 
	Title := "Pappersstorlek", 
	ListName := "TillgÀngliga storlekar"
	)

If PaperSelect = "" Then 
	ActiveWP = "WP Constrain " & PapersizePosition
Else
	ActiveWP = "WP Constrain " & PaperSelect
End If

Constraints.AddMate("MatePapersizePosition:1", 
	"MÄttpinne:1", ActiveWP, 
	"MÄttspÀrr:1", "WP Constrain Block",
	offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, 
	e2InferredType := InferredTypeEnum.kNoInference,
	solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType,
	biasPoint1 := Nothing, biasPoint2 := Nothing)

 

0 Likes
Accepted solutions (1)
477 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @EdvinTailwind.  It looks like the iLogic Form you are working with is one that is saved within a document, instead of a 'global' iLogic Form, is that correct?  Is the iLogic rule also saved within that same document, or is it an external iLogic rule?  If the rule is saved within the document, then are there any unquoted names of parameters within that rule?  By default, when you use the unquoted name of a parameter within a non-external rule, it will turn blue, and it will cause that iLogic rule to be triggered to run every time the value of that parameter changes.  This can be very advantageous when this is the behavior you want, but can be very annoying or cause problems when you don't want that behavior.  Since I don't see a button in your form to run the rule, I would guess that the rule is being triggered to run by the parameter change event, but I don't know if that is due to you using the Event Triggers dialog box, or if the above mentioned scenario is true.  What you could do is eliminate the InputListBox from the start of the iLogic rule, use the iLogic snippet there to show your form.  But then the form would show every time the rule is triggered to run, so that might not be ideal either.  I would be tempted to completely separate the iLogic rule into two rules to eliminate that issue.  The one rule would just be react to the parameter change event, while the other could just be to show or launch the iLogic form.  If you launch the form and change anything, the other rule will just run in the background and do its thing, without notifying you, unless there was a problem.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

JMGunnar
Collaborator
Collaborator
Accepted solution

Du fĂ„r ta bort 

PaperSelect = InputListBox("VĂ€lj pappersstorlek", 
	MultiValue.List("PapersizePosition"), _
	PapersizePosition, 
	Title := "Pappersstorlek", 
	ListName := "TillgÀngliga storlekar"
	)

 frĂ„n din regel  

du kan ocksĂ„ lĂ€gga till  value = PapersizePosition

Mvh Johan G

Message 4 of 5

EdvinTailwind
Collaborator
Collaborator

@WCrihfield: Even though @JMGunnar gave me the simplest do-this-to-fix-it solution ever (thank you!) I appreciate your very extensive answer here. I do understand that iLogic is way bigger & more complex than this little snippet I pulled together, but it's enough for now and I have a deadline next week so any more advanced configurations will have to wait.

0 Likes
Message 5 of 5

EdvinTailwind
Collaborator
Collaborator

For anyone interested, here are a couple of images and a video of the final outcome:

https://forums.autodesk.com/t5/inventor-forum/community-pictures-april-2022/m-p/11085430/highlight/t...

 

Once again - thanks for your help!

0 Likes