This is my first VBA. I want to do a ONE click VBA to do a Half section View with a selected plane. I can get it to select the plane, do the view, except the default distance but I can't get it to select the "Continue" & the "OK" button and finish the command. I am using Inventor 2013. Does anyone know how I need to finish this program? Thanks, Steve
PS -The File
Sub Plane_XY()
Dim assm As AssemblyDocument
Set assm = ThisApplication.ActiveDocument
ThisApplication.ActiveDocument.SelectSet.Select assm.ComponentDefinition.WorkPlanes.Item(3)
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyHalfSectionViewCmd").Execute
SendKeys "0.0"
SendKeys "{ENTER}"
End Sub
Solved! Go to Solution.
Solved by pberube. Go to Solution.
Hi Steve,
it looks like you have found missed API functionality.
Unfortunately we have no workaround now 😞
I've logged the change request to our database.
Thank you very much for this information.
Vladimir, Thanks for taking a look at this VBA. Hopefully the new code will come availiable soon. Thanks Agian, Steve
Hi Steve,
Step by step run the VBA will meet the issue as you mentioned. Could you please try use F5 run the VBA to the end? Your code should work to accept the Offset value and Enter key in this way.
Thanks,
-Jar
I have tried it (with Inventor 2015) and it worked fine for me... One thing you might try is to use :
SendKeys Chr(13)
instead of
SendKeys "{ENTER}"
Pberube,
Thanks for the suggestion. After getting you message I worked on it again and now it works. I will try your suggestion ("sendKeys Chr(13)") and will let you how it does.
Thanks,
Steve
Pberube,
Forgot to mention that by changing the three (3) at the end of line 4 to a 1 or 2 it will change the plane that the code that is used.
Steve
Vladimir,
FYI
The code is working now. They most have listen to you.
Thanks,
Steve
Pberube,
I just found out that if I Pre-select a custom plane and then click on one of the Custom Plane button it will use the custom plane to do a half section view.
Steve
Hi All,
If you remove the word "Assembly" in the line "Dim assm As AssemblyDocument", this VBA will do a half section in a part also. this assume you are using a version of Inventor (2015) that support it.
Steve
HI,
the idea is great an very helpfull and reduce clicks
When I test the code with the SendKeys Chr(13) correction, it work but I must click on ok to end the macro.
Hi,
there is a way to get if the Half Section View is active?
I'd like to have a unique command that switches from full view to half section view.
something that sounds like
IF HalfSectionView is active THEN
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyEndSectionViewCmd").Execute
ELSE
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyHalfSectionViewCmd").Execute
....
....
END IF