Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UI Dialog allowing user to operate inventor before selecting an option

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
bwangNYAKX
591 Views, 5 Replies

UI Dialog allowing user to operate inventor before selecting an option

I've created some VBA codes that automatically generates REVIT file. It basically changes all the sub-assembly's representation to "REVIT" and deletes all the unnecessary small parts. Then, it will show a UI dialog asking "Ready to Shrinkwarp?" If the user chooses yes, it will do a shrinkwrap and export a adsk file.  

 

My problem is that, the only way I know to generate a dialog is by "msgbox" but the limitation is that when a dialog shows, you are only allowed to click the options but not to operate anything in Inventor. My question is: is there a way that allows me to pan over the model to check if everything is okay, or even better, to make some changes if necessary before I click "yes"? 

 

Thank you for your help in advance!

 

Sub RevitGenerator()

 

'Code to replace the representation and delete unnecessary code.

                                Dim oUserInput As Integer
                                oUserInput = MsgBox("READY TO SHRINKWRAP?", 4)

                                If oUserInput = 7 Then
                                    Exit Sub
                                ElseIf oUserInput = 6 Then
                                     Call createShrinkWrapWithDefinition
                                End If

End Sub

 

Tags (3)
Labels (1)
5 REPLIES 5
Message 2 of 6
WCrihfield
in reply to: bwangNYAKX

The only thing I can think of that 'might' act this way, outside of an AddIn, would be calling (showing) a non-modal Form near the beginning of the code, with more code afterwords that is waiting to use the FormResult, to determine what do do next.  If you're using VBA, I am just assuming using a UserForm would act similarly, but I'm not sure.  Dealing with the active 'focus' might be tricky though, if you're planning on trying to manually interact with the model in the middle of this.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6
AlexKorzun
in reply to: bwangNYAKX

Hi,

 

Please look into https://forums.autodesk.com/t5/inventor-customization/inventor-vba-userform-documentation-or-tutoria.... There is some discussion around VBA vs iLogic forms.

 

If you want, in addition to displaying form itself, to operate on Inventor UI, consider using modeless forms or Inventor dockable windows.

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 4 of 6
ckeveryga
in reply to: bwangNYAKX

This should do what you're looking for. 

 

Private Declare PtrSafe Function MessageBox Lib "User32" Alias "MessageBoxA" (ByVal hWnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long

Sub Main()
Continue = MessageBox(&O0, "This Macro will check for all related document drawings." & _
vbNewLine & vbNewLine & "Do you want to continue?", "Open All Related IDW's?", vbYesNo + vbSystemModal)

If Continue = vbNo Then Exit Sub
End Sub

Message 5 of 6
bwangNYAKX
in reply to: ckeveryga

Although I need to do some research on how that declaration statement work, but this solves my problem!! THank you!!

Message 6 of 6
_dscholtes_
in reply to: bwangNYAKX

@bwangNYAKX Just for info, I can pan, rotate and zoom using my 3d mouse while a message box (or form) is open.

Also opening a form / message box and then go back to operating Inventor is not a very good work flow. It's like asking Word to save your document and then hide the save dialog window so you can correct a typo in your document.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report