Download presentation
Presentation is loading. Please wait.
Published byHortense Melton Modified over 9 years ago
1
© 2011 Autodesk Porting ObjectARX ® Applications and User Interfaces to AutoCAD ® for Mac ® Asheem Mamoowala Software Engineer, Autodesk
2
© 2011 Autodesk Agenda Introduction Brief History of AutoCAD for Mac Compare Windows and Mac APIs Cross Platform Development Basics Mac User Interface Overview CUI Auto Loader
3
© 2011 Autodesk Introduction
4
© 2011 Autodesk Class Summary This class shows how to completely port your existing Windows®-based ObjectARX applications to AutoCAD for Mac. Watch live coding demonstrations that will show you how to quickly compile your existing ObjectARX code for commands and custom entities on the Apple® Mac with XCode® developer software. Learn to re- create your dialogs and palettes using the Cocoa® framework and how to autoload your applications and CUI files into AutoCAD for Mac.
5
© 2011 Autodesk Learning Objectives At the end of this class, you will be able to: Describe cross-platform coding techniques Port your code to Apple Mac Integrate your commands with AutoCAD for Mac menus and toolbars Develop native Apple user interfaces for AutoCAD for Mac
6
© 2011 Autodesk AutoCAD for Mac
7
© 2011 Autodesk AutoCAD for Mac History AutoCAD supported 10+ platforms up to the early 90s This supported was dropped due to limited users AutoCAD for Mac dropped after 2 releases (R12 and R13) Used cross-platform UI components including DCL Mac support brought back with AutoCAD for Mac released in October 2010, and September 2011 Mac product line includes AutoCAD, AutoCAD LT, and AutoCAD WS
8
© 2011 Autodesk AutoCAD for Mac AutoCAD for Mac is 64-bit only Supports OSX 10.6+ and Intel-based Macs Uses Cocoa framework for UI Not cross-platform
9
© 2011 Autodesk API Comparison APIWindowsMac C++ (ObjectARX) YES Win32 YESPARTIAL MFC/ActiveX/COM YESNO.NET (C#/XAML/WinForms/WPF) YESNO LISP YES DCL YESNO Qt YES Objective-C/Cocoa NOYES
10
© 2011 Autodesk API Comparison On Windows, AutoCAD uses Fibers as an alternative to Threading. Fibers are not available on the Mac CP322-1 Migrating AutoCAD Apps to the Fiberless Environment (AU 2010)
11
© 2011 Autodesk Porting and Development
12
© 2011 Autodesk Cross Platform Development Basics 64-bit Migration required ObjectARX provides polymorphic data types String Handling OSX uses Unicode UTF16 whereas Windows uses UTF8 Conversion required between wchar_t or CString and NSString Careful about Unicode format differences File paths Forward slash supported on all platforms Back slash only on Windows
13
© 2011 Autodesk Porting ObjectARX Code Separate the commands and core logic from Windows-code Share static libs or source files between Windows/MFC DLL and Mac Bundle Use Compiler to address warnings and errors Conflicting types Windows dependencies Compiler differences Templates Unavailable APIs Use polymorphic type Adesk::Int64 and Adesk::Boolean
14
© 2011 Autodesk DEMO
15
© 2011 Autodesk Linking modules for Runtime OSX has a couple different strategies for dynamically linking modules Dependent libraries Loaded together Runtime-loaded libraries Dynamically loaded Requires setting up the Xcode confiugration files correctly Install Name and path Run-path Library search paths correctly Otool –L Tool for inspecting file references inside a compiled module
16
© 2011 Autodesk 16 Linking modules for Runtime
17
© 2011 Autodesk User Interface
18
© 2011 Autodesk User Interface Overview Uses Cocoa framework Follows Apple OSX User Interface guidelines Cocoa has equivalent controls for most MFC/Windows controls Ribbon is replaced by ToolSets Customizable through CUI Contextual Ribbon is replaced by Visor
19
© 2011 Autodesk Objective-C++ Allows mixing C++ and Objective-C in a single source file Use ObjectARX APIs and C++ in the same module Some ObjectARX types conflict with Apple’s Carbon/Cocoa APIs Be careful with.h includes Objective-C++ only works if the.mm file type is used
20
© 2011 Autodesk Cocoa Similar architecture to WPF Uses the Model-View-Controller pattern Stricter than MFC Stray too much and bugs will be harder to fix UI Controls expose delegates as an alternative to sub classing Objects are reference counted and need to be managed correctly
21
© 2011 Autodesk Modal Dialog Use Interface Builder to Layout controls Associate with Action methods in Code Data binding Show a dialog using [NSApp runModalForWindow:] NSWindowController In.mm files you can mix Objective-C with ObjectARX’s C++ APIs
22
© 2011 Autodesk DEMO
23
© 2011 Autodesk Modeless Windows Use NSPanel subclass of NSWIndow AutoCAD Palettes do not use the Cocoa HUD- Style Show a palette using [NSWindowController showWindow:] Use reactor notifications same as you would in MFC Must un-bind elements when closing or unloading the window
24
© 2011 Autodesk CUI and AutoLoader
25
© 2011 Autodesk CUI Supports a subset of the CUI extensibility that Windows does Add Command Macros Includes Icons and Tooltips Add entire ToolSets, or panels to existing ToolSets Add Menus The format of the.CUIx file is shared CUI Command and dialog have been ported partially and can be used to create and edit CUI files
26
© 2011 Autodesk Partial CUI ObjectARX applications can provide a partial CUI for their own Commands Must be installed inside your ARX bundle in MyArx.bundle/Contents/Resources Place reference images in the same folder No Debug tools available for errors when loading Partial CUIs Create entries in the AutoCAD for Mac CUI dialog Extract from the CUI file /Users/ /Library/Application Support/Autodesk/roaming/AutoCAD 2012/R18.2/enu/Support/
27
© 2011 Autodesk Partial CUI Sample
28
© 2011 Autodesk AutoLoader New system for automatically loading 3 rd party ARX applications into AutoCAD Requires Installation of ARX bundles to /Application/Autodesk/ApplicationPlugins/ Inclusion of a PackageContents.xml definition file AutoCAD will auto-load your components ARX applications Partial CUI files LISP files
29
© 2011 Autodesk AutoLoader PackageContents
30
© 2011 Autodesk DEMO
31
© 2011 Autodesk Summary Port Windows ARX application by separating core logic from Windows-specific code Implement Mac UI in Cocoa Use Partial CUI to integrate your application into AutoCAD for Mac Leverage the autoloader feature to deploy and load your ARX application
32
© 2011 Autodesk Links Fiberless Porting : http://au.autodesk.com/?nd=class&session_id=7128http://au.autodesk.com/?nd=class&session_id=7128 Apple Human Interface Guidelines : http://developer.apple.com/library/mac/documentation/UserExperience/Concept ual/AppleHIGuidelines/OSXHIGuidelines.pdf http://developer.apple.com/library/mac/documentation/UserExperience/Concept ual/AppleHIGuidelines/OSXHIGuidelines.pdf Autodesk WikiHelp: http://wikihelp.autodesk.com/AutoCAD_for_Mac/enu/2011/Help/Developer_Doc umentation/Migrating_Windows_Applications http://wikihelp.autodesk.com/AutoCAD_for_Mac/enu/2011/Help/Developer_Doc umentation/Migrating_Windows_Applications ObjectARX for Mac Download: http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=785550 http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=785550
33
© 2011 Autodesk Thank you!
34
© 2011 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. © 2011 Autodesk, Inc. All rights reserved.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.