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: 

VBA / HALFSECTION VIEW

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
steveland
1125 Views, 12 Replies

VBA / HALFSECTION VIEW

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

12 REPLIES 12
Message 2 of 13

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 Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 13

Vladimir, Thanks for taking a look at this VBA. Hopefully the new code will come availiable soon. Thanks Agian, Steve

Message 4 of 13
JarFu
in reply to: steveland

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



Jar Fu
SW Engineer
Inventor QA
Autodesk, Inc.
Message 5 of 13
pberube
in reply to: steveland

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}"

Pierre Berube
Autodesk Certified Professional - Inventor 2015
Message 6 of 13
steveland
in reply to: pberube

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

Message 7 of 13
steveland
in reply to: steveland

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

Message 8 of 13

Vladimir,

FYI

The code is working now. They most have listen to you.

 

Thanks,

Steve

Message 9 of 13
steveland
in reply to: steveland

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

Tags (1)
Message 10 of 13
steveland
in reply to: steveland

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

Message 11 of 13
pberube
in reply to: steveland

Hi steveland,

 

That's a great comment. I actually never thought of making it more general like that.

 

Thanks,

Message 12 of 13
j_weber2
in reply to: steveland

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. 

 

 




Jörg Weber
CAD Systemtechniker für AutoCAD, Inventor, Vault





Message 13 of 13
mvassalliZ7Y5N
in reply to: steveland

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

 

 

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

Post to forums  

Autodesk Design & Make Report