Inventor二次开发入门
更新时间:2023-06-08 01:46:01 阅读量: 实用文档 文档下载
Inventor二次开发入门
Inventor二次开发入门 (1)
课程1:开始接触InventorAPI,用写一个最简单的插件,实现选择集的隐藏 (2)
课程2:帮助了解VisualStudio编程环境以及基本需要熟悉的方面 (12)
课程3:深入解释课程1里出现的InventorAPI相关代码,帮助了解相关对象 (25)
课程4:学习简单的带界面程序,了解其中的逻辑,以及如何操作选择集 (35)
课程5:操作对象的附着属性(Attributes) (45)
课程6:基于前面课程,制作一个更加丰富的插件 (61)
课程7:深入学习的建议 (70)
课程1:开始接触InventorAPI,用写一个最简单的插件,实现选择集的隐藏
在本课中,你将开始写一个使用Autodesk Inventor API基于隐藏所选组件的应用程序。
演示视频(英文)
演示代码
lesson1_vb-net.zip (zip - 49Kb)
lesson1_c-sharp.zip (zip - 73Kb)
根据步骤来创建你的第一个插件
1. Launch the Visual Basic Express development environment:
Open Visual Basic 2010 Express using the Windows Start menu, selecting All
Programs, then Microsoft Visual Studio 2010 Express, and then Microsoft
Visual Basic 2010 Express. Note: You can also use Visual Basic 2008 Express
with this guide. Projects for both 2010 and 2008 are provided.
2. Open a class library project:
Inside Visual Basic Express, on the File menu, click Open Project. Navigate to
the subfolder of the supporting material you downloaded at the top of this guide
called lesson1_VisualExpress2010 and open the project contained within it by selecting the project file MyFirstInventorPlugin_Lesson1.vbproj.
3. Open the code:
In the open project you will see a form with one button (if you don’t see the Form, click on Form1.vb in the Solution Explorer frame in the upper right hand side).
Right click on Form1 in the Solution Explorer and select View Code or just
double click on the Form.
4. Add the code:
In the code window, type the code below into the Sub Button1_Click. (This is what runs when the button is clicked.) You may need to scroll down towards the
bottom of the code to find the place to add the below code, looking for the words ‘Add code for Lesson 1 here’.To get the full experience of developing with Visual Basic Express – including the use of features such as IntelliSense – we recommend you type the code from this guide rather than copying and pasting it.
That said, if constrained for time you can also copy and paste into the Visual Basic Express code window, although this will reduce the experience you gain from working with the code directly.
If _invApp.Documents.Count = 0 Then
MsgBox("Need to open an Assembly document")
Return
End If
If _invApp.ActiveDocument.DocumentType <> _
DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("Need to have an Assembly document active")
Return
End If
Dim asmDoc As AssemblyDocument
asmDoc = _invApp.ActiveDocument
If asmDoc.SelectSet.Count = 0 Then
MsgBox("Need to select a Part or Sub Assembly")
Return
End If
Dim selSet As SelectSet
selSet = asmDoc.SelectSet
Try
Dim compOcc As ComponentOccurrence
Dim obj As Object
For Each obj In selSet
compOcc = obj
Debug.Print()
compOcc.Visible = False
Next
Catch ex As Exception
MsgBox("Is the selected item a Component?")
MsgBox(ex.ToString())
Return
End Try
5. Save the file:
On the File menu, click Save All.
6. Build the project:
The code you have written is in human readable form. To make the code readable by a computer, yo u will need to translate it or “build” it.
Inside Visual Basic Express, in the Debug menu, click Build Solution to compile and build your plug-in. The “Build Success” message shows in status bar of the Visual Basic Express window if the code is successfully built.
That’s it! You have just written your first plug-in for Autodesk Inventor. Let’s run the plug-in to see what it does.
Running the Plug-in
1. Start Autodesk Inventor. (Note: When the plug-in is run it will start a new session of
Inventor if one is not already open.)
2. Create or open an existing Inventor assembly:
Either unzip the file Clutch_Bell_Simplified.zip, and open the
Clutch_Bell_Simplified.iam assembly or within Inventor make sure you have an
assembly of your choosing active. There are several types of document that can
be created or worked with inside Inventor. The most commonly used document
types are Part (.ipt), Assembly (.iam) and Drawing (.idw). Open a new assembly
and place some parts using the standard Inventor user-interface.
3. Run your plug-in with Inventor and allow the plug-in to communicate with
Inventor:
To make Visual Basic Express execute the code you have entered, select Start Debugging on the Debug menu (you can use the F5 key or click on the green arrow –which looks like a “play” button – on the Debugging toolbar). This will cause your form to be displayed. You may need to minimize VB Express to see both the form and Inventor.
正在阅读:
Inventor二次开发入门06-08
乡镇2021年工作谋划参考文本08-16
2013年文献检索上机检实习题03-29
2017年春幼儿园大班班务计划09-14
设备运行维护技术试卷A09-23
毕业设计水杯连柄底塑料座模具设计05-18
学习青年大学习第七期2022年个人心得收获精选多篇05-09
关于深入开展矿井防治水专项整治工作的决定03-16
环境内分泌干扰物研究进展08-09
- 教学能力大赛决赛获奖-教学实施报告-(完整图文版)
- 互联网+数据中心行业分析报告
- 2017上海杨浦区高三一模数学试题及答案
- 招商部差旅接待管理制度(4-25)
- 学生游玩安全注意事项
- 学生信息管理系统(文档模板供参考)
- 叉车门架有限元分析及系统设计
- 2014帮助残疾人志愿者服务情况记录
- 叶绿体中色素的提取和分离实验
- 中国食物成分表2020年最新权威完整改进版
- 推动国土资源领域生态文明建设
- 给水管道冲洗和消毒记录
- 计算机软件专业自我评价
- 高中数学必修1-5知识点归纳
- 2018-2022年中国第五代移动通信技术(5G)产业深度分析及发展前景研究报告发展趋势(目录)
- 生产车间巡查制度
- 2018版中国光热发电行业深度研究报告目录
- (通用)2019年中考数学总复习 第一章 第四节 数的开方与二次根式课件
- 2017_2018学年高中语文第二单元第4课说数课件粤教版
- 上市新药Lumateperone(卢美哌隆)合成检索总结报告
- Inventor
- 入门
- 开发
- 模拟电路2008试卷 (DEMO)
- 企业级云计算平台产品白皮书
- 基于SolidWorks2008的机构运动仿真
- 人事争议仲裁应诉答辩书1
- 2014年八年级上册物理竞赛试卷
- 中文全文数据库检索及网上中文医药学信息资源介绍1
- 猪人工授精新技术
- 世界的物质性(完整版)1
- 仓储与采购管理 期末复习(B)
- 催化燃烧处理有机废气及催化剂中毒的防止
- 5.2 参与旅游环境保护教案
- 新课标人教版三年级下册语文全册教案
- 五年级数学期中复习卷20124
- 电梯供货合同-最终版
- 重钢斜板沉淀池刮泥排泥方式分析与改造
- 全国2009年4月自考电子商务法概论试题及答案
- Join in Book 2 Starter unit Good to see you again Part 1,4
- b南京明城墙滨河地区的整治改造_张杰
- 针对电网中三相apf-statcom谐波、不平衡负载及无功电流的复合控制策略
- 护士爱岗敬业演讲稿——爱心铺就绿色的生命之路