![](/skins/images/22721C4AD6E1AA0F9EAB1A180619AF1C/responsive_peak/images/icon_anonymous_message.png)
Not applicable
11-06-2020
05:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, i am making Add-In in C# with Visual Studio.
I need to execute "PartPromoteCmd" command, but with different settings.
When i click button which executes this command in Inventor, it opens small window with settings.
I need to skip this window, set given settings and execute it without any user interaction at all.
How can i achieve this?
DocumentTypeEnum docType = app.ActiveDocumentType;
CommandManager oCom = app.CommandManager;
ControlDefinitions oConDefs = oCom.ControlDefinitions;
if (docType == DocumentTypeEnum.kAssemblyDocumentObject) {
AssemblyDocument doc = (AssemblyDocument) app.ActiveDocument;
AssemblyComponentDefinition oDoc = doc.ComponentDefinition;
ComponentOccurrences occurrences = oDoc.Occurrences;
var selected = app.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select Component");
if (selected is ComponentOccurrence) {
ComponentOccurrence _selected = (ComponentOccurrence) selected;
// Editing Mode
_selected.Edit();
foreach(ControlDefinition cd in oConDefs) {
if (cd.InternalName == "PartPromoteCmd") {
// here i need to set things ... but how
cd.Execute();
}
}
}
else {
MessageBox.Show("You need to select some Component!");
}
}
Solved! Go to Solution.