Weld Bead Report Automation

Weld Bead Report Automation

swalton
Mentor Mentor
370 Views
3 Replies
Message 1 of 4

Weld Bead Report Automation

swalton
Mentor
Mentor

I'm trying to export the Weld Bead Report from a weldment assembly using iLogic or VBA.  My end goal is to get a bead table shown in the 2d drawing.

 

Is anyone able to share a code sample or snippet that calls the export tool? How about ways to configure the excel file?

 

I haven't had much luck finding anything via search. 

 

swalton_0-1734368382668.png

 

Eventually I want to standardize the export file name and location.  The file name will be something like "Model_File_Name Weld Bead Report.xls" and saved in the same directory as Model_File_Name.iam.

 

 

Steve Walton
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Inventor 2025
Vault Professional 2025
0 Likes
371 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi Steve.  I have never seen any built-in method for that within the Inventor API system yet, nor within the uniquely iLogic tools either.  My guess is that the only way to automate it would be though getting the command (ControlDefinition) behind that button in the ribbon (it is named "AssemblyWeldBeadReportCmd"), then executing that command with our code, to simulate clicking that button.  But that will just show the visible user interface dialog, which will be difficult to interact with by code, since it is not API controlled.  Could use SendKeys.SendWait to toggle the checkbox option, and could maybe use PostPrivateEvent to dictate the full file name though.

 

The closest thing I have ever found in the API is the 'WeldInfo' property associated with each 'Weld' and 'WeldBead' object.  That property returns a String value, which contains XML formatted text, with all available info in it...if any.  We get to those Weld & WeldBead objects through the WeldmentComponentDefinition, then its Welds property.  WeldmentComponentDefinition is the sub-type of the regular AssemblyComponentDefinition, when it is a weldment type assembly.  Just like SheetMetalComponentDefinition is the sub-type of a PartComponentDefinition that was created (or converted) as sheet metal.  There is also the WeldsComponentDefinition, under the WeldmentComponentDefinition, but it is not that relevant for this.

 

I do not know of any simple/easy way to 'extract' or use the data contained within those XML formatted text values by code myself, so I might not be much help after that point either.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

swalton
Mentor
Mentor

Wesley,

 

Thanks for the hints.  I found this old page; https://modthemachine.typepad.com/my_weblog/2009/03/running-commands-using-the-api.html

It gave me enough of a code sample to trigger the report command and set the output name.  Next step is to build a string from the current document's filename and some fixed text for the export file.

 

Will the Event Viewer tool be helpful to watch for UI interactions that I could emulate in the code?  Looking at using the SendKeys.SendWait tool to accept the Next button because it is the default.

 

I'll have to instal Visual Studio to use it though...

Steve Walton
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Inventor 2025
Vault Professional 2025
0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

Hi @swalton.  As far as I know, that event watcher would not help you emulate the user interface actions required to finish that specific sequence.  When using SendKeys.SendWait, I usually tell folks to do all actions using only the keyboard, and pay attention to which keys you press, in what order, and how many times you press each key, either on scrap paper, notepad.exe, or something like that.  Then, once you have the exact pattern of keys recorded, use that pattern within the SendWait method.  The main SendKeys page has most of the main inputs listed, but does not show a good collection of examples.  I used something like that for years in a simple VBA macro, which emulated clicking on the Update button (in a drawing, on the Mange tab, in the Styles & Standards panel), then clicking 'Yes to All', then clicking OK.  Not the best way to do things, but sometimes it can be about the only way, if the API is not exposed for it yet.

 

And perhaps most important detail when using SendKeys, is to use a line of code that helps set the 'system focus' on the correct window, so those keystrokes don't get sent to the wrong place.  One of the oldest and simplest method that I used to use is the AppActivate() method, with the 'ThisApplication.Caption' property value within its ().  There are other methods which may be better or more accurate for that task, but they are getting a bit more advanced and unfamiliar.  That line would be used just before the SendKeys line(s).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes