Inventor-iLogic设计自动化技巧及案例分享教程文件
如何使用Inventor进行产品设计和工程制图的简单方法

如何使用Inventor进行产品设计和工程制图的简单方法第一章:Inventor软件的基本介绍Inventor是由Autodesk公司开发的一款三维计算机辅助设计(CAD)软件,用于产品设计和工程制图。
它提供了一套强大的工具和功能,可帮助设计师和工程师将想法转化为现实,并创建复杂的三维模型和工程图纸。
第二章:创建项目和设置参数在Inventor中开始使用商品设计和工程制图的第一步是创建一个项目。
项目中包含了所有与设计和制图相关的文件和设置。
创建项目时,你需要指定单位、坐标系统和文档模板。
这些参数将决定你在后续设计过程中的测量和绘图单位等。
第三章:创建基本几何体在Inventor中,你可以通过创建基本几何体来构建产品的三维模型。
例如,你可以使用立方体、球体、圆柱体等来创建一个简单的零件模型。
在创建基本几何体时,你可以指定尺寸、位置和旋转角度等参数,以满足设计需求。
第四章:组件建模与装配除了创建基本几何体外,Inventor还支持组件建模和装配。
通过组件建模,你可以创建复杂的零件模型,包括孔、凹陷和凸起等特征。
而装配则允许你将多个零件组装在一起,并确保它们之间的尺寸和位置关系正确。
第五章:应用约束和关系约束和关系在Inventor中起到了非常重要的作用,它们用于确保装配中的零件正确对位和移动。
通过应用约束和关系,你可以轻松地控制零件的位置、旋转和比例关系。
例如,你可以定义两个零件之间的距离、角度或对齐方式。
第六章:绘图和注释在完成三维模型的设计后,你需要将其转化为工程图纸。
Inventor中提供了丰富的绘图工具,可用于创建建筑平面图、剖视图和详图等。
此外,你还可以添加注释、尺寸和标注,以便更清晰地传达设计意图。
第七章:模拟和分析Inventor还提供了模拟和分析功能,可用于评估产品的性能和可靠性。
通过模拟,你可以测试产品在不同条件下的行为,例如强度、刚度、动态响应等。
这些分析结果可以帮助改进设计,减少制造过程中的风险和成本。
Inventor设计自动化功能简介

Inventor设计自动化功能介绍-机械制造论文Inventor设计自动化功能介绍撰文/ 欧特克(中国)软件研发有限公司蔡益江刘静宜“效率”是现代企业一直追求的目标,包括生产效率,设计效率等等。
我们在使用Inventor进行产品设计时,如何提高设计效率,往往是用户很关心的一个话题。
Inventor设计自动化,就是通过使用Inventor既有的i系列功能(iFeature/iPart/iAssembly/iCopy/iLogic)来使我们的设计能够很好的重用,进而提升设计的效率。
CAD 设计软件的选择,使用的方便性和效率非常重要,而设计重用和自动化,是提升设计效率行之有效的手段。
设计的重用,不仅包括了在设计过程中,参数的重用、建模特征和零件的重用,也包括了设计规则的重用。
在Autodesk Inventor 产品中有一系列以字母i 开头的功能,既是Inventor 首字母的缩写,又代表Intelligent,目的就是为了提高设计的重用,让设计过程更加快捷,从而提高用户的设计效率。
一、Inventor i 系列功能Inventor 中的i 系列功能包括iFeature、iPart、iAssembly、iCopy 和iLogic,从不同的级别来解决用户重用设计的需求。
下面我们将从功能和案例相结合的方式来介绍这些功能。
1.iFeatureiFeature 将常用特征提取并保存,便于重复使用;在重用时,用户可以灵活快速地修改其方向、位置和尺寸。
Inventor 的资源中心中,自带了一些常见几何形状的iFeature 文件,如图1 所示,用户也可以将自己定义的特征发布到资源中心,共享给其他用户使用。
钣金零件设计所用的冲压特征(图2),本质上也是iFeature,默认安装在系统的用户目录下(X:\Users\Public\Documents\Autodesk\Inventor 2015\Catalog,Windows 7 系统)。
Inventor API自动化入门:自动化设计流程的起点说明书

Introduction to Inventor API Automation: Where Should You Start?Nathan BowserMechanical DesignerMESA, Inc.Class summary▪Inventor software User▪Little or No programming knowledge▪Interested in learning to automate your design process using the Inventor APIKey learning objectivesAt the end of this class, you will be able to:▪Recognize the importance of learning , and know where to go to gainthat knowledge▪Learn how to capitalize on the Inventor API Help to transfer skills to theInventor API▪Learn how to identify and utilize resources available for advancing yourprogramming knowledge▪Learn how to debug programs directly within the iLogic interface using a debugviewerIntroduction▪Companies are doing more with less▪The need for automation has never been greater ▪Reduce process time▪Eliminate opportunities for errorsSpeaking the LanguageLearning a programming language▪First, and likely largest, hurdle in becoming an Inventor API user▪Multiple language options available▪, VBA, C#, C++▪Which language should you learn?▪ is not the best programming language for every application▪ is the best language for new programmers who want to use the Inventor API▪Simplicity▪English-based Syntax (conversation like)▪Compare the following samples: SampleDim i As IntegerFor i = 0 To 100If i = 7 ThenMessageBox.Show(i)End IfNext C# SampleFor (Int i=0; i<=100; i++) {If (i == 7) {MessageBox.Show(i);}}▪Flexibility▪iLogic is based on the language▪Learning will allow you to program with bothiLogic and the Inventor APIWhere can I learn ▪Microsoft Virtual Academy▪https:///▪Free, Online Training▪By World-Class Experts▪“Visual Basic Fundamentals for Absolute Beginners”▪By Bob TaborBeyond the Programming LanguageLet’s Talk Semantics▪Common question beginners ask“What is the difference between programming in iLogic and programming in the API?”▪Lets compare the two and clarifyApplication Programming Interface What is the Inventor APIResponseRequest Inventor ApplicationProgram InterfaceAPIWhat is iLogic?▪Inventor Add-In▪Included with Inventor▪Based on the Language ▪Utilizes the Inventor API▪Additional functionality built-inAdditional iLogic Functionality▪Pre-existing snippets reduce barriers to entry ▪No need to connect to an Inventor session▪Easily able to work with an open document▪Quick access to parameters and iProperties▪Simple methods for working with ExcelApplication Programming Interface iLogic versus the APIResponseRequestInventor Functions exposed to the APIiLogic ApplicationProgram InterfaceAPIAdvantages of working outside of iLogic▪Visual Studio boasts greater functionality ▪IntelliSense capabilities▪Makes programming faster and easier▪Real time variable monitoring▪See what values are currently contained▪Debugging functionality▪Examine exactly what the program is doing, line-by-lineWhich one is Best for you?▪For new programmers, I recommend…▪iLogic▪iLogic allows new users to begin building workingInventor programs right away▪Program just what you need, when you need it▪iLogic doesn’t have the additional overhead of VisualStudioTransferring Skills to InventorHelp available from Autodesk▪Inventor Programming API Help Documentation ▪Inventor API Object Model▪Contents▪Inventor API User’s Manual▪Provides a look at Inventor ‘Behindthe Curtain’▪Inventor API Reference Manual▪Lists all Objects and Enumerators ▪Sample Programs▪Demonstrate how to implement▪Index▪Lists the Objects and theirMethods and Properties▪Search▪Allows you to search theentirety of the Help file▪Object Name▪Description▪Methods▪Behaviors ▪Properties▪Data▪SamplesHelp available from Autodesk▪Inventor Programming API Help Documentation ▪Inventor API Object ModelInventor API Object Model oSheet.DrawingNotes.LeaderNotes.Item(1)Additional Resources available1.Manufacturing DevBlog▪/manufacturing/inventor/ 2.Mod the Machine▪/3.From the Trenches with Autodesk Inventor▪/4.Autodesk Knowledge Network▪https:///5.Autodesk Inventor Customization Forum▪/...Debugging iLogicWhat is Debugging?Debugging is the process of finding and resolvingdefects that preventcorrect operation ofcomputer software or asystemDebugging iLogic▪No way to implement line-by-line debugging▪We can monitor critical paths and values ▪Using ’s Diagnostics ClassSystem.Diagnostics.Trace.WriteLine(“string")Debugging iLogic▪Debug View▪Monitoring tool availablefrom Microsoft▪Debugging iLogic DemonstrationSummary▪Learning to build Inventor Automations doesn’t happen overnight▪Requires time and dedication▪With the help of these resources you can achieve successHow did I do?▪Your class feedback is critical. Fill out a class survey now.▪Use the AU mobile app or fill out a class survey online.▪Give feedback after each session.▪AU speakers will get feedbackin real-time.▪Your feedback results in betterclasses and a better AU experience.More Questions? Visit the AU Answer Bar ▪Seek answers to all of your technical product questions by visiting the Answer Bar.▪Open daily from 8am-6pm Tuesday and Wednesday;8am-4:30pm Thursday.▪Located outside Hall C, Level 2.▪Meet Autodesk developers, testers,& support engineers ready to helpwith your most challengingtechnical questions.Autodesk is a registered trademark of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing。
Autodesk Inventor 设计自动化指南说明书

AUTODESK INVENTOR Trial ProjectsDesign AutomationDesign a conveyor assemblyIn Inventor, click the ‘Projects’ icon in the ribbon. Navigate to where you saved the project files and select Assembly Convey-or DA.ipj . Then open Assembly Conveyor DA.iam .Access the ‘Design’ tab in the ribbon and click ‘Bolted Connec-tion’, located in the ‘Fasten’ panel.Select ‘Concentric’ from the drop-down for the ‘Placement’.Select the face shown for the ‘Start Plane’.2.4.1.3.Select a ‘Circular’ reference on the yellow bracket for the loca-tion.Choose the back face of the yellow bracket for the fastener ‘Termination’.Define the ‘Thread ‘using an ‘ANSI Metric M Profile’, and then set the ‘Diameter’ to 5mm.Select ‘Click to add a fastener’ in the dialog to select a‘Standard’ and ‘Category’.6.8.5. 7.Filter to ‘ANSI, Socket Head Bolts’, and select the ‘Forged Socket Head Cap Screw - Metric option’.Select ‘Click to add a fastener’ below the screw you just insert-ed, and then insert the ‘Plain Washer (Metric)’ component.Drag the arrow at the end of the fastener preview to define the correct length. Click ‘OK’ on the dialog to create the bolted connection.Click ‘OK’ again the accept the default ‘File Naming’ for the newsubassembly.10.12.9.11.Right-click on the new bolt subassembly and select ‘Copy’ from the marking menu.Right-click in empty space and select ‘Paste’ to insert another in-stance of the component. Note that it’s listed as a subassembly within the feature tree, and not as an original bolted connection.Selecting ‘Constraint’ from the marking menu, create a ‘Mate’ between the front face of the bracket and this face on the washer.Create another ‘Mate’ constrain between the centerline of thescrew and the centerline of the remaining hole.14.16.13.15.Right-click on the original bolt and select ‘Edit’ using ‘DesignAccelerator’.Click to add a fastener beneath the existing washer listing.Insert an instance of the ‘ASME B 18.21.2M’ lock washer to the stack, and then drag it in between the two existing components in the list.Click ‘OK’ to apply the change, and notice how the copiedsubassembly updates to reflect the change as well. 18.20.17.19.Activate the ‘Pattern’ command from the ‘Assemble’ tab in the ribbon. Select both of the bolt subassemblies for the compo-nents to pattern.From the rectangular pattern tab in the dialog, select an edge along the X axis to define the first pattern direction.Choose ‘Measure’ for the distance option, and then select the faces shown. Click ‘OK’ to apply the pattern.Access the ‘Design’ tab in the ribbon and click‘Bolted Connection’ again.22.24.21.23.Define the ‘Placement’ as ‘By hole’.Select the front face of the blue bracket for the ‘Start Plane’,and then click on one of the holes at the bottom of the bracketfor the location.Select the face on the opposite side of the mount for the ‘Termination’ definition.Select ‘Click to add a fastener’ in the dialog.26.28.25.27.Filter to ‘ANSI, Socket Head Bolts’, and select the‘Forged Socket Head Cap Screw - Metric’ option again.Click to add a fastener below the screw, inserting a ‘Plain Washer (metric)’.Add a third fastener to the list, choosing the ‘ASME B18.21.2M’ lock washer, and then drag it in between the screw and plain washer in the list.Select ‘Click to add a fastener’ below the ‘Selected Hole’ listing,and then choose the ‘Hex Nut Metric’ component within the‘ANSI, Nuts’ category.30.32.29.31.Adjust the cap screw length to 30mm.Check ‘Follow pattern’ in the dialog.Click ‘OK’ twice to place an instance at each hole in the pattern, and to accept the default ‘File Naming’. Save your progress to continue.Continue using ‘Design Automation’ to create a shaft connect-ing the motor and the drive pully.34.36.33.35.Activate the ‘Shaft’ command, located in the ‘Power Transmission’ panel on the ‘Design’ tab.Click the eraser icon at the upper-right of the ‘Shaft Compo-nent Generator’ dialog to reset the calculation data, and then click ‘OK’.Zoom into the drive portion of the motor and select the inner cylindrical face for the first ‘Placement’ definition.Select the back face of the drive motor pully for the shaft’s‘Start plane’ definition.38.40.37.39.Select the outer face of the motor cover for the shaft’s orientation definition.If required, use the flip direction button to ensure the shaft is oriented correctly.Double-click an arrow glyph for the first shaft section to enter a specific value of 8mm.Double-click the listing in the dialog to edit the section length.42.44.41.43.Enter a length of 30mm and click ‘OK’.Define the second edge of the shaft section as having‘No feature’.Double-click the next section in the list to edit it, setting a di-ameter of 10mm and a length of 23mm. Keep the default edge definitions as well.Change the section type for the third listing to ‘Cylinder’ andselect ‘Yes’ to confirm.46.48.45.47.Adjust the third section’s diameter, making it 12mm.Drag the arrow glyph to set the length of this section at 48mm.Define a ‘Chamfer’ for the second edge of the section, using the values shown.For the last shaft section, drag both the diameter and length to10mm.50.52.49.51.Define a ‘Chamfer’ for the second edge of the section, using a ‘Distance of 0.5mm’ and an ‘Angle of 45deg’.Access the section features drop-down for the third shaft sec-tion, and then select ‘Add Wrench’ to add some flat spots for the pully key onto.Define the feature at 26mm long and 11mm deep.Click ‘Add Wrench’ again to define a second feature with the same dimensions.54.56.53.55.Drag the blue arrow in the graphics area to rotate the second feature 90deg about the shaft. Click ‘OK’ twice to create the shaft and accept the default ‘File Naming’.Double-click on the shaft to view it clearly, and to confirm itwas created as intended. Save all of your files to finish. 58.57.Autodesk, Autodesk Inventor, and the Autodesk logo are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product offerings and specifications at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document.© 2017 Autodesk, Inc. All rights reserved.。
基于Inventor iLogic的模型快速设计方法

1 I n v e n t o r i Lo g i c概 述
1 . 1 I n v e n t o r i Lo g i c介 绍
连接起来 , 简化繁杂 的步骤 , 提 高 设 计 效 率 。具 体 作 用 过 程 为 将 模 型 中 的参 数 传 递 给 交 互 界 面 , 通 过 自定 义 计 算 将 结果传递给对应的参数 , 利 用 计 算 所得 的参 数 数 据 驱 动 模
( 上 海理 工 大学 机 械 工程 学 院 , 上海 2 0 0 0 9 3 )
摘 要 : 介绍了I n v e n t o r i L o g i c 在 机 械 产 品 设 计 中 的应 用 , 利用 i L o g i c规 则 驱 动 和 编 写 程 序 的 方 法 实现 产 品 模 型 的
第1 6 卷 第5 期
2 01 7 年5 月
软 件 导 刊
S of t wa r e Gui de
Vo1 .1 6 N o. 5
M a y.2 O1 7
基于 I n v e n t o r i L o g i c的模 型 快 速 设 计 方 法
费媛 媛 , 仲 梁 维
驱 动 的方 法 , 结合可视 化交互 界面 , 可 达 到 快 速 生 成 模 型
言, 许 多 三维 造 型软 件 例 如 S o l i d Wo r k s 、 P r o E等 都 提 供 了
VB . NET二 次 开 发 的 AP I 接 口 。此 外 , VB . NE T 可 以 在
的 目的 。 目 前 , 各 种 计 算 机 辅 助 设 计 软 件 如 UG、 S o l i d — Wo r k s 、 P r o E、 I n v e n t o r 等都 可 以对模 型进行参 数化 设计 。 I n v e n t o r 是 Au t o d e s k公 司 研 发 的 一 款 三 维 设 计 软 件 , 其
Inventor高级培训教程

Inventor高级培训教程Inventor是Autodesk公司开发的三维计算机辅助设计软件,广泛应用于机械设备、制造、建筑、机械零部件等领域。
本教程旨在帮助已掌握基本Inventor技能的用户学习更高级的Inventor操作技巧和工具。
第一部分:装配体设计1. 共线约束共线约束用于将两条线或两个点等约束在同一直线上。
在装配体设计中,经常需要借助共线约束来将不同部件或构件之间的轴线或黏连表面对齐。
具体操作步骤为:1.选择第一个需要共线约束的线或点;2.按住Ctrl键再选择共线方向上的第二个线或点;3.在约束工具栏中找到共线约束并点击。
注意:使用共线约束时一定要注意接口的卡合情况,避免出现不合理的约束。
2. 尺寸约束尺寸约束主要用于规定构件的尺寸和形状。
通过对构件的关键点进行标注和测量,实现尺寸和位置的精确控制。
具体操作步骤为:1.选择需要尺寸约束的构件;2.在约束工具栏中找到尺寸约束并点击;3.在构件上选取需要约束的点,输入约束值。
注意:尺寸约束不仅可以用于构件之间的距离和角度的控制,还可以用于孔位、螺纹和倾斜面的定义。
3. 螺栓约束在装配体设计中,螺栓约束是一种非常常见的约束方式。
螺栓约束主要用于将不同的部件之间通过螺栓连接起来,实现固定和旋转的功能。
具体操作步骤为:1.在“注释”中找到螺母螺栓工具;2.在选项卡中选择螺栓约束,并选择需要连接的构件;3.输入螺栓的种类、长度、头部形状和螺纹规格等参数;4.选择正确的安装位置,按下确定键,完成螺栓约束。
注意:螺栓约束需要根据实际情况选择正确的连接模式,避免装配体产生不合理的约束和位移。
第二部分:零件设计1. 零部件装配在零部件设计中,常需要将若干个零部件组装成一个整体。
正确的装配方法可以提高零部件的耐用性和使用寿命。
具体操作步骤为:1.在“装配设计”中找到“约束”命令;2.将构件拖入装配中,并选取约束符号;3.进入关系管理器,检查约束是否正确。
InventoriLogic设计自动化技巧及案例分享

Inventor iLogic设计自动化技巧及案例分享栏目: 知识共享浏览: 1967 添加时间: 2016-07-14 13:56:57Inventor iLogic模块提供了对设计自动化的支持。
本文通过一些具体的案例,结合客户的实际需求,通过使用iLogic中提供的自动化函数、界面的支持以及良好的扩展性对设计实现自动化,从而使我们更方便的重用设计,提高效率。
一、案例一:液压阀块及其装配Inventor自带的iLogic教程中,有一个液压阀块(Manifold Block)的例子,很好地诠释了iLogic的能力和具体应用的方法。
图1 阀块及阀块装配首先,分析这个阀块装配,其核心就是阀块(图1左)。
在阀块的设计中,阀块的尺寸参数,联接类型、油口的孔径类型及尺寸都是设计中需要管理的关键参数。
1.阀块类型(图2、图3)图2 阀块类型1说明:图2中,选择Standard类型时,三个面的油口孔径相同,对应变量参数名分别为:port_b_size,portc_c_size,port_a_size,通过if…End if条件判断和赋值语句(=),完成参数的数值定义。
说明:图3中,选择“Tee”型联接时,三个面的油口都有效;选择Elbow(90°弯头)联接时,下表面的油口(Port_B)开口及螺纹特征被抑制,通过Feature.IsActive()语句实现对特征状况的控制。
图3 阀块类型22.油口位置油口孔径有相应的规格,在Inventor中支持多值列表型变量,用户可以预先定义供用户选值。
当数值较多时,Excel表格是不错的选择,iLogic提供了很强的Excel表格的操作能力,实现在Inventor中按照设计规则完成查询及选值操作(图4)。
图4 多值列表型变量在本例中,采用了第三方嵌入对象的方式,即Excel表格存放在Inventor文件内部。
iLogic 也支持将Excel可以放置在外部,区别就是在iLogic语句中,给出完整的Excel文件的路径(图5)。
ilogic命令用法(全)

iLogic 功能iLogic 使用户可以进行规则驱动的设计,以一种简单的方式捕获和重复使用自己的作品。
使用iLogic 可让设计成为标准化的、自动执行的过程,并可配置虚拟的产品。
iLogic 函数iLogic 将规则作为对象直接嵌入到零件、部件和工程图文档中。
规则可确定并驱动设计的参数和属性值。
通过控制这些值,您可以定义模型的属性、特征和零部件的行为。
知识内容可以直接保存在文档中,就像存储几何设计元素一样。
iLogic 规则可以利用 Autodesk Inventor 中当前可用的自定义参数类型,例如文本、真/假和多值列表。
您可以使用这些参数类型来编写规则,这些规则不仅仅涉及数字型输入值。
Autodesk Inventor“参数”对话框支持这些专用参数,通过高级过滤函数帮助定义、管理和编辑参数的输入值。
iLogic 中的 Automation 函数几乎没有或彻底没有编程经验的设计师和工程师都可以执行iLogic 自动化函数。
使用自动化函数可以执行以下操作:•根据在部件级规则中定义的条件语句,自动搜索iPart 或iAssembly 配置并进行更改。
•从使用条件参数的规则中,激活零件和部件特征或激活部件和装配约束。
•当孔尺寸或杆尺寸发生更改时,自动更新和驱动螺纹规格。
•读取、写入和响应设计文档的材料或外观、零件的质量或体积以及设计参数。
•当模型更改生成新配置后,更新BOM 表信息。
•限制或自动更正用户输入的值,以确保生成的配置是有效的且符合设计规格和标准。
•读取和写入Excel 电子表格文档。
用于消息和输入框的函数可以在规则运行时提供反馈、选项和信息。
使用 iLogic 规则创建的自定义界面使用iLogic 规则将自定义形式直接与零件或部件设计参数关联。
该功能提供了规则驱动设计模板的用户界面。
注:若要下载Visual Basic 2008 Express Edition,请访问Microsoft® 网站。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
I n v e n t o r-i L o g i c设计自动化技巧及案例
分享
Inventor iLogic设计自动化技巧及案例分享
栏目: 知识共享浏览: 1967 添加时间: 2016-07-14 13:56:57
Inventor iLogic模块提供了对设计自动化的支持。
本文通过一些具体的案例,结合客户的实际需求,通过使用iLogic中提供的自动化函数、界面的支持以及良好的扩展性对设计实现自动化,从而使我们更方便的重用设计,提高效率。
一、案例一:液压阀块及其装配
Inventor自带的iLogic教程中,有一个液压阀块(Manifold Block)的例子,很好地诠释了iLogic的能力和具体应用的方法。
图1 阀块及阀块装配
首先,分析这个阀块装配,其核心就是阀块(图1左)。
在阀块的设计中,阀块的尺寸参数,联接类型、油口的孔径类型及尺寸都是设计中需要管理的关键参数。
1.阀块类型(图2、图3)
图2 阀块类型1
说明:图2中,选择Standard类型时,三个面的油口孔径相同,对应变量参数名分别为:port_b_size,portc_c_size,port_a_size,通过if…End if条件判断和赋值语句(=),完成参数的数值定义。
说明:图3中,选择“Tee”型联接时,三个面的油口都有效;选择Elbow (90°弯头)联接时,下表面的油口(Port_B)开口及螺纹特征被抑制,通过Feature.IsActive()语句实现对特征状况的控制。
图3 阀块类型2
2.油口位置
油口孔径有相应的规格,在Inventor中支持多值列表型变量,用户可以预先定义供用户选值。
当数值较多时,Excel表格是不错的选择,iLogic提供了很强的Excel表格的操作能力,实现在Inventor中按照设计规则完成查询及选值操作(图4)。
图4 多值列表型变量
在本例中,采用了第三方嵌入对象的方式,即Excel表格存放在Inventor文件内部。
iLogic也支持将Excel可以放置在外部,区别就是在iLogic语句中,给出完整的Excel文件的路径(图5)。
图5 嵌入表格及表格内容
图6 返回最大值
说明:图6中,MaxOfMany():iLogic提供的一个数学函数,即比较括号内的数值,返回最大值,这里是比较几个油口的孔径,将最大油口孔径值赋给变量port。
GoExcel.FindRow():iLogic提供的Excel查询函数,这里是查询嵌入的表格,从其表单Sheet1,对应的Port_size列,找到数值等于Port的是第几行,将返回数值赋给i。
GoExcel.CurrentRowValue():配合FindRow()返回的行,读取该行中对应变量名的数值,本例中,通过查询表格获得了各个面的油口的位置。
3.属性定义
在实际使用中,用户对设计零件的零件代号有特定的要求,在该例中,当设计为标准型时,“零件代号”从嵌入的Excel表格中查询获得,如果为用户自定义的,“零件代号”设置为“HomeMade”。
图7 iProperties.Value
说明:图7中,iProperties.Value(“Project”,“PartNumber”),对应“Project”(iProperty的项目页面)中“PartNumber”(零件代号)的数值,
从iLogic的iProperty对应的代码和iProperty对应的属性页面,很容易找到其对应关系(图8)。
图8 iLogic属性方法及iProperty页面
4.阀块装配中的iLogic应用
在本例中,大家注意到阀块参数的变化是核心,但是阀块装配中如何直接控制阀块参数呢?之前,我们需要借助链接外部参数的方式(Excel或Inventor文件),而用iLogic方法就变得非常简单。
如图9所示,通过Parameter()函数,我们可以直接将数值赋给装配下的零件的变量,这样就实现了在顶层装配下对底层零部件的控制。
在阀块装配中还有将模型中的属性及参数值返回到Excel表格中的应用,和前面读取Excel表格的例子类似,在此不赘述。
图9 Parameter()函数
二、案例二:用iLogic实现货架设计
我们的一位客户设计商店里的货架(图10),根据用户的要求,规格尺寸(长、宽、高),层数、列数、材料和颜色都不尽相同。
图10 货架产品示意图
(1)在利用iLogic解决货架模型之前,我们首先建立正确的货架模型结构并确定关键的驱动参数。
根据货架的设计,分为三层装配(图11)。
图11 货架的产品结构
(2)基于确定的结构和关键参数创建货架的三维模型。
进行零件模型创建时,首先定义如下关键参数,并且命名以便于后续查找和iLogic应用(图12)。
图12 货架零件的关键参数
(3)进行子部件模型创建时,首先添加约束,确定部件的位置关系;然后创建iLogic规则,定义参数关系和参数传递(图13)。
图13 参数关系
(4)创建总装时,首先放置子部件、零件,并且约束和定位;接下来创建用户参数,来定义关键参数(长、宽、高、层数、列数材料和颜色);使用iLogic语句,实现顶层参数向下游零件的参数传递(图14)。
图14 装配下的参数传递
(5)在本例中,定义了材料和颜色列表变量,在这里,我们使用了iLogic的document函数直接访问InventorAPI,获取到装配中的每一个零部件(For Each…In…),然后将材料和颜色赋值给相应的零部件(图15)。
图15 document函数
(6)创建iLogic用户界面,并添加产品配置关键参数和属性控件。
iLogic提供了界面创建工具,方便用户交互操作。
图16即为根据用户的产品特点,创建的用户参数交互界面。
三、案例三:iLogic在工程图的应用
经常听到用户希望把视图的比例和质量(去除单位)填写到工程图的标题栏内,以前用户必须通过程序调用Inventor的API来实现,而借助iLogic,实现的过程就变得异常简单。
首先我们在工程图的模板中,创建两个自定义属性,比如比例和质量。
图16 iLogic用户交互界面
接下来我们把创建的自定义属性添加到标题栏的定义中(图17)。
图17 iLogic在工程图中的应用
根据iLogic提供的工程图函数和属性函数,把指定的工程视图的比例和质量赋给相应的变量。
图18获取视图名称比例
注意:图18中,ActiveSheet.View().Scale获取当前激活工程图下,指定视图名称的比例。
Round()是Inventor支持的取整函数,这里,是对质量保留3位小数。
InventorVB.DocumentUpdate()常用来当参数变更时,执行更新的操作,类似手工运行管理页面中的“更新”命令。
类似对工程图的操作方法还有很多,比如对放置视图位置的控制、视图高度的控制、图幅、标题栏样式和引出序号等。
四、案例四:使用iLogic导出文件
iLogic支持把Inventor文件导出到常用的格式,比如AutoCAD DWG、DWF、PDF和JPG等。
请看如图19所示打开的工程图文件,我们可以很方便地使用iLogic提供的自动化函数,把它存成其他格式。
图19 iLogic输出文件
注意:Document.SaveAs()是iLogic中提供的文件另存为的函数。
Messagebox.Show()是iLogic提供的信息对话框方式,便于与用户交互。
五、语结
对于用户,iLogic将Inventor在设计重用方面的能力提升到新的高度,归纳如下。
(1)设计规则和模型数据相结合的高效方式。
(2)更强的Excel和模型数据交互操作能力。
(3)对Inventor的支持面广,从文档类型上涵盖了零件、部件和工程图,从功能上覆盖了零部件参数、物理和外观属性和文档属性、特征控制和零部件控制(包括iPart,iAssembly)、BOM属性。
(4)支持规则运行条件定义(Trigger),便于自动化处理。
(5)它采用类似VB的解释型语言,用户易学易上手。
(6)iLogic既可以嵌入在文档内(内部规则)和也可以从外部调用(外部规则),方便灵活。
(7)支持用户自定义UI调用。
(8)对Inventor API的支持,提供了拓展空间。