Upload
delilah-casey
View
222
Download
2
Embed Size (px)
Citation preview
© 2012 Autodesk
Do More With LessETO API’sIshwar NagwaniTechnical Consultant
© 2012 Autodesk
Class Summary In this class you explore how to:
Quickly write mockup UI for ETO AddIns
How to use client graphics and do the interaction
Use Intent events
Add Dimensions smartly
Call Methods from an External DLL
Test application on ETO server using batch process
Tips & Tricks
© 2012 Autodesk
Learning Objectives
At the end of this class, you will be able to:
Create ETO AddIns with UI Use Client Graphics in your designs Use C# and Intent Events effectively Add Dimensions Smartly Call Methods from External DLLs Test your DLLs with ETO server using Batch process
© 2012 Autodesk
Create ETO AddIns with UI
Intent includes a .NET API. You can call it from a custom user interface that you write using .Net languages like VB.NET and C#. The custom user interface can be in-process with the Intent host, or out-of-process using .NET remoting.
© 2012 Autodesk
Client Graphics and Interaction
Client graphics objects were introduced in ETO 5.1, Inventor 2012.
The interaction with client graphics objects has to handled on Inventor side using Selection and Mouse events
© 2012 Autodesk
Using Intent Events• Intent Events and their handlers are used to perform actions
automatically when there are changes to the model. These actions are controlled by rules, and therefore have easy access to all rules in the model at that time. Intent Events are a host-independent feature, i.e., it works the same way in Inventor and AutoCAD.
• For each event, you can define "handler" rules, which tell Intent to perform additional actions at the specified times. The "handler" rules are ordinary Intent methods, which must return a list of "action lists". The "handler" rules can examine the model at the time of the event, can invoke other rules to build part or all of the action lists, and in general can do anything at all. If the handler returns an empty list { }, then nothing happens.
© 2012 Autodesk
Add Dimensions Smartly
Plan View Elevation View
© 2012 Autodesk
Calling Methods from an External DLL
• Intent rules can call public instance or static methods defined in class project.
• The dll .Net version is important for binary compatibility, i.e. It should be 3.5 for ETO 2012 and 4.0 for ETO 2013.
• Intent always looks for dll in “\Design Files” folder of active project, currently the location is not configurable.
• Do not get Inventor Application object in DLL as the Application object returned from standalone ETO and Server are different, pass the %%inventorapplication object as argument to the calling method.
© 2012 Autodesk
Calling Methods from an External DLL Contd…
public Boolean ExportDXF( Inventor.Application invApp, Inventor.DrawingView view, Inventor.PartDocument partDoc, string dxfFileName)
public Boolean ExportDXF( Inventor.InventorServerClass invApp, Inventor.DrawingView view, Inventor.PartDocument partDoc, string dxfFileName)
Example: Method defined in a DLL for standalone & server
© 2012 Autodesk
Test DLL with ETO server using Batch process
Modify LICPATH.LIC file to fetch server license: for e.g. here JEFFERSON is name of server to fetch license from. It could be your computer name for local server.
SERVER JEFFERSON 000000000000USE_SERVER
© 2012 Autodesk
Test DLL with ETO server using Batch process Contd..
<?xml version="1.0" encoding="utf-8"?><IntentServer name="TestBatch" outputDir="c:\temp" trace="true"> <Project name="IvAutoCADBlock" timing="true"> <OpenFile name="TestAssembly.iam"> <Evaluate expression="createDXF" /> </OpenFile> </Project></IntentServer>
Create the XML file as shown below
© 2012 Autodesk
Test DLL with ETO server using Batch process Contd..
The XML created is executed from commandLine using inventoretoserver –b option
© 2012 Autodesk
Test DLL with ETO server using Batch process Contd..
The output XML file after batch process with additional information<?xml version="1.0" encoding="utf-8"?><IntentServer name="TestBatch" outputDir="c:\temp\out" trace="true" machine="BAN4CZ14307KJ" user="nagwani" intent="5.1.322.0" inventor="2012 (Build 160156000, 156)"> <Project name="IvAutoCADBlock" timing="true" start="10/23/2012 2:38:48 PM" end="10/23/2012 2:39:26 PM"> <OpenFile name="TestAssembly.iam"> <Evaluate expression="createDXF" result="True" /> </OpenFile> </Project></IntentServer>
© 2012 Autodesk
Thank You!
© 2012 Autodesk
Autodesk, AutoCAD* [*if/when mentioned in the pertinent material, followed by an alphabetical list of all other trademarks mentioned in the material] 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 and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2012 Autodesk, Inc. All rights reserved.