C# Inventor二次开发—002—启动Inventor及零部件创建和打开

一、启动Inventor

Inventor.Application对象是基于COM开发Inventor的出发点,以下是我封装获取Inventor Application方法:

1 1 /// <summary> 2 2 /// 获取InventorApplication对象 3 3 /// </summary> 4 4 /// <returns>InventorApplication对象</returns> 5 5 public static Application GetInventorApp() 6 6 { 7 7 Inventor.Application inventorApp = null; 8 8 try 9 9 { 1010 inventorApp = Marshal.GetActiveObject("Inventor.Application") as Inventor.Application; 1111 } 1212 catch 1313 { 1414 var inventorType = Type.GetTypeFromProgID("Inventor.Application"); 1515 inventorApp = Activator.CreateInstance(inventorType) as Inventor.Application; 1616 inventorApp.Visible = true; 1717 } 1818 return inventorApp; 1919 }

二、创建和打开零件文档

(1)创建零件文档

11 PartDocument partDoc = inventorApp.Documents.Add( 22 DocumentTypeEnum.kPartDocumentObject, 33 inventorApp.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kDefault_DraftingStandard, null), 44 true) as PartDocument;

(2)打开零件文档

1 PartDocument partDoc = (PartDocument)inventorApp.Documents.Open(fileName,true);

三、创建和打开部件文档

(1)创建部件文档

11 AssemblyDocument asmDoc = inventorApp.Documents.Add( 22 DocumentTypeEnum.kAssemblyDocumentObject, 33 inventorApp.FileManager.GetTemplateFile(DocumentTypeEnum.kAssemblyDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kDefault_DraftingStandard, null), 44 true) as AssemblyDocument;

(2)打开部件件文档

1 AssemblyDocument asmDoc = (AssemblyDocument )inventorApp.Documents.Open(fileName,true);
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

一篇文章带你了解JavaScript日期

日期对象允许您使用日期(年、月、日、小时、分钟、秒和毫秒)。一、JavaScript的日期格式一个JavaScript日期可以写为一个字符串:ThuFeb02201909:59:51GMT0800(中国标准时间)或者是一个数字:1486000791164写数字的日期,指定的毫秒数自1970年1月1日00:00:00到现在。1\.显示日期使用

C# Inventor二次开发—002—启动Inventor及零部件创建和打开 - HelloWorld