Brian Ekins

October 2009

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

« Combining Multiple Actions into a Single Undo | Main | Positioning Assembly Occurrences »

March 30, 2009

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e553fcbfc6883401156e9eff25970c

Listed below are links to weblogs that reference Running Commands Using the API:

Comments

Vladimir Ananiev

Thank you, Brian, for this post.

In Inventor 2009 Execute2(True) doesn’t work as described.
So I still have to use loop like

Do While ThisApplication.CommandManager. _
ActiveCommand="AssemblyPlaceComponentCmd"
DoEvents
Loop

Is Execute2 method specific to Inventor 2010 release?

Vladimir

Raminder Singh

Hi Vladimir,

I've Inventor 2009 and its api also exposes Execute2 method. So it's not specific to 2010.

xxxtomxxx

Hello, I'm using the below code in an activated sketch, yet nothing seems to happen. Are there specific different commands when using SketchProjectCutEdgescmd?


Dim oDef As ControlDefinition

Set oDef = ThisApplication.CommandManager.ControlDefinitions.Item("SketchProjectCutEdgesCmd")

oDef.Execute

Brian Ekins

Here's some code that I've copied from a program I had previously written that does exactly what you're trying to do. I don't remember why I set the SilentOperation property.

' Create a sketch on the work plane.
Dim invSketch As PlanarSketch
Set invSketch = PartCompDef.Sketches.Add(invWorkPlane)

' Call the Project Cut Edges command.
invSketch.Edit

ThisApplication.SilentOperation = True
ThisApplication.CommandManager.ControlDefinitions.Item("SketchProjectCutEdgesCmd").Execute
ThisApplication.SilentOperation = False

invSketch.ExitEdit
ThisApplication.ActiveView.Update

Cristiano

Hi,
Use your example PlacePart with command RenameBrowserNodes and pre-setting Default Option.

How I use the kCommandNameEvent and define in the option?
Call oCommandMgr.PostPrivateEvent(kCommandNameEvent, "Default")

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

RSS Feed

Search