private void button1_Click(object sender, EventArgs e) { if (_invApp.Documents.Count == 0) { // Create an instance of the open file dialog box. OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Inventor assembly (.iam)|*.iam|All Files (*.*)|*.*"; openFileDialog1.FilterIndex = 1; openFileDialog1.Multiselect = false; // Call the ShowDialog method to show the dialog box. DialogResult dialogResult = openFileDialog1.ShowDialog(); // Process input if the user clicked OK. if (dialogResult == DialogResult.OK) { _invApp.Documents.Open(openFileDialog1.FileName); } else { _invApp.Documents.Open("D:\\Workspace\\AutoTurf4_CAD\\Version 4 - Komplet maskine.iam"); } } oUOM = _invApp.ActiveDocument.UnitsOfMeasure; oAsmDoc = (AssemblyDocument)_invApp.ActiveDocument; oAsmCompDef = oAsmDoc.ComponentDefinition; //Change to master version for massproperties and joints repman = oAsmCompDef.RepresentationsManager; lod_master = repman.LevelOfDetailRepresentations["Master"]; lod_simple = repman.LevelOfDetailRepresentations["Collision"]; lod_master.Activate(); robot = new Robot(oAsmDoc.DisplayName, oAsmCompDef); textBox1.Text = oAsmDoc.DisplayName; dataGridView1.AutoGenerateColumns = false; dataGridView2.AutoGenerateColumns = false; dataGridView1.DataSource = robot.Links; dataGridView1.Columns[0].DataPropertyName = "Name"; dataGridView1.Columns[1].DataPropertyName = "Inertial"; dataGridView2.DataSource = robot.Joints; dataGridView2.Columns[0].DataPropertyName = "Name"; dataGridView2.Columns[1].DataPropertyName = "JointType"; dataGridView2.Columns[2].DataPropertyName = "Origin"; dataGridView2.Columns[3].DataPropertyName = "Axis"; dataGridView2.Columns[4].DataPropertyName = "Parent"; dataGridView2.Columns[5].DataPropertyName = "Child"; }
private void button3_Click(object sender, RoutedEventArgs e) { if (_invApp.Documents.Count == 0) { // Create an instance of the open file dialog box. OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Inventor assembly (.iam)|*.iam|All Files (*.*)|*.*"; openFileDialog1.FilterIndex = 1; openFileDialog1.Multiselect = false; // Call the ShowDialog method to show the dialog box. // Process input if the user clicked OK. if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { _invApp.Documents.Open(openFileDialog1.FileName); } else { _invApp.Documents.Open(Properties.Settings.Default.autoload_file); } } oUOM = _invApp.ActiveDocument.UnitsOfMeasure; oAsmDoc = (AssemblyDocument)_invApp.ActiveDocument; oAsmCompDef = oAsmDoc.ComponentDefinition; //Change to master version for massproperties and joints repman = oAsmCompDef.RepresentationsManager; lod_master = repman.LevelOfDetailRepresentations["Master"]; lod_master.Activate(); robot = new Robot(oAsmDoc.DisplayName, oAsmCompDef); if (addbaselinkcheckbox.IsChecked == true) { addbaselink(ref robot, oAsmCompDef); } textBox.Text = oAsmDoc.DisplayName.TrimEnd(".iam".ToCharArray()); dataGridLinks.DataContext = robot.Links; dataGridJoints.DataContext = robot.Joints; dataGridLinks.ItemsSource = robot.Links; dataGridJoints.ItemsSource = robot.Joints; dataGridLinks.Items.Refresh(); dataGridJoints.Items.Refresh(); }
public InventorRepresentationManager(RepresentationsManager representationsManager) { _representationsManager = representationsManager; }