Need a button. How is it correct?

Need a button. How is it correct?

robertast
Collaborator Collaborator
681 Views
5 Replies
Message 1 of 6

Need a button. How is it correct?

robertast
Collaborator
Collaborator

A question for experts.

What is the right thing to do if you need a button to run the code.Convert iLogic into VBA? Or write a code in VBA that launches iLogik?

0 Likes
Accepted solutions (1)
682 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
0 Likes
Message 3 of 6

robertast
Collaborator
Collaborator

@Anonymous 

 

Вы меня не поняли. Я знаю, как назначить кнопку макросу. И как запускается iLogik через триггер. Но если есть несколько правил и один триггер :). Кнопка в таком случае - это именно макрос. А как насчет правила? переписать или ...?

 

0 Likes
Message 4 of 6

Anonymous
Not applicable

If there are several rules, use an iLogic form. Click button -> launch form -> choose from rules

0 Likes
Message 5 of 6

robertast
Collaborator
Collaborator

If you make a form only for buttons, there is no point in them and the rule can be followed. The button is convenient to use for quick start-up and frequent use

Knopke.jpg

0 Likes
Message 6 of 6

robertast
Collaborator
Collaborator
Accepted solution

Summary if you need a toolbar button - Convert iLogic to Macro. If there is not enough knowledge for this, we use a macro to launch iLogic: 

 

Public Sub Buton()
Dim addIn As ApplicationAddIn
Dim addIns As ApplicationAddIns
Set addIns = ThisApplication.ApplicationAddIns
For Each addIn In addIns
If InStr(addIn.DisplayName, "iLogic") > 0 Then
addIn.Activate
Dim iLogicAuto As Object
Set iLogicAuto = addIn.Automation
Exit For
End If
Next
Debug.Print addIn.DisplayName


Dim RuleName As String
INTERNALrule = "Rule Name"

Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
If oDoc Is Nothing Then
MsgBox "Missing Inventor Document"
Exit Sub
End If


iLogicAuto.RunRule oDoc, INTERNALrule 'for internal rule


End Sub

 

 

But this is a last resort.

0 Likes