<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-10425945</id><updated>2012-01-25T08:56:55.419-02:00</updated><category term='VS 2010'/><category term='AU2006'/><category term='Raptor'/><category term='Tutorial'/><category term='AutoCAD'/><category term='AutoCAD 2009'/><category term='ObjectARX'/><category term='AU2008'/><category term='Autodesk'/><category term='Visual Studio 2005'/><category term='Samples Downloads'/><category term='Custom Entity'/><title type='text'>ObjectARX &amp; Dummies</title><subtitle type='html'>This site was built to allow users to learn about ObjectARX® and AutoCAD® programming.

ObjectARX® and AutoCAD® are trademarks of Autodesk Inc.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>76</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-10425945.post-5494929992299438391</id><published>2011-05-16T10:09:00.000-03:00</published><updated>2011-05-16T10:09:30.155-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Samples Downloads'/><title type='text'>Files moved to Google Docs</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have moved all samples files to a Google Docs folder which can be accessed through the following link:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0By7BVn8vCBxnYjZjNWJhZjYtZjE3MC00ZjdiLTlmMjMtNTVhNTNjNjE0YjUy&amp;amp;hl=en"&gt;ObjectARX &amp;amp; Dummies Docs&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It the above link does not work, copy and paste the following URL at your Browser:&lt;br /&gt;&lt;br /&gt;https://docs.google.com/leaf?id=0By7BVn8vCBxnYjZjNWJhZjYtZjE3MC00ZjdiLTlmMjMtNTVhNTNjNjE0YjUy&amp;amp;hl=en&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-5494929992299438391?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/5494929992299438391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=5494929992299438391' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/5494929992299438391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/5494929992299438391'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2011/05/files-moved-to-google-docs.html' title='Files moved to Google Docs'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-6652284654242399817</id><published>2010-09-15T14:37:00.000-03:00</published><updated>2010-09-15T14:37:20.195-03:00</updated><title type='text'>AutoCAD Mac announced and new Blog about ObjectARX</title><content type='html'>&lt;span style="font-family: Verdana, sans-serif;"&gt;Hello,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Verdana;"&gt;I was really busy lately working behind the scenes with AutoCAD for Mac which was announced last August 31st by Autodesk.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Verdana;"&gt;I have attended this event and I'm totally excited about this new platform and all technology that it brings into the spot of AutoCAD community.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Verdana;"&gt;I have just created a new Blog entirely dedicated to this subject and I'm preparing some great material to share with you as soon as the product starts to ship.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Verdana;"&gt;More information here:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Verdana;"&gt;&lt;a href="http://arxformac.blogspot.com/"&gt;http://arxformac.blogspot.com/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: Verdana;"&gt;Cheers!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-6652284654242399817?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/6652284654242399817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=6652284654242399817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/6652284654242399817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/6652284654242399817'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2010/09/autocad-mac-announced-and-new-blog.html' title='AutoCAD Mac announced and new Blog about ObjectARX'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-7292888977451393151</id><published>2010-04-29T09:04:00.000-03:00</published><updated>2010-04-29T09:04:57.535-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS 2010'/><title type='text'>Visual Studio 2010</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I was playing around with the brand new Visual Studio 2010 and have found a really cool new feature. Actually this is something I'm waiting for years.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: blue;"&gt;The problem&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;Every new Visual Studio version requires you to create a new project and maintain it along the other versions. I had a situation once that I need to keep VS2005, VS2005 and VS2008 projects. What a pain! As soon as you add a new class to your project you need to replicate that to the other versions. It was chaotic!&lt;br /&gt;&lt;br /&gt;&lt;b style="color: blue;"&gt;The new feature&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;VS2010 have introduced a new cool feature called "&lt;i style="color: red;"&gt;&lt;b&gt;Platform Toolset&lt;/b&gt;&lt;/i&gt;". It allows you to target your build using specific VS libraries which allow you to build binaries as if you are using previous VS versions. Natively it comes with v100 and v90 platforms (v100 is the default). I did some testing targeting v90 and it really works. The generated DLL (in my case an ARX module) was totally compatible with the Host application (in this case AutoCAD).&lt;br /&gt;&lt;br /&gt;More than that, with the ability to create your custom targets open a totally new world of VS projects management which will save you hours copying thing to keep your source code updated.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: blue;"&gt;Further reading&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/somasegar/archive/2008/11/21/c-enhancements-in-vs-2010.aspx"&gt;VS 2010 Enhancements&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/vcblog/archive/2009/12/08/c-native-multi-targeting.aspx"&gt;VS 2010 native Multi-targeting&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="color: blue;"&gt;I have used Visual Studio 2010 Professional Trial version to test this and you can download it from here&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.microsoft.com/visualstudio/en-us/download"&gt;Visual Studio 2010 Trial Download&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-7292888977451393151?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/7292888977451393151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=7292888977451393151' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/7292888977451393151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/7292888977451393151'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2010/04/visual-studio-2010.html' title='Visual Studio 2010'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-6324132799216718887</id><published>2009-05-16T13:53:00.005-03:00</published><updated>2009-05-16T14:09:08.119-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Entity'/><category scheme='http://www.blogger.com/atom/ns#' term='AU2008'/><title type='text'>AU2008 Class</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Several people have asked me about some advice on creating custom classes inside ObjectARX.&lt;br /&gt;I have made a detailed tutorial and presented it as a Class last year at Autodesk University.&lt;br /&gt;&lt;br /&gt;There is an online video recording, PPT and PDF of this class at AU2008 website:&lt;br /&gt;&lt;a href="http://au.autodesk.com/@script?nd=class&amp;amp;session_id=3019"&gt;AU2008&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For your convinience, I have also posted a direct link to the PDF:&lt;br /&gt;&lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/AU2008/CP311_5_ThePowerofObjectARX.pdf"&gt;Download&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is the link for related source files:&lt;br /&gt;&lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/AU2008/Projects_Exercise2.zip"&gt;Projects_Exercise2.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Fernando Malard.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-6324132799216718887?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/6324132799216718887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=6324132799216718887' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/6324132799216718887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/6324132799216718887'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2009/05/au2008-class.html' title='AU2008 Class'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-2198101803346323488</id><published>2009-02-11T09:56:00.004-02:00</published><updated>2009-02-11T10:15:53.413-02:00</updated><title type='text'>AutoCAD 2010 announced!</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;AutoCAD 2010 was announced:&lt;br /&gt;&lt;a href="http://finance.yahoo.com/news/Autodesk-Takes-3D-Design-and-prnews-14269988.html"&gt;http://finance.yahoo.com/news/Autodesk-Takes-3D-Design-and-prnews-14269988.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Very exciting new features and better support for .NET programming for customizing entities (I plan to discuss this further soon).&lt;br /&gt;&lt;br /&gt;Meanwhile, you may check these new features through a great collection of videos on the following page:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://heidihewett.blogs.com/files/autocad2010videos.htm"&gt;http://heidihewett.blogs.com/files/autocad2010videos.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-2198101803346323488?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/2198101803346323488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=2198101803346323488' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/2198101803346323488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/2198101803346323488'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2009/02/autocad-2010-announced.html' title='AutoCAD 2010 announced!'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-1896156625589786972</id><published>2008-04-29T16:39:00.001-03:00</published><updated>2008-04-29T16:49:06.975-03:00</updated><title type='text'>AU2008 Voting</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;This year, AU (Autodesk University) classes will be rated by vote.&lt;br /&gt;I have sent 3 classes under the &lt;strong&gt;Customization &amp;amp; Programming&lt;/strong&gt; Power Track.&lt;br /&gt;If you plan to attend AU2008 and would like to see one of my classes please take some time to vote through the following link:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://www.surveymonkey.com/s.aspx?sm=Yy_2fqK2TzVXoIf7d0TuRulw_3d_3d"&gt;AU2008 Voting&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My classes are:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;1) The Power of ObjectARX® - The Lab – AutoCAD – Level: Advanced&lt;br /&gt;&lt;br /&gt;2) The Power of ObjectARX® - The Class – AutoCAD – Level: Intermediate&lt;br /&gt;&lt;br /&gt;3) Creating Your Own Vertical Application Through AutoCAD® OEM – AutoCAD – Level: Intermediate&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Hope these classes are approved and I hope you are able to attend this year!&lt;br /&gt;Regards,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-1896156625589786972?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/1896156625589786972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=1896156625589786972' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/1896156625589786972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/1896156625589786972'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2008/04/au2008-voting.html' title='AU2008 Voting'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-8933771476885184275</id><published>2008-03-27T09:43:00.000-03:00</published><updated>2008-03-27T10:40:26.314-03:00</updated><title type='text'>Version Control</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Probably you will need or already need some version controlling on your software or on its modules.&lt;br /&gt;This is made through the &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;VS_VERSION_INFO&lt;/strong&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; resource inside &lt;strong&gt;C++&lt;/strong&gt; projects and through &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;AssemblyInfo.cs&lt;/span&gt;&lt;/strong&gt; file inside &lt;strong&gt;C#&lt;/strong&gt; projects.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have found an old but up to date tool (&lt;strong&gt;runs from VS2002 to VS2008&lt;/strong&gt;) which allows you to easily manage these version informations. This tool, from &lt;a href="http://www.codeproject.com/script/Membership/Profiles.aspx?mid=820347"&gt;Julijan Sribar&lt;/a&gt;, is an AddIn which tracks all opened projects and allow you to manage each version information. This tool is provided for free and its source code is also available for download: &lt;a href="http://www.codeproject.com/KB/macros/versioningcontrolledbuild.aspx"&gt;Versioning Controlled Build&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Another issue is how to get this information at runtime to display, for instance, this version at an "&lt;strong&gt;&lt;em&gt;About&lt;/em&gt;&lt;/strong&gt;" like dialog inside your product. To do that in VC++ we need to read the VS_VERSION_INFO resource and get what we want. There is also another great article &lt;a href="http://www.codeproject.com/KB/cpp/GetLocalVersionInfos.aspx"&gt;Retrieving version information from your local application's resource&lt;/a&gt;, from &lt;a href="http://www.codeproject.com/script/Membership/Profiles.aspx?mid=553157"&gt;luetz&lt;/a&gt;,explaining how to do that.&lt;br /&gt;&lt;br /&gt;Through C# there is no big deal, you can read the version information from AssemblyInfo as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;System.Reflection.Assembly oAssembly = System.Reflection.Assembly.GetExecutingAssembly(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;System.Diagnostics.FileVersionInfo oFileVersionInfo = FileVersionInfo.GetVersionInfo(oAssembly.Location) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#3333ff;"&gt;MessageBox.Show("Version Info", oFileVersionInfo.ProductVersion);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope this help you to keep your file versions organized and updated!&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-8933771476885184275?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/8933771476885184275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=8933771476885184275' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/8933771476885184275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/8933771476885184275'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2008/03/version-control.html' title='Version Control'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-8722533248955565789</id><published>2008-03-25T00:06:00.000-03:00</published><updated>2008-03-25T00:16:42.444-03:00</updated><title type='text'>Blog Classes content update</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have updated and fixed some classes sample code that are not UNICODE aware that will not compile inside VS2005 (ObjectARX 2007, 2008 and 2009).&lt;br /&gt;&lt;br /&gt;Basically, I have changed:&lt;br /&gt;&lt;br /&gt;- Add &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;_T()&lt;/span&gt;&lt;/strong&gt; macro to all strings;&lt;br /&gt;- Changed strcpy() to &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;_tcscpy()&lt;/span&gt;&lt;/strong&gt; which is UNICODE aware;&lt;br /&gt;- Changed char* to &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;TCHAR*&lt;/span&gt;&lt;/strong&gt; or to &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;ACHAR*&lt;/span&gt;&lt;/strong&gt; pointers;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Important&lt;/span&gt;&lt;/strong&gt;: &lt;em&gt;ACHAR is a typedef present inside "AdAChar.h" ObjectARX header. If you are trying to compile for non-UNICODE ObjectARX versions replace ACHAR* by TCHAR* (or char*) and you should get out of compilation errors.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-8722533248955565789?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/8722533248955565789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=8722533248955565789' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/8722533248955565789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/8722533248955565789'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2008/03/blog-classes-content-update.html' title='Blog Classes content update'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-1459108058477114992</id><published>2008-03-19T00:39:00.000-03:00</published><updated>2008-03-19T00:43:09.935-03:00</updated><title type='text'>VS2005 Samples</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have updated some VS2002 samples to VS2005.&lt;br /&gt;There are two new files, ending with "VC8" which are the VS2005 converted solution/projects.&lt;br /&gt;&lt;br /&gt;You can download these projects from here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/VS2005/"&gt;VS2005 Samples&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These should compile fine with ObjectARX 2007, 2008 and 2009.&lt;br /&gt;Note that if you plan to be 100% compatible with these 3 releases you will need to use the 2007 version of ObjectARX SDK.&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-1459108058477114992?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/1459108058477114992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=1459108058477114992' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/1459108058477114992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/1459108058477114992'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2008/03/vs2005-samples.html' title='VS2005 Samples'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-5123478661293873760</id><published>2008-02-13T08:10:00.000-02:00</published><updated>2008-02-13T08:22:01.483-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Raptor'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2005'/><category scheme='http://www.blogger.com/atom/ns#' term='Autodesk'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD 2009'/><title type='text'>AutoCAD 2009</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Yesterday, February 12th, &lt;strong&gt;Autodesk&lt;/strong&gt; has officially announced its &lt;strong&gt;2009 product line&lt;/strong&gt;.&lt;br /&gt;Read more about here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.worldpressdays08.com/pages/page.cfm?action=products&amp;amp;sub1=1"&gt;http://www.worldpressdays08.com/pages/page.cfm?action=products&amp;amp;sub1=1&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;AutoCAD 2009&lt;/strong&gt; (codename &lt;strong&gt;Raptor&lt;/strong&gt;) will implement several new features like these major ones:&lt;br /&gt;&lt;br /&gt;- View Cube (easy 3D view);&lt;br /&gt;- Steering Wheel (easy 3D navigation);&lt;br /&gt;- Office like Ribbon interface;&lt;br /&gt;- Menu Browser;&lt;br /&gt;- Action recorder;&lt;br /&gt;- Geographic location;&lt;br /&gt;- Modeless Layer manager (works now like a toolpallete);&lt;br /&gt;&lt;br /&gt;There are much more and you may find these detailed features soon at Autodesk website.&lt;br /&gt;&lt;br /&gt;My friend, Shaan Hurley, have a more detailed list at his Blog:&lt;br /&gt;&lt;a href="http://autodesk.blogs.com/between_the_lines/2008/02/the-2009-produc.html"&gt;http://autodesk.blogs.com/between_the_lines/2008/02/the-2009-produc.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Regarding to programming aspects, &lt;strong&gt;AutoCAD 2009&lt;/strong&gt; is backward compatible with 2007 and 2008. This way an application compiled with &lt;strong&gt;ObjectARX 2007&lt;/strong&gt; will be able to run inside all these 3 versions.&lt;br /&gt;&lt;br /&gt;Actually, AutoCAD 2009 was built using &lt;strong&gt;VS2005 Service Pack 1&lt;/strong&gt; but if you plan to keep your project backward compatible it is recommended to &lt;strong&gt;use VS2005 without Service Pack&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Probably the next version of AutoCAD will break the binary compatibility with 2007,2008 and 2009 and will use &lt;strong&gt;VS2008&lt;/strong&gt;. Autodesk seems to be aligned with Microsoft Visual Studio evolution and will try to make only binary compatibility break on every 3 releases.&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-5123478661293873760?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/5123478661293873760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=5123478661293873760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/5123478661293873760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/5123478661293873760'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2008/02/autocad-2009.html' title='AutoCAD 2009'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-517808291038827442</id><published>2008-01-14T23:34:00.000-02:00</published><updated>2008-01-14T23:37:04.365-02:00</updated><title type='text'>AutoCAD GUI tests</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I would like to introduce a new Blog this year. It will be about AutoCAD Applications GUI tests. The idea behind this Blog is to discuss methods and tools that could be used to test all types of AutoCAD applications against AutoCAD interface to reach a better test experience approaching the real user environment.&lt;br /&gt;&lt;br /&gt;If you are interested on discuss this I would like to invite you to visit my new Blog at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://acadguitest.blogspot.com/"&gt;http://acadguitest.blogspot.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-517808291038827442?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/517808291038827442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=517808291038827442' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/517808291038827442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/517808291038827442'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2008/01/autocad-gui-tests.html' title='AutoCAD GUI tests'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-5111354339524991078</id><published>2007-12-04T08:51:00.000-02:00</published><updated>2007-12-04T08:59:56.235-02:00</updated><title type='text'>AU2007 was huge!</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;AU2007 was really huge. The initial estimations are around 10.000 attendees.&lt;br /&gt;What can we expect for AU2008 ? 15.000 ???&lt;br /&gt;&lt;br /&gt;I will post on the next days my two courses materials but as one of my classes was recorded here is the link for the presentation (you will need to register to AU Online to be able to see the video):&lt;br /&gt;&lt;br /&gt;&lt;a href="http://autodesk.mediasite.com/autodesk/autologinform/?peid=7a7838a8-1bc6-4d68-8b03-3158b14c023f"&gt;http://autodesk.mediasite.com/autodesk/autologinform/?peid=7a7838a8-1bc6-4d68-8b03-3158b14c023f&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best Regards.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-5111354339524991078?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/5111354339524991078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=5111354339524991078' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/5111354339524991078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/5111354339524991078'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/12/au2007-was-huge.html' title='AU2007 was huge!'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-3665479936362988372</id><published>2007-10-22T23:52:00.000-02:00</published><updated>2007-10-22T23:53:41.710-02:00</updated><title type='text'>AutoCAD next version ?</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;We are approaching the end of 2007 and if Autodesk keep its policy with annual releases of AutoCAD we will probably have soon the next release which would be 2009.&lt;br /&gt;&lt;br /&gt;I would like to ask you what do you expect as new features of this upcoming release. Please add your comments to this post and soon we will see what's new from the next AutoCAD.&lt;br /&gt;&lt;br /&gt;Meanwhile, cross your fingers and wait for the official announcement.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-3665479936362988372?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/3665479936362988372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=3665479936362988372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/3665479936362988372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/3665479936362988372'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/10/autocad-next-version.html' title='AutoCAD next version ?'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-7367972145213396287</id><published>2007-08-28T18:03:00.000-03:00</published><updated>2007-08-28T18:12:06.909-03:00</updated><title type='text'>AU2007</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;For those who will have the opportunity to participate on this year's Autodesk University at Las Vegas I would like to suggest my two classes:&lt;br /&gt;&lt;br /&gt;&lt;a&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;CP401-2&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;The Power of ObjectARX®&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;CP405-1&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;Creating Your Own Vertical Application Through AutoCAD® OEM&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Registration:&lt;br /&gt;&lt;a href="http://au.autodesk.com/2007/register/"&gt;http://au.autodesk.com/2007/register/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope to meet you in Vegas this year!&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-7367972145213396287?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/7367972145213396287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=7367972145213396287' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/7367972145213396287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/7367972145213396287'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/08/au2007.html' title='AU2007'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-8989915617327276160</id><published>2007-05-30T10:42:00.000-03:00</published><updated>2007-05-30T10:45:24.809-03:00</updated><title type='text'>AUGI Brazil</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I would like to invite all Portuguese speaking world to visit the brand new &lt;strong&gt;AUGI Brasil&lt;/strong&gt; website.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;AUGI Br&lt;/strong&gt; was officially launched today (&lt;strong&gt;30/05/2007&lt;/strong&gt;) which is the same day &lt;strong&gt;AutoCAD 2008&lt;/strong&gt; is being officially announced here in Brazil.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.augibr.com"&gt;http://www.augibr.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Congratulations!&lt;br /&gt;&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-8989915617327276160?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/8989915617327276160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=8989915617327276160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/8989915617327276160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/8989915617327276160'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/05/augi-brazil.html' title='AUGI Brazil'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-4254726203736162258</id><published>2007-03-06T10:57:00.000-03:00</published><updated>2007-03-06T11:01:26.575-03:00</updated><title type='text'>Debug AutoCAD 2007 from VS2005 on Windows Vista</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;After some research I have tried to &lt;strong&gt;Debug AutoCAD 2007&lt;/strong&gt; again but this time starting the Visual Studio 2005 with "&lt;strong&gt;Run as Administrator&lt;/strong&gt;" feature. Now I'm able to Debug AutoCAD 2007 from &lt;strong&gt;VS2005&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;More tips to come as soon as I figure out them... :)&lt;br /&gt;&lt;br /&gt;If you have discovered something else, please share with this Blog!&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-4254726203736162258?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/4254726203736162258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=4254726203736162258' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/4254726203736162258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/4254726203736162258'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/03/debug-autocad-2007-from-vs2005-on.html' title='Debug AutoCAD 2007 from VS2005 on Windows Vista'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-3971393421905881191</id><published>2007-03-06T08:25:00.000-03:00</published><updated>2007-03-06T10:43:43.010-03:00</updated><title type='text'>ObjectARX &amp; Windows Vista</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have migrated to &lt;strong&gt;Windows Vista Ultimate&lt;/strong&gt; and would like to share some problems / workaround I have made so far.&lt;br /&gt;&lt;br /&gt;The first issue you will face is related to &lt;strong&gt;Visual Studio&lt;/strong&gt;. Windows Vista supports partially (&lt;a href="http://go.microsoft.com/?linkid=5728666"&gt;VS2005&lt;/a&gt;) and do not natively support previous versions. As I have several projects running on &lt;strong&gt;AutoCAD 2005 and 2006&lt;/strong&gt; (they require &lt;strong&gt;VS2002&lt;/strong&gt; to compile) I need a way to run then from inside Windows Vista. I have then remembered the good old &lt;strong&gt;Microsoft Virtual PC&lt;/strong&gt; which is now free and has a new release 2007.&lt;br /&gt;&lt;br /&gt;I have downloaded and installed (&lt;a href="http://www.microsoft.com/windows/products/winfamily/virtualpc/default.mspx"&gt;Virtual PC 2007&lt;/a&gt;). After that I have then created a new virtual machine with &lt;strong&gt;Windows XP PRO SP2&lt;/strong&gt; and then installed &lt;strong&gt;AutoCAD 2005&lt;/strong&gt;, &lt;strong&gt;2006&lt;/strong&gt; and &lt;strong&gt;VS2002&lt;/strong&gt;. Of course my machine helps a lot because it runs an &lt;strong&gt;Intel Core 2 Duo&lt;/strong&gt; processor and has &lt;strong&gt;2Gb RAM&lt;/strong&gt;. The &lt;strong&gt;Virtual PC 2007&lt;/strong&gt; runs well but it causes some erratic mouse moves and some small locks. Unsatisfied with that I then go to the Google and find out a great tip about how to improve &lt;strong&gt;Virtual PC 2007&lt;/strong&gt; performance adding a new parameter to its (&lt;a href="http://codebetter.com/blogs/jeff.lynch/archive/2006/11/28/VPC-2007-Beta_3A00_-Centrino-915-Chipset-Issues.aspx"&gt;XML configuration file&lt;/a&gt;). After changed this it runs fast and without any erractic mouse moves. (Thanks to &lt;strong&gt;&lt;em&gt;Jeff Lynch&lt;/em&gt;&lt;/strong&gt;)&lt;br /&gt;&lt;br /&gt;Regarding to &lt;strong&gt;AutoCAD 2007&lt;/strong&gt; and Windows Vista at the beginning I was unable to run it. As I'm new to Vista I have found a command when you right click on the application "&lt;strong&gt;Run as Administrator&lt;/strong&gt;". This did the trick and now I'm able to open AutoCAD but I'm still unable to &lt;strong&gt;Debug&lt;/strong&gt; or &lt;strong&gt;Attach to Process&lt;/strong&gt; on Vista. This is not the proper solution once Autodesk already told us about some issues related with Vista and will release soon a Service Pack to &lt;strong&gt;AutoCAD 2007&lt;/strong&gt; and &lt;strong&gt;LT 2007&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://autodesk.blogs.com/between_the_lines/2007/02/autocad_and_aut.html"&gt;AutoCAD 2007 and LT 2007&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;AutoCAD 2008&lt;/strong&gt;: It will be released soon and some good information about its integration with Windows Vista can be found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://autodesk.blogs.com/between_the_lines/2007/03/autocad_2008_wi.html"&gt;AutoCAD 2008&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;(Thanks to &lt;strong&gt;&lt;em&gt;Shaan Hurley&lt;/em&gt;&lt;/strong&gt;)&lt;br /&gt;&lt;br /&gt;That's it for now.&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-3971393421905881191?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/3971393421905881191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=3971393421905881191' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/3971393421905881191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/3971393421905881191'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/03/objectarx-windows-vista.html' title='ObjectARX &amp; Windows Vista'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-7722623538505471684</id><published>2007-02-13T23:56:00.000-02:00</published><updated>2007-02-14T00:00:50.596-02:00</updated><title type='text'>AutoCAD 2008 is coming...</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Autodesk has announced the upcoming AutoCAD 2008 version. It will be released on both 32-bit and 64-bit versions. There is no change on dwg file format. Further it will officially support Windows Vista.&lt;br /&gt;&lt;br /&gt;More information will be announced soon from Autodesk. Stay tuned at:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.autodesk.com"&gt;http://www.autodesk.com&lt;/a&gt;&lt;br /&gt;&lt;a href="http://through-the-interface.typepad.com/"&gt;http://through-the-interface.typepad.com/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://autodesk.blogs.com/between_the_lines/"&gt;http://autodesk.blogs.com/between_the_lines/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-7722623538505471684?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/7722623538505471684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=7722623538505471684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/7722623538505471684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/7722623538505471684'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/02/autocad-2008-is-coming.html' title='AutoCAD 2008 is coming...'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116864840219722943</id><published>2007-01-12T22:33:00.001-02:00</published><updated>2007-01-13T00:49:21.238-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AU2006'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectARX'/><title type='text'>Exercise2 - Step6</title><content type='html'>&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Creating a Custom Entity – Exercise 2 – Step 6&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;On this step we will implement a pretty nice feature. Imagine you would like to add a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;hatch filling &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;to your custom entity. We can take advantage of ObjectARX &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;embedded object &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;feature to implement this. There is a class called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbHatch &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;which represents the AutoCAD hatch entity. This class can be used as an embedded object and we can use its &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;worldDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method to draw our own hatch pattern. The first thing you need to do is to add an &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbHatch &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;member to our custom entity’s class. We will also declare the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SetupHatch() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method to setup the hatch properties. To do that, open the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline.h &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file, and place the following lines at the end of class declaration:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;protected:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;AcDbHatch m_Hatch;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;public:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;void SetupHatch();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Further, we will need to add 3 more methods to our entity to handle modifications. The first method will handle all &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;graphic transformations&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The 2 remaining methods will handle the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;STRETCH &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;public:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;virtual Acad::ErrorStatus transformBy(const AcGeMatrix3d &amp; xform);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;virtual Acad::ErrorStatus getStretchPoints(&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;AcGePoint3dArray &amp; stretchPoints) const;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;virtual Acad::ErrorStatus moveStretchPointsAt(&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;const AcDbIntArray &amp; indices, const AcGeVector3d &amp;amp; offset);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Our hatch object needs to be configured. To do this we will place, &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;inside the custom entity’s constructor &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;located at &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline.cpp &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file, the following code (note that this configuration needs to be done only once so the constructor is the better place to put it):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AuPolyline::AuPolyline () : AcDbPolyline ()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setNormal(AcGeVector3d::kZAxis);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setElevation(this-&amp;gt;elevation());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setAssociative(true);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setPatternScale(1.0);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setPatternAngle(45.0);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setHatchStyle(AcDbHatch::kNormal);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.setPattern(AcDbHatch::kPreDefined,_T("LINE"));&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This configuration will set the hatch &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;pattern&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;normal &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;vector, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;elevation&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;scale&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;angle &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;style&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. In this example they are fixed but you may want to create one property for each of these parameters allowing the user to change them at runtime.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now we need to add the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SetupHatch() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method implementation to build the hatch loop according to our polyline boundary. The code will be as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;void AuPolyline::SetupHatch()&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertWriteEnabled();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Remove previous loop&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;for (int l=0; l&amp;lt;m_Hatch.numLoops(); l++)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.removeLoopAt(l);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Insert the updated loop&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint2dArray vertexPts;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGeDoubleArray vertexBulges;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Collect points and bulges&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;for(int i=0; i&amp;lt;numVerts(); i++) {&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint2d pt2d;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;double bulge = 0.0;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;this-&amp;gt;getPointAt(i,pt2d);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;this-&amp;gt;getBulgeAt(i,bulge);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;vertexPts.append(pt2d);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;vertexBulges.append(bulge);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Close the loop&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;vertexPts.append(vertexPts.first());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;vertexBulges.append(vertexBulges.first());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.appendLoop(AcDbHatch::kDefault, vertexPts, vertexBulges);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Refresh hatch&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.evaluateHatch();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;}&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;05-06 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we make sure there is no previous loop inside hatch. At the line range &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;11-18 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we walk through the polyline vertexes and collect its points and bulges (&lt;/span&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;the bulge is the tangent of 1/4 of the included angle for the arc between the selected vertex and the next vertex&lt;/span&gt;&lt;/em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). The collected information will be stored at two dynamic vectors: &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcGePoint3dArray &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcGeDoubleArray&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;20-21 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we close the polyline loop to &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ensure our hatch boundary is closed&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;On line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;22 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we append the arrays to the hatch entity as one loop. The loop can be also a hole into the hatch surface but in this example our loop is &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbHatch::kDefault&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. On line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;24 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we finish the hatch configuration process by calling the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;evaluateHatch() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method which will generate the hatch itself.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;We need to call the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SetupHatch() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method inside some of our methods. The first place is inside the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;dwgInFields()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. Place a call to this method at the end of this method as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::dwgInFields (AcDbDwgFiler *pFiler)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;em&gt;&lt;strong&gt;[ some lines were not displayed for code brevity ]&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Setup hatch&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;SetupHatch();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return (pFiler-&amp;gt;filerStatus ()) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Next, we need to place another call inside &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moveGripPointsAt() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. When user moves some of the GRIP points we need to &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;recalculate the hatch boundary&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. We need to do this only in cases the selected GRIP is not our center point. The change is made on lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;15-18 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;as follows:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::moveGripPointsAt (&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcDbVoidPtrArray &amp;gripAppData,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGeVector3d &amp;amp;offset, const int bitflags)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertWriteEnabled () ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;for (int g=0; g&amp;lt;gripAppData.length(); g++)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Get grip data back and see if it is our 0 Grip&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;int i = (int)gripAppData.at(g);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// If it is our grip, move the entire entity. If not, forward the call&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;if (i == 9999)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;this-&amp;gt;transformBy(offset);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;else&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbCurve::moveGripPointsAt (gripAppData, offset, bitflags);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;SetupHatch();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return (Acad::eOk);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;To make the hatch entity appear as part of our custom entity’s graphics we need to call its &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;worldDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method from inside our entity’s &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;worldDraw()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Adesk::Boolean AuPolyline::worldDraw (AcGiWorldDraw *mode)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;&lt;em&gt;[ some lines were not displayed for code brevity ]&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// =======================================================&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// HATCH&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.worldDraw(mode);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;//------ Returning Adesk::kFalse here will force viewportDraw() call&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return (Adesk::kTrue) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Finally, we need to implement the code for the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3 new methods &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we have added to our custom entity’s class. Open the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline.cpp &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file and add the following methods:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// -------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::transformBy(const AcGeMatrix3d &amp; xform)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus retCode = AcDbPolyline::transformBy (xform) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;m_Hatch.transformBy(xform);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return (retCode) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// -------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::getStretchPoints(AcGePoint3dArray &amp; stretchPoints) const&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbIntArray osnapModes,geomIds;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return this-&amp;gt;getGripPoints(stretchPoints,osnapModes,geomIds) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// -------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::moveStretchPointsAt(&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcDbIntArray &amp; indices,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGeVector3d &amp;amp; offset)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus ret = AcDbPolyline::moveGripPointsAt (indices, offset);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;SetupHatch();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return ret;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;} &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The first method on lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;02-07&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;transformBy()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, is responsible for all entity’s graphic transformations such as &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MOVE&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ROTATE&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SCALE&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, etc. First we forward the call to our base class and then apply the same transformation to the hatch. This way it will follow all transformations applied to our AuPolyline. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The second method on lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;09-13&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;getStretchPoints()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, is responsible to return the points that are enabled to &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;stretch the entity&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. In this case we would like to add all of our polyline vertexes. This method can reuse the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;getGripPoints() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method which returns the same points we want.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The last method on lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;15-22&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moveStretchPointsAt()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, is responsible to apply the stretch transformation over the entity. We will also reuse the existing method &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moveGripPointsAt() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;because it does exactly what we need. Next we just need to call &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SetupHatch() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;again to ensure our hatch is updated with the new boundary resulting from the STRETCH command.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Before test our custom entity, we need to place a call to &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SetupHatch() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;just before to close the entity on its creation stage. Open the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;acrxEntryPoint.cpp &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file, of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project, and locate the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface_MyCommand1() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. See the code below:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;static void AuUserInterface_MyCommand1(void)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;em&gt;&lt;strong&gt;[ some lines were not displayed for code brevity ]&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;pL-&amp;gt;SetupHatch();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;pL-&amp;gt;close();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Build you Solution &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;again. You should get no errors. Open AutoCAD, load your modules (remember, first &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;BDX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and then &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). Fire &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MYCOMMAND1 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command and create one AuPolyline entity. Next test the several features we have implemented. Try to &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;COPY &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;you entity, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MOVE &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;it, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ROTATE &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;it, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;SCALE &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;it and apply a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MIRROR&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. You can also use the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;STRETCH &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command and move the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GRIP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;points to change the entity’s shape. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;entity is derived from &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbPolyline&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, right? So do you expect that a specific polyline commands like &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;PEDIT &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;work with our entity? &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Yes, it works! &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Try to fire the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;PEDIT &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command and select our polyline. It will accept it and will allow you to change the AuPolyline as if it is a native AutoCAD Polyline. You can add new vertexes, remove existing, join new segments and even open the polyline (Figure 19). Great!&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/947370/Figure19.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/147119/Figure19.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 19 – AuPolyline modifications.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Conclusion&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;In this session you have learned how to create a custom entity and add some of the possible features &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ObjectARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;allows. &lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This is really only the tip of the iceberg&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. There are much more you can do using &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ObjectARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;classes and implementing more sophisticated features. I really hope you have enjoyed this session and hope it may help you to make the startup into the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ObjectARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;world.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116864840219722943?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116864840219722943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116864840219722943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864840219722943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864840219722943'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/01/exercise2-step6.html' title='Exercise2 - Step6'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116864837703612725</id><published>2007-01-12T22:33:00.000-02:00</published><updated>2007-01-13T00:48:58.675-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AU2006'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectARX'/><title type='text'>Exercise2 - Step5</title><content type='html'>&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Creating a Custom Entity – Exercise 2 – Step 5&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Sometimes you need to distribute an AutoCAD drawing with custom entities inside. By default, when AutoCAD opens a drawing and find some entity it does not recognize, it protects this entity and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;packs its binary data into a Proxy entity&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The proxy entity &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;protects your object data &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;avoiding unwanted users to manipulate your custom entities.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The proxy entity is merely a dummy entity with a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;fixed graphical representation&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. Several features of your custom entity will not be available once your code is not there to provide these methods. If your drawing is opened by an unadvised user that would be nice if you inform this user about the missing application.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The proxy can contain specific graphics which will be generated with a call to your &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;worldDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method just before AutoCAD close the drawing. The worldDraw() method has a parameter, an &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcGiWorldDraw &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;pointer, that allows you to call a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;regenType() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method to find out if the caller is requesting proxy graphics to your entity. At this time, you can draw a different graphic to make and advertisement of your missing custom entity. The following code shows how to handle the proxy graphics:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// ==================================================================&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// PROXY&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;if (mode-&amp;gt;regenType() == kAcGiSaveWorldDrawForProxy)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Draw dummy text&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;CString strTxt = _T("AU Polyline");&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d ptTxt = GetPolylineCenter();&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;mode-&amp;gt;geometry().text(ptTxt, AcGeVector3d::kZAxis, AcGeVector3d::kXAxis, szRef, 1.0, 0.0, strTxt);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;On this example the proxy graphics will be the standard entity graphic plus a text indicating our class name. You may also add an URL address of your product or company. We will use the center point as this text’s start point.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Unfortunately this solution is not complete for AcDbPolyline derived entities. There is a problem when a polyline needs to generate its proxy graphics and the worldDraw() method &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;is not called&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. To solve this problem we need to add another method, called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;saveAs()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, to our class. This method has the following declaration:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;virtual void saveAs(AcGiWorldDraw * mode, AcDb::SaveType st);&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The implementation of this method is as follows:&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;void AuPolyline::saveAs(AcGiWorldDraw * mode, AcDb::SaveType st)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbPolyline::saveAs (mode, st) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;if ((mode-&amp;gt;regenType() == kAcGiSaveWorldDrawForProxy) &amp;&amp;amp;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;(st == AcDb::kR13Save))&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;this-&amp;gt;worldDraw(mode);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This method first forward the call to our base class and then test if the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;regenType() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and the save type is &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDb::kR13Save&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. If they are, we forward the call to our own &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;worldDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method which will draw the custom entity graphic plus the proxy text message.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;To test this behavior create some &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;entities, save the drawing, close AutoCAD and then open this DWG without loading the application modules. Once the DWG file is opened you will see a proxy warning dialog with some information about the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;missing application &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(Figure 18). &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/22770/Figure18.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/26964/Figure18.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Figure 18 – Proxy Information dialog.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Note on the Figure 18 that our proxy text is displayed and also, at the proxy information dialog, you may find information about the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;missing application&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. This dialog allows users to choose one of the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3 options &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;about how AutoCAD will handle its proxy entities. You can also setup the standard proxy behavior accessing &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Tools &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&amp;gt; &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Options &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&amp;gt; &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Open and Save&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Remember that the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module can be loaded to re-enable the custom entity or you can also send your DBX module along with the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DWG &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file to enable third-party users to see your custom entity with complete information. This way you can provide a full graphical representation without the application interfaces (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module). The third-party users will be able to see it but can’t modify the custom entity.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AutoCAD allows some basic operations over the proxy entity like erase, change layer, change color and transformations. These operations will act basically over its dummy graphical representation (&lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;they will not affect your custom entity’s data except when it is erased&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). It is up to the developer to determine the most adequate flags for each custom entity. This is a compiler-time option and it is defined on the custom entity’s class implementation macro (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ACRX_DXF_DEFINE_MEMBERS&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). This flags can be combined to build a complete configuration. &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Please refer to ObjectARX SDK documentation for further information about proxy flags&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116864837703612725?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116864837703612725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116864837703612725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864837703612725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864837703612725'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/01/exercise2-step5.html' title='Exercise2 - Step5'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116864835409949792</id><published>2007-01-12T22:32:00.000-02:00</published><updated>2007-01-13T00:48:34.475-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AU2006'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectARX'/><title type='text'>Exercise2 - Step4</title><content type='html'>&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Creating a Custom Entity – Exercise 2 – Step 4&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now you will learn how to add &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;OSNAP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;points to your custom entity. If you run the application before this step you will see that our custom entity already shows some Object Snap points by default (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ENDPOINT &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MIDPOINT&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). In this example we want to add a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CENTER &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;object snap to our polyline that will allow users to select the exact &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;center point&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. To provide this, we need to change the standard behavior of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;getOsnapPoints() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. This method has &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;4 signatures &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and 2 of them, containing the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcGeFastTransform &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;parameter, are for future use. We will use the first signature and will handle the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CENTER &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;object snap responding with our center point:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::getOsnapPoints (&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDb::OsnapMode osnapMode,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;int gsSelectionMark,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGePoint3d &amp;pickPoint,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGePoint3d &amp;amp;lastPoint,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGeMatrix3d &amp;viewXform,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3dArray &amp;amp;snapPoints,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbIntArray &amp;geomIds) const&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertReadEnabled () ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;switch(osnapMode)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;case AcDb::kOsModeCen:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;snapPoints.append(GetPolylineCenter());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;break;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;return (AcDbPolyline::getOsnapPoints (osnapMode, gsSelectionMark, pickPoint, lastPoint, viewXform, snapPoints, geomIds)) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This method receives an Array of points where we need to add the center point whenever the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;OSNAP CENTER &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;is requested. On line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;13 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we handle the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CENTER &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;object snap by adding our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;center point &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;to the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;snapPoints &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;array (Figure 17). Even handling this particular object snap this method needs to call the polyline class level. The polyline will handle all other possible object snaps for us.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/169140/Figure17.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/854398/Figure17.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 17 – CENTER object snap.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Note&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This OSNAP solution handles only simple OSNAP types like CENTER, MIDPOINT and ENDPOINT. Complex OSNAP modes like INTERSECTION require other methods implementations and some additional procedures.&lt;/span&gt;&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116864835409949792?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116864835409949792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116864835409949792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864835409949792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864835409949792'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/01/exercise2-step4.html' title='Exercise2 - Step4'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116864828937472114</id><published>2007-01-12T22:31:00.001-02:00</published><updated>2007-01-13T00:48:11.982-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AU2006'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectARX'/><title type='text'>Exercise2 - Step3</title><content type='html'>&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Creating a Custom Entity – Exercise 2 – Step 3&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now you will learn how to add &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GRIP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;points to your entity. In fact, as the default implementation of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;forward the call to its base class you may already noted that its GRIP points are &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;visible and working&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The GRIP point behavior is handled by &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;two methods&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The first method, called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;getGripPoints() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;is responsible for &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;acquiring &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;all GRIP points from your entity. The second, called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moveGripPointsAt()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, is responsible for the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;action &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;fired by each grip.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Each default polyline GRIP action is to move the related vertex. In this example we want to add &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;one extra grip &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;positioned at our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;polygon’s center&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. To do that we first need to create a helper method to calculate this point. We will walk through all polygon points and will sum the coordinates dividing the result by &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;numVerts()&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. This method will not change our entity data so it is recommended to be &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CONST &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and will require only the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;assertReadEnabled() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;call:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d AuPolyline::GetPolylineCenter() const&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertReadEnabled();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d ptC,pti;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;double cx = 0.0, cy = 0.0, cz = 0.0;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;for (int i=0; i&amp;lt;numVerts(); i++)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;this-&amp;gt;getPointAt(i,pti);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cx += pti[X];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cy += pti[Y];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cz += pti[Z];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cx = cx / numVerts();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cy = cy / numVerts();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cz = cz / numVerts();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;ptC.set(cx, cy, cz);&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;return ptC;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;04-15 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;apply the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;center formula &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and at line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;16 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we build the point using cx, cy and cz as the point’s X, Y and Z coordinates respectively.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Next we need to change the default implementation of the both GRIP point methods. First we will redefine the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;getGripPoints() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. This method has &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;2 signatures &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and we will use the new &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbGripData &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method instead of the “old style” method.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This method receives an array of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbGripData &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;pointers. These objects represent the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GRIP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;point information. We need to inform at least the point and an arbitrary data (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;void*&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). This arbitrary data can be used later to get back information from each &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GRIP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;point allowing the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moveGripPointsAt() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method to perform the custom actions:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::getGripPoints (&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbGripDataPtrArray &amp;grips,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const double curViewUnitSize,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const int gripSize,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGeVector3d &amp;amp;curViewDir,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const int bitflags) const&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertReadEnabled () ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbGripData* gpd = new AcDbGripData();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;gpd-&amp;gt;setAppData((void*)9999); // Center Grip code&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;gpd-&amp;gt;setGripPoint(GetPolylineCenter());&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;grips.append(gpd);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbPolyline::getGripPoints (grips, curViewUnitSize, gripSize, curViewDir, bitflags);&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;return (Acad::eOk);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This method will not change our entity’s data so it is also a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CONST &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method and calls &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;assertReadEnabled() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;09-12 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we instantiate an &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbGripData &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;pointer and set its application data (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;9999 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;in this case) and the grip point which is calculated by the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GetPolylineCenter() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. Next, on line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;13 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we forward the call to AcDbPolyline’s grip point method so it is able to add &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;its own GRIP points &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;at last. These GRIP points are those vertexes points we have mentioned before. The next step is to change the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moveGripPointsAt() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method so when the user clicks on this center GRIP it will &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;reflect a custom action&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. In this example, our custom action will &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;move the entire polyline&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The following code shows how to do that:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Acad::ErrorStatus AuPolyline::moveGripPointsAt (&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcDbVoidPtrArray &amp;gripAppData,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const AcGeVector3d &amp;amp;offset,&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;const int bitflags)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertWriteEnabled () ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;for (int g=0; g&amp;lt;gripAppData.length(); g++)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Get grip data back and see if it is our 0 Grip&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;int i = (int)gripAppData.at(g);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// If it is our grip, move the entire entity. If not, forward the call&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;if (i == 9999)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;this-&amp;gt;transformBy(offset);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;else&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbCurve::moveGripPointsAt (gripAppData, offset, bitflags);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;return (Acad::eOk);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This time, our method cannot be &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CONST &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;once we will change our entity’s data. Due that, we need to call &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;assertWriteEnabled() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;at it’s beginning. On line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;07 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we start to inspect the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbVoidPtrArray &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(an array of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;void*&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;) looking for our application data (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;9999&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). This method also receives a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3D vector &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;which represents the transformation being applied to the GRIP. If the GRIP being modified is our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;9999 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we will apply this vector transformation to the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;entire polyline&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. This can be done through the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;transformBy() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method passing the same vector (Figure 16).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/79041/Figure16.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/379296/Figure16.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Figure 16 – Center GRIP in action.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;If the fired &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GRIP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;is not our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;9999 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;code we will forward the call to &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbCurve &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;class (AcDbPolylin’s base class) which will handle it for us. The resulting behavior is when you select a GRIP over the polyline boundary the entity &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;stretches &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and when you select the center GRIP the entity &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;moves&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116864828937472114?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116864828937472114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116864828937472114' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864828937472114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864828937472114'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/01/exercise2-step3.html' title='Exercise2 - Step3'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116864826563648725</id><published>2007-01-12T22:31:00.000-02:00</published><updated>2007-01-13T00:47:45.447-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AU2006'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectARX'/><title type='text'>Exercise2 - Step2</title><content type='html'>&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Creating a Custom Entity – Exercise 2 – Step 2&lt;/span&gt;&lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now after you have created a basic custom entity you will learn how to add custom graphics to it. The custom entity’s graphics is generated primarily by the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;worldDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method and optionally by the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;viewportDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;As this entity’s base class already generates a &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;polyline graphic &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we will add some nice extra graphics to it. Each vertex will receive an &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;index number and an arrow &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;indicating the polyline construction direction (Figure 14). &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;We will use different colors for each graphic type. The index number will use the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;256 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;color code which is the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ByLayer &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;color and the arrows will use a fixed &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;1 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;color code which is &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;red&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. If you change the color of this entity’s layer it will change except on the arrows that will stay red. Further, all arrows will be filled. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/744992/Figure14.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/418219/Figure14.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Figure 14 – Custom Entity with vertex numbers and arrows&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;To create these graphics you will need to use some trigonometric methods. The following code demonstrates what you can reach this:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;Adesk::Boolean AuPolyline::worldDraw (AcGiWorldDraw *mode)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;assertReadEnabled();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Call base class first&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcDbPolyline::worldDraw(mode);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;double szRef = 5.0;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// ================================================================&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// DIRECTION AND VERTEX NUMBERING&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;int signal = 1;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;double ht2 = szRef/4.0;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;for(int i=0; i&amp;lt;numVerts(); i++)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d pti;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;this-&amp;gt;getPointAt(i,pti);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Draw vertex text&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;CString strNum;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;strNum.Format(_T("%d"),i);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d ptTxt = pti + (AcGeVector3d::kXAxis*ht2) + (AcGeVector3d::kYAxis*ht2);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;mode-&amp;gt;subEntityTraits().setColor(256); // ByLayer&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;mode-&amp;gt;geometry().text(ptTxt, AcGeVector3d::kZAxis, AcGeVector3d::kXAxis, ht2, 1.0, 0.0, strNum);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;/ Arrow direction&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d ptj;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;this-&amp;gt;getPointAt(i&amp;lt;(numVerts()-1) ? (i+1) : 0, ptj);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;A&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;cGeVector3d dir = (ptj - pti).normalize();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Side perpendicular vectors&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGeVector3d perp = dir;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;perp.rotateBy(3.141592/2.0,AcGeVector3d::kZAxis);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d pt1 = ptj - (dir*ht2) + (perp*(ht2/4.0));&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d pt2 = ptj - (dir*ht2) - (perp*(ht2/4.0));&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;AcGePoint3d pts[3];&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;pts[0] = ptj;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;pts[1] = pt1;&lt;br /&gt;p&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;ts[2] = pt2;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;// Draw arrow polygon&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;mode-&amp;gt;subEntityTraits().setFillType(kAcGiFillAlways);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;mode-&amp;gt;subEntityTraits().setColor(1); // red&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;mode-&amp;gt;geometry().polygon(3,pts);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;mode-&amp;gt;subEntityTraits().setFillType(kAcGiFillNever);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;color:#3333ff;"&gt;//------ Returning Adesk::kFalse here will force viewportDraw() call&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3333ff;"&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;return (Adesk::kTrue) ;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;On line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;03 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we call the proper assert method which inform what type of access we are executing on this method. As we are not changing any data we need only to &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;READ &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;the entity so we call &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;assertReadEnabled() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method. On line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;05 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we forward up the call to its base class method which will draw the polyline curves. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;06-10 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we initialize some local variables. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Next, from line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;11-39 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we perform a loop on each polyline vertex to draw our custom graphics. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;13-14 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we get the current vertex point. On line range &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;16-20 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we draw the vertex text using the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;text() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;geometry primitive at a point with a small displacement related to the vertex point. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;22-24 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we calculate the end point (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ptj&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;) of each polyline segment and its unitary direction vector (&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;dir&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). Next, on lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;26-33 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we calculate the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3 points &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;which will build an arrow head graphic. The &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;perp &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;vector will allow us to draw each side of the arrow head according to the Figure 15. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;35-38 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we draw the filled arrow head using the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;polygon() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;primitive with &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;color red &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and with the fill type always.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Finally, on line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;41&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, we return &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Adesk::kTrue &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;to avoid the graphics to be made by the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;viewportDraw() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;method.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;These classes we have used, with &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcGe &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;prefix, are part of the AcGe library which contains several &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;utility classes and methods &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;to help us to deal with &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;geometric calculations&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. This really helps a lot once most of these calculations are a little bit complex.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/233570/Figure15.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/236941/Figure15.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 15 – AuPolyline side graphics.&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116864826563648725?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116864826563648725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116864826563648725' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864826563648725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864826563648725'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/01/exercise2-step2.html' title='Exercise2 - Step2'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116864822986956076</id><published>2007-01-12T22:30:00.000-02:00</published><updated>2007-01-13T00:45:06.456-02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AU2006'/><category scheme='http://www.blogger.com/atom/ns#' term='AutoCAD'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectARX'/><title type='text'>Exercise2 - Step1</title><content type='html'>&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#000099;"&gt;Hello,&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#000099;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#000099;"&gt;I will post a sequence of 6 steps of my Exercise 2 provided at last year's AU. It will show you how to create a custom entity inside AutoCAD 2007 using ObjectARX 2007 and Visual Studio 2005.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#000099;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#000099;"&gt;Hope you enjoy these posts!&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Creating a Custom Entity – Exercise 2 – Step 1&lt;/span&gt;&lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You will learn in this exercise how to create a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;simple custom entity&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. I will keep it simple as much as I can to reinforce the basic concepts involved. On the next steps we will improve this custom entity by adding great features step by step.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The first step is to name our entity and choose from which base class it will derive. Remember we have to split our application into two modules, an &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(user interfaces) and a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(the custom entity class itself). These two projects will be placed into the same Visual Studio Solution and the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX module will depend on DBX module&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The names will be:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Solution&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Exercise2 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(Visual Studio will create a &lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Exercise2.sln &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file);&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX Project&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuCustomObjects &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(Visual Studio will create a &lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuCustomObjects.vcproj &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file);&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX Project&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(Visual Studio will create a &lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface.vcproj &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file);&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Open Visual Studio, go to the menu &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;File &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&amp;gt; &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;New Project… &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Open “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Other Project Types&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” node, click on “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Visual Studio Solutions&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” item. It will show a template called “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Blank Solution&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;”. Choose this template and name it as &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Exercise2 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(the location can be any folder you want). Click &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;OK &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;to proceed (Figure 8).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Next, right click the solution icon; select &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Add &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and then &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;New Project…&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, (Figure 9). The dialog, presented on &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Exercise1 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;will appear. Select on the list the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ObjectARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;template and create both &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuCustomObjects &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;modules. &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Remember to choose ARX or DBX project type accordingly&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/457511/Figure8.jpg"&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/457511/Figure8.jpg"&gt;&lt;span style="color:#000000;"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/251837/Figure8.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 8 – Blank Solution project&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Each project location will be created inside the existing solution by default. &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Don’t change this location&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Enable &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MFC &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;option on both projects (don’t need to enable AutoCAD MFC extensions) Enable &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;_DEBUG &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;symbol too. Don’t enable any &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;COM &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;or &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.NET &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;feature in both projects.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Make &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project depend on &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuCustomObjects&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. To do that, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;right click &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project AuUserInterface and select &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Dependencies… &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Then mark AuCustomObjects project on the list. Click &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;OK&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/316528/Figure9.jpg"&gt;&lt;span style="color:#000000;"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/816891/Figure9.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 9 – Creating solution’s projects&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Right click &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;again and select “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Set as Startup Project&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” (it will turn to &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;bold&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;). Now test your solution building it: go to menu &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Build &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&amp;gt; &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Build Solution&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. You should get 2 Builds with 0 errors and (1+3) warnings that are safe to ignore.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The final test at this stage is to load the application inside AutoCAD. Remember our project AuUserInterface &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;depends on &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuCustomObjects so the &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX module needs to be loaded first &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;than the ARX module. The &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;unload process must be done in reverse order&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, AuUserInterface first and then AuCustomObjects. You should get everything working this way.&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Note&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Depending on which type of build you made (&lt;/span&gt;&lt;/em&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Debug &lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;or &lt;/span&gt;&lt;/em&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Release&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;) it is recommended to load both projects with the same compilation type.&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now we have our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module it is time to add our custom entity’s class. In this example, our entity will be derived from &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;which represents the AutoCAD &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;POLYLINE &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;entity. The reason for this option is that our custom entity will behave almost exactly like a polyline but it will add some &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;extra features &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;like vertex numbers, direction symbols, hatch, etc. To add this custom class we will use the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Autodesk Class Explorer &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;tool which is located at ARXWizard’s toolbar. It is the second button like the Firgure 10 shows.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#000000;"&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/797512/Figura10.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/256278/Figura10.jpg" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;br /&gt;Figure 10 – ARXWizard toolbar&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Once you click on this button a dialog bar will appear allowing you to explore all existing classes into your projects. At this time, there are no custom entity classes available. Select our &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module and then &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;right click &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;on it. A pop-up menu will be displayed. Select the “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Add an ObjectDBX Custom Object&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” option (Figure 11).&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/431536/Figure11.jpg"&gt;&lt;span style="color:#000000;"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/699753/Figure11.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 11 – Autodesk Class Explorer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;This wizard has &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3 steps&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. The first step, called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Names &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(Figure 12), allows you to specify all basic custom entity’s features. First, name it as “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;”. Choose as base class the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;class (note you have several other classes available to derive from). Remaining fields will be filled automatically. Press &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Next&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Once you select the polyline as your base class you are saying that your custom entity will behave like a polyline except where you redefine it. This is done through the virtual methods I have mentioned before.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/193624/Figure12.jpg"&gt;&lt;span style="color:#000000;"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/488471/Figure12.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 12 – Custom Object Wizard - Names&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Custom Object Wizard &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;also will help you to implement &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;basic class features&lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. This is done on the second step of this Wizard, called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Protocols&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. Enabling these options will instruct the wizard to add the related virtual methods simplifying the class creation process for you.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Inside this dialog you can specify if your entity participate on &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DWG/DWF &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;protocols, if your entity implements &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;OSNAP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;points, &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;GRIP &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;points and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;viewport &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;dependent graphics and, at last, if it implements curve protocols. In this example we will enable only &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DWG protocol &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and all 3 AcDbEntity protocols which will allow us to implement some basic features (Figure 13).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The third step, called &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Advanced&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, will allow you to add notification and cloning features to your custom entity. In this example we will not use these features. There are many other features you can redefine through a huge set of virtual methods but to keep this example simple we will only implement these ones.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Click &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Finish &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;to create your Custom Entity’s Class. Remember, it will be placed at you &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://photos1.blogger.com/x/blogger/6284/765/640/821748/Figure13.jpg"&gt;&lt;span style="color:#000000;"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/x/blogger/6284/765/320/43717/Figure13.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 13 – Custom Object Wizard - Protocols&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Custom Entity Wizard will create default virtual methods but, in this particular case, our base class &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;does not support all of these methods signatures. If you compile the solution you will get &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;4 error messages &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;exactly due that. For now, we will replace the explicit &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbPolyline:: &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;prefix on these 4 return calls by &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AcDbCurve:: &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;prefix which is the AcDbPolyline base class. Now you should get no errors.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;If you inspect your projects Solution Explorer you will note two new files: &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline.h &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;and &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline.cpp&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. These files, inside your &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module, are responsible to declare and implement your custom entity. Open these two files and walk through the generated code.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Now you need to add a new command, inside your &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;module, to create an instance of your new custom entity. To do that, on the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Solution Explorer&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, right click the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project and click “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Set as Startup Project&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” (project name will turn to bold). Now, click on the first icon of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ARXWizard &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;toolbar (a icon with “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;a&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” text). This button will open the “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ObjectARX Commands&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” dialog box. It has two command lists. &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Right click &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;the first list and select &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;New&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;. A new line will be added to this list with a default command called “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MyCommand1&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;”. Click &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;OK&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;If you open the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;acrxEntryPoint.cpp &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project you will find, inside class &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;CAuUserInterfaceApp&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;, the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuUserInterface_MyCommand1() &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;empty method which will be called when you fire &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MYCOMMAND1 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command inside AutoCAD. Inside this method you will create an instance of your &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;entity.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Remember that your custom entity class implementation is located into the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project. Due that you will need to add (through &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;#include &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;compiler instruction) a reference to the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;AuPolyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;class declaration file. To do that, add the following compiler instruction at the beginning of &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;acrxEntryPoint.cpp &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;file of your ARX module right after &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;#include "resource.h" &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;line:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Lucida Console;font-size:85%;"&gt;#include "..\AuCustomObjects\AuPolyline.h"&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;..\&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” part of this include path goes up one folder level (getting back to the Solution’s root folder) and then goes into the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;DBX &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;project folder. Now you can compile your project and shouldn’t get any errors. Next, open AutoCAD, &lt;/span&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;load first the DBX module and then the ARX module &lt;/span&gt;&lt;/u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(there will be two text messages at AutoCAD command prompt confirming that the both load processes were succeeded. Type your project’s command “&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;MYCOMMAND1&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;” and run a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;ZOOM EXTENTS &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command to see the generated entity. If you also run the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;LIST &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;command and select this entity you will see its detailed information.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The following code will create a &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;10 sided polyline &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;(closed) and will add it to the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Model Space &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Block Table Record.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// - AuUserInterface._MyCommand1 command (do not rename)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;static void AuUserInterface_MyCommand1(void)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// AuPolyline entity&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;AuPolyline* pL = new AuPolyline();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;int nSides = 10;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;double incAngle = 2*3.141592 / nSides;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// Add vertex list&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;for (int i=0; i&amp;lt;nSides; i++)&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pL-&amp;gt;addVertexAt(i,AcGePoint2d(10*cos(i*incAngle),10*sin(i*incAngle)));&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// Set Polyline as closed&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pL-&amp;gt;setClosed(Adesk::kTrue);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// open the proper entity container&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;AcDbBlockTable* pBT = NULL;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;AcDbDatabase* pDB = acdbHostApplicationServices()-&amp;gt;workingDatabase();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pDB-&amp;gt;getSymbolTable(pBT,AcDb::kForRead);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;AcDbBlockTableRecord* pBTR = NULL;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pBT-&amp;gt;getAt(ACDB_MODEL_SPACE, pBTR, AcDb::kForWrite);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pBT-&amp;gt;close();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// now, add the entity to container&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;AcDbObjectId Id;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pBTR-&amp;gt;appendAcDbEntity(Id, pL);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pBTR-&amp;gt;close();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;pL-&amp;gt;close();&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;05-07 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we instantiate the entity and initialize some local variables. Next, on lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;9-10 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we add a list of vertexes to the entity. Line &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;12 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;set the polyline as closed. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;14-19 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we open the AutoCAD database, open the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Block Table &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;container and then get the &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Model Space &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;container. On lines &lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;21-24 &lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;we add our entity do Model Space and then close it and the entity itself.&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Note&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;em&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You cannot delete the entity’s pointer once it is added to AutoCAD database. In this case its management is delegated to AutoCAD and you only need to call the close() method. If you delete this pointer you will cause AutoCAD to crash.&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116864822986956076?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116864822986956076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116864822986956076' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864822986956076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116864822986956076'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2007/01/exercise2-step1.html' title='Exercise2 - Step1'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116618017883101595</id><published>2006-12-15T08:36:00.000-02:00</published><updated>2007-01-08T12:11:26.153-02:00</updated><title type='text'></title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I'm sure you probably have faced a situation where you perform some &lt;strong&gt;heavy calculations&lt;/strong&gt; inside AutoCAD with or without a dialog running. In these cases AutoCAD &lt;strong&gt;may look frozen&lt;/strong&gt; and this may look strange to the user because it may think AutoCAD has really frozen and then the user may &lt;strong&gt;try to close it&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Even if you use a progress bar like AutoCAD status bar if you change the current window and get back to AutoCAD it may look frozen in black/white colors.&lt;br /&gt;&lt;br /&gt;This occurs because the processor focus all its resources into your heavy loop and does not save enough time to both &lt;strong&gt;AutoCAD and your dialog process its own messages&lt;/strong&gt;. These messages will affect several things like, for instance, the dialog graphics update.&lt;br /&gt;&lt;br /&gt;The below function will let AutoCAD do this and you may call it from inside your loop (maybe a &lt;strong&gt;FOR&lt;/strong&gt; or &lt;strong&gt;WHILE&lt;/strong&gt; heavy statements). This way, on each interaction, this function will let AutoCAD process its messages.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;void PumpAcadMessages() &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;&lt;span style="color:#009900;"&gt; // Get AutoCAD application&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; CWinApp* app = acedGetAcadWinApp(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;&lt;span style="color:#009900;"&gt; // Get Main window&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; CWnd* wnd = app-&gt;GetMainWnd();&lt;br /&gt;&lt;span style="color:#009900;"&gt; // dispatch incoming sent messages&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; MSG msg;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; while (::PeekMessage (&amp;msg, wnd-&gt;m_hWnd, 0, 0, PM_NOREMOVE))  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; {   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;&lt;span style="color:#009900;"&gt;   // if can't pump, break&lt;/span&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;   if (!app-&gt;PumpMessage())   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;   {    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;     ::PostQuitMessage(0);    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;     break;   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;   }  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; }  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; LONG lIdle = 0; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;&lt;span style="color:#009900;"&gt; // Now it's time to MFC do the work&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt; while (app-&gt;OnIdle(lIdle++));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;color:#000099;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you also would like to process your dialog messages you just need to change the first two lines and use your dialog's CWnd pointer instead of AutoCAD window's pointer.&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116618017883101595?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116618017883101595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116618017883101595' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116618017883101595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116618017883101595'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/12/hello-im-sure-you-probably-have-faced.html' title=''/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-116612478870194924</id><published>2006-12-14T17:28:00.000-02:00</published><updated>2006-12-14T17:33:09.073-02:00</updated><title type='text'>AU2006 was fantastic!</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Au2006 was amazing. There were almost &lt;strong&gt;7500&lt;/strong&gt; people this year and several classes were provided.&lt;br /&gt;If you would like to check those classes visit &lt;strong&gt;AU Online&lt;/strong&gt; at: &lt;a href="http://www.autodesk.com/auonline"&gt;http://www.autodesk.com/auonline&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I will post some content of my class but I need first to reorganize its topics and pictures.&lt;br /&gt;Stay tuned.&lt;br /&gt;&lt;br /&gt;Cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-116612478870194924?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/116612478870194924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=116612478870194924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116612478870194924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/116612478870194924'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/12/au2006-was-fantastic.html' title='AU2006 was fantastic!'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-115497617963572872</id><published>2006-08-07T15:37:00.000-03:00</published><updated>2006-09-14T08:56:01.046-03:00</updated><title type='text'>AU 2006</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Autodesk University 2006 registration is now open!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.autodeskevents.com/au2006"&gt;AU 2006&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I'm glad to inform you that this year I have been accepted as Speaker. My 1,5 hour class will be about Custom Entities. Class code is CP33-3 and more information can be found here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.autodeskevents.com/au2006/index.cfm?site=design&amp;mainsite=client.detail&amp;amp;eventID=2542&amp;eschedulerID=721&amp;amp;eventoptionID=33092&amp;amp;optiontimeID=35270"&gt;The Power of ObjectARX(R) - CP33-3&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope to meet you in Las Vegas!&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-115497617963572872?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/115497617963572872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=115497617963572872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/115497617963572872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/115497617963572872'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/08/au-2006.html' title='AU 2006'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-115469375758304155</id><published>2006-08-04T09:12:00.000-03:00</published><updated>2006-08-04T09:15:57.673-03:00</updated><title type='text'>Chat Sessions</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have recently added a new button at my Blog to allow &lt;strong&gt;&lt;em&gt;&lt;span style="color:#ff0000;"&gt;chat conversations&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;.&lt;br /&gt;The idea is to schedule some chat sessions with users to discuss specific subjects.&lt;br /&gt;You may start to send me your subject suggestions by e-mail so I can start to create a schedule for the chat sessions.&lt;br /&gt;&lt;br /&gt;As I always did all information at this Blog is free as any other provided tools. The idea is to keep this site alive with &lt;strong&gt;Google ads&lt;/strong&gt; and now with "&lt;strong&gt;Make Donation&lt;/strong&gt;" button.&lt;br /&gt;&lt;br /&gt;Cheers!&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-115469375758304155?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/115469375758304155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=115469375758304155' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/115469375758304155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/115469375758304155'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/08/chat-sessions.html' title='Chat Sessions'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-115218749133650959</id><published>2006-07-06T09:02:00.000-03:00</published><updated>2006-07-06T09:04:51.563-03:00</updated><title type='text'>New Blog about AutoCAD programming</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Finally we have now an Autodesk Blog about ObjectARX/.NET programming!&lt;br /&gt;&lt;br /&gt;Kean Walmsley, Senior Manager of our worldwide DevTech team, has started a blog dedicated to programmers working with Autodesk technologies&lt;br /&gt;&lt;br /&gt;Congratulations to Kean Walmsley.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://through-the-interface.typepad.com"&gt;http://through-the-interface.typepad.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-115218749133650959?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/115218749133650959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=115218749133650959' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/115218749133650959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/115218749133650959'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/07/new-blog-about-autocad-programming.html' title='New Blog about AutoCAD programming'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-114789741411193309</id><published>2006-05-17T16:58:00.000-03:00</published><updated>2006-07-30T10:53:36.206-03:00</updated><title type='text'>Adding your own Status Bar Button</title><content type='html'>&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Hello,&lt;br /&gt;&lt;br /&gt;Sometimes you need to have a quick access to your command mainly when this one is about enable/disable something in your software. Using ObjectARX you can easily add a new button to existing AutoCAD Status Bar.&lt;br /&gt;&lt;br /&gt;To add this new button to AutoCAD Status Bar we need to derive a new class from &lt;strong&gt;AcPane&lt;/strong&gt; and add our desired appearence and behavior. In this example I will show you how to create a simple ON/OFF button.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to Begin&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Create a new ARX project using &lt;strong&gt;ARXWizard&lt;/strong&gt;. Add a new empty file called &lt;strong&gt;MyPane.h&lt;/strong&gt; and use the follwoing code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;#pragma once&lt;br /&gt;#include "AcStatusBar.h"&lt;br /&gt;class MyPane : public AcPane&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;// ----------------------&lt;br /&gt;MyPane(void)&lt;br /&gt;{&lt;br /&gt;this-&gt;SetToolTipText(_T("This is MyPane Button"));&lt;br /&gt;this-&gt;SetText(_T(" MyPane [OFF] "));&lt;br /&gt;this-&gt;SetStyle(ACSB_POPOUT);&lt;br /&gt;enabled = false;&lt;br /&gt;}&lt;br /&gt;// ----------------------&lt;br /&gt;virtual ~MyPane(void) {;}&lt;br /&gt;// ----------------------&lt;br /&gt;virtual void OnLButtonDown(UINT nFlags, CPoint point)&lt;br /&gt;{&lt;br /&gt;AcPane::OnLButtonDown(nFlags,point);&lt;br /&gt;enabled = !enabled;&lt;br /&gt;CString strLabel;&lt;br /&gt;strLabel.Format(_T(" MyPane [%s] "),enabled ? _T("ON") : _T("OFF"));&lt;br /&gt;this-&gt;SetText(strLabel);&lt;br /&gt;this-&gt;SetStyle(enabled ? ACSB_NORMAL : ACSB_POPOUT);&lt;br /&gt;AcApStatusBar* pStatus = acedGetApplicationStatusBar();&lt;br /&gt;if (pStatus) pStatus-&gt;Update();&lt;br /&gt;}&lt;br /&gt;// ----------------------&lt;br /&gt;virtual void OnRButtonDown(UINT nFlags, CPoint point) {;}&lt;br /&gt;// ----------------------&lt;br /&gt;virtual void OnLButtonDblClk(UINT nFlags, CPoint point) {;}&lt;br /&gt;// ----------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;private:&lt;br /&gt;bool enabled;&lt;br /&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this example we are supporting only the &lt;strong&gt;LEFT BUTTON CLICK&lt;/strong&gt; event. Note that you may support other events too. We have added a bool member to handle the switching between ON / OFF states.&lt;br /&gt;&lt;br /&gt;After that we need to add this button when our application starts. Open your &lt;strong&gt;acrxEntryPoint.cpp&lt;/strong&gt; file and add the following include:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;#include "MyPane.h"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, add a &lt;strong&gt;MyPane&lt;/strong&gt; pointer variable as a member of your application class:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;MyPane* pMyPane;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Next, add the following two functions to your application class:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// ----------------------&lt;br /&gt;void AddMyPaneButton()&lt;br /&gt;{&lt;br /&gt;AcApStatusBar* pStatus = acedGetApplicationStatusBar();&lt;br /&gt;if (pStatus) {&lt;br /&gt;pMyPane = new MyPane();&lt;br /&gt;pStatus-&gt;Add(pMyPane);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;// ----------------------&lt;br /&gt;void RemoveMyPaneButton()&lt;br /&gt;{&lt;br /&gt;AcApStatusBar* pStatus = acedGetApplicationStatusBar();&lt;br /&gt;if (pStatus &amp;&amp;amp; pMyPane) pStatus-&gt;Remove(pMyPane);&lt;br /&gt;}&lt;br /&gt;// ----------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Finally, we need to call these two functions from inside the &lt;strong&gt;kInitAppMsg&lt;/strong&gt; and &lt;strong&gt;kUnloadAppMsg&lt;/strong&gt; events:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// ----------------------&lt;br /&gt;virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {&lt;br /&gt;AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;&lt;br /&gt;AddMyPaneButton();&lt;br /&gt;return (retCode) ;&lt;br /&gt;}&lt;br /&gt;// ----------------------&lt;br /&gt;virtual AcRx::AppRetCode On_kUnloadAppMsg (void *pkt) {&lt;br /&gt;AcRx::AppRetCode retCode =AcRxArxApp::On_kUnloadAppMsg (pkt) ;&lt;br /&gt;RemoveMyPaneButton();&lt;br /&gt;return (retCode) ;&lt;br /&gt;}&lt;br /&gt;// ----------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it. Now if you load your ARX application you will see a new Status Bar Button. Try it to switch between ON/OFF. Cool?&lt;br /&gt;&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-114789741411193309?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/114789741411193309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=114789741411193309' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114789741411193309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114789741411193309'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/05/adding-your-own-status-bar-button.html' title='Adding your own Status Bar Button'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-114764891143865796</id><published>2006-05-14T20:17:00.000-03:00</published><updated>2006-05-14T20:21:51.503-03:00</updated><title type='text'>User's Samples and Articles</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have created a section at this Blog dedicated to all users that would like to send some samples and articles they want to share.&lt;br /&gt;&lt;br /&gt;All articles and samples are supported and are responsibility of its authors.&lt;br /&gt;&lt;br /&gt;The first article is from Nikolay N. Poleshchuk, a russian AutoCAD author, about a transparent splash screen.&lt;br /&gt;&lt;br /&gt;Feel free to send me your articles and samples.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-114764891143865796?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/114764891143865796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=114764891143865796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114764891143865796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114764891143865796'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/05/users-samples-and-articles.html' title='User&apos;s Samples and Articles'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-114764823269437639</id><published>2006-05-14T19:58:00.000-03:00</published><updated>2006-05-29T23:38:31.313-03:00</updated><title type='text'>Transparent Splash Screen</title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Transparent Splash Screen As a Modeless Dialog&lt;/span&gt;&lt;/strong&gt;[1]&lt;br /&gt;&lt;br /&gt;We would like the splash screen window automatically disappear e.g. after five seconds period. It would be good if an impatient user could close it by a click in the client area.&lt;br /&gt;Moreover it is interesting for the splash screen to be transparent and we could see the current drawing entities under it. Transparency can be reached by Opacity property of the windows created with Windows Forms.&lt;br /&gt;&lt;br /&gt;Create a new ObjectARX project named Book16 with the preferences as in the prevoius project[2].&lt;br /&gt;&lt;br /&gt;Add book16 LISP function that would be called as ads_book16 C-function defined in acrxEntryPoint.cpp file (see listing 5.34).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Listing 5.34. The ads_book16 function&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// Based on:&lt;br /&gt;// N.Poleshchuk, Chapter 05\Book16\acrxEntryPoint.cpp&lt;br /&gt;// In the book "AutoCAD: Application Development, Tuning and// Customization"&lt;br /&gt;// (BHV-Petersburg Publishing House. Russia, 2006)&lt;br /&gt;// http://poleshchuk.spb.ru/cad/eng.html&lt;br /&gt;//&lt;br /&gt;// ----- ads_book16 symbol (do not rename)&lt;br /&gt;static int ads_book16(void)&lt;br /&gt;{&lt;br /&gt;splash16();&lt;br /&gt;acedRetVoid () ;&lt;br /&gt;return (RSRSLT) ;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;splash16 will be a managed code function. Add to the project Splash16.h and Splash16.cpp files (declaration and body of the splash16 function) and insert #include "Splash16.h" statement at the beginning of the acrxEntryPoint.cpp file.&lt;br /&gt;The Splash16.h file besides splash16 declaration will contain Wform16 class definition for a dialog box. Code for the Splash16.h file is given in listing 5.35.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Listing 5.35. The Splash16.h file&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// Based on:&lt;br /&gt;// N.Poleshchuk, Chapter 05\Book16\Splash16.h&lt;br /&gt;// In the book "AutoCAD: Application Development, Tuning and// Customization"&lt;br /&gt;// (BHV-Petersburg Publishing House. Russia, 2006)&lt;br /&gt;// http://poleshchuk.spb.ru/cad/eng.html&lt;br /&gt;//&lt;br /&gt;#pragma once&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;#using &amp;lt;system.drawing.dll&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;#using &amp;lt;system.windows.forms.dll&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;#include "StdAfx.h"&lt;br /&gt;using namespace System;&lt;br /&gt;using namespace System::Drawing;&lt;br /&gt;using namespace System::Windows::Forms;&lt;br /&gt;&lt;br /&gt;void splash16();&lt;br /&gt;&lt;br /&gt;public __gc class Wform16: public Form&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;Wform16();&lt;br /&gt;protected:&lt;br /&gt;void OnTimerTick(Object *sender, System::EventArgs *ea);&lt;br /&gt;void OnClick(Object *sender, System::EventArgs * ea);&lt;br /&gt;};&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Besides splash16 function prototype the Splash16.h file contains description of a managed class derived from the standard Form class. There are three member functions in the class:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Wform16 — Wform16 class constructor;&lt;/li&gt;&lt;li&gt;OnTimerTick — function handling the timer event (timer signal);&lt;/li&gt;&lt;li&gt;OnClick — function handling the second event (click in the client area of the dialog box).&lt;/li&gt;&lt;/ul&gt;&lt;div align="left"&gt;Splash16.cpp file (shown in listing 5.36) includes all the function implementations.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Listing 5.36. The Splash16.cpp file&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// Based on:&lt;br /&gt;// N.Poleshchuk, Chapter 05\Book16\Splash16.cpp&lt;br /&gt;// In the book "AutoCAD: Application Development, Tuning&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;// and Customization"&lt;br /&gt;// (BHV-Petersburg Publishing House. Russia, 2006)&lt;br /&gt;// http://poleshchuk.spb.ru/cad/eng.html&lt;br /&gt;//&lt;br /&gt;#include "StdAfx.h"&lt;br /&gt;#include "Splash16.h"&lt;br /&gt;&lt;br /&gt;using namespace System::Drawing;&lt;br /&gt;using namespace System::Windows::Forms;&lt;br /&gt;using namespace Autodesk::AutoCAD::ApplicationServices;&lt;br /&gt;&lt;br /&gt;void splash16()&lt;br /&gt;{&lt;br /&gt;Wform16* pwf = new Wform16();&lt;br /&gt;Autodesk::AutoCAD::ApplicationServices::Application::&lt;br /&gt;ShowModelessDialog(pwf);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Wform16::Wform16()&lt;br /&gt;{&lt;br /&gt;// Dialog box parameters&lt;br /&gt;Size = System::Drawing::Size(370, 300);&lt;br /&gt;StartPosition = FormStartPosition::Manual;&lt;br /&gt;Location = Point(300, 150);&lt;br /&gt;BackColor = Color::Aquamarine;&lt;br /&gt;Opacity = 0.5;&lt;br /&gt;FormBorderStyle = FormBorderStyle::None;&lt;br /&gt;&lt;br /&gt;// Font&lt;br /&gt;FontFamily *pFf = new FontFamily(L"Arial");&lt;br /&gt;System::Drawing::Font *pFont = new System::Drawing::Font(pFf, 36, FontStyle::Bold);&lt;br /&gt;&lt;br /&gt;// Text in the middle of the window&lt;br /&gt;Label *pTxt1 = new Label();&lt;br /&gt;pTxt1-&gt;Text = S"Book16";&lt;br /&gt;pTxt1-&gt;Location = Point(90, 120);&lt;br /&gt;pTxt1-&gt;AutoSize = true;&lt;br /&gt;pTxt1-&gt;ForeColor = Color::Black;&lt;br /&gt;pTxt1-&gt;Font = pFont;&lt;br /&gt;Controls-&gt;Add(pTxt1);&lt;br /&gt;&lt;br /&gt;// Handler of the Click event for the form&lt;br /&gt;this-&gt;Click += new EventHandler(this, &amp;Wform16::OnClick);&lt;br /&gt;&lt;br /&gt;// Timer creation&lt;br /&gt;System::Windows::Forms::Timer *tm = new Timer();&lt;br /&gt;tm-&gt;Interval = 5000; // Signal interval&lt;br /&gt;tm-&gt;Tick += new EventHandler(this, &amp;Wform16::OnTimerTick);&lt;br /&gt;tm-&gt;Enabled = true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void Wform16::OnClick(Object *sender, System::EventArgs *e)&lt;br /&gt;{&lt;br /&gt;// by click close the window&lt;br /&gt;Wform16::Close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Reaction to the first (and the last) timer signal&lt;br /&gt;void Wform16::OnTimerTick(Object *sender, System::EventArgs *ea)&lt;br /&gt;{&lt;br /&gt;System::Windows::Forms::Timer *t1 =&lt;br /&gt;static_cast&lt;?xml:namespace prefix = system /&gt;&lt;system::windows::forms::timer*&gt; (sender);&lt;br /&gt;// Timer stop&lt;br /&gt;t1-&gt;Stop();&lt;br /&gt;// Close the window after the first signal&lt;br /&gt;Wform16::Close();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/system::windows::forms::timer*&gt;&lt;br /&gt;splash16 function creates an instance of the dialog class and opens the splash screen window with the special ShowModelessDialog method in modeless mode. The dialog object is deleted as a result of watching two events: Tick (timer signal) and Click (click inside window but not on the text). Standard event list is reviewed in the next section.&lt;br /&gt;&lt;br /&gt;Pic. 5.63 shows splash screen of our application over the current drawing background. The window is opened by the LISP expression (book16), entered in the AutoCAD command line.&lt;br /&gt;&lt;system::windows::forms::timer*&gt;&lt;/system::windows::forms::timer*&gt;&lt;br /&gt;&lt;system::windows::forms::timer*&gt;&lt;a href="http://photos1.blogger.com/blogger/6284/765/1600/pic5-63%20Window%20with%20transparent%20splash%20screen.0.jpg"&gt;&lt;img style="CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/6284/765/320/pic5-63%20Window%20with%20transparent%20splash%20screen.0.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Pic. 5.63. Window with transparent splash screen&lt;br /&gt;&lt;br /&gt;This transparent window looks like the window being shown while starting AutoCAD session.&lt;br /&gt;Let’s consider window constructor (Wform16::Wform16 function in the Splash16.cpp file). At first window parameters are being defined. The Size, StartPosition, Location and BackColor properties sense is familiar to us from the previous example[3].&lt;br /&gt;The Opacity property sets the opacity ratio. It can take real values from 0 to 1. When 1 — the window is opaque, when 0 — absolutely transparent (and not seen). We use an average value (0.5).&lt;br /&gt;&lt;br /&gt;The FormBorderStyle property is set to None that is a member of the FormBorderStyle enumeration. It means that the window has neither frame nor caption (as the AutoCAD splash screen has).&lt;br /&gt;&lt;br /&gt;To place an inscription in the center of the window it is necessary to prepare the font. That is why the FontFamily and Font class instances are created. The font is used in the Label class instance which is added by the Add method to the Controls collection of the dialog.&lt;br /&gt;The next constructor text line adds the Click event handler, that is a click inside the form (but not on the text control having its own Click event):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;this-&gt;Click = new EventHandler(this, &amp;Wform16::OnClick);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Event handler is an object representing the EventHandler class. Using the above text line we connect the object with a delegate (i.e. pointer to the Wform16::OnClick function). This is the function that will be called if event occured.&lt;br /&gt;&lt;br /&gt;The Wform16::OnClick function has a very simple body — only Close method is run. That’s why after click inside the form the splash screen closes.&lt;br /&gt;&lt;br /&gt;The last four statements in the constructor create a timer with definite features. The timer that issues signals with some frequency is an object of the Timer class. The FCL[4] classes with the same names exist in three namespaces: System.Timer, System.Threading and System.Windows.Forms. In our Book16 project we chose the last class.&lt;br /&gt;When creating a timer at last the two properties should get their values:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/system::windows::forms::timer*&gt;&lt;system::windows::forms::timer*&gt;&lt;ul&gt;&lt;li&gt;Interval — time slot, after which the timer signals; the slot is measured in milliseconds, therefore 5000 value corresponds to 5 seconds of the real time;&lt;/li&gt;&lt;li&gt;Enabled — timer state; the true value is obligatory to activate the timer object.&lt;/li&gt;&lt;/ul&gt;The following line creates a handler of the Tick event (timer signals in given time slots):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;tm-&gt;add_Tick(new EventHandler(this,&amp;Wform16::TimerOnTick));&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The first timer signal must be emitted in five seconds after start. This signal also must become the last one: the Wform16::TimerOnTick function stops the timer (Stop method is used) and closes the dialog box.&lt;br /&gt;&lt;br /&gt;The timer should be stopped (another way is to set false to Enabled property), else after that garbage collector will free the memory used by the timer.&lt;br /&gt;&lt;br /&gt;So in our sample the splash screen appears in a modeless mode (that is we may do some drafting in the document while seeing the splash) and disappears if the user clicks it or five seconds pass after start.&lt;br /&gt;&lt;br /&gt;If there is a nonzero probability of launching the second copy of the splash screen then it is useful to add to our program the analysis of our splash screen presence in the main memory (it is sufficient to create a corresponding global variable and to check its value).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Event handling&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Adding controls to the form and their event handling were considered in the previous section[5] Book16 sample project. Now we will emphasize some moments. For example we will take the Button control which is a button of our dialog box.&lt;br /&gt;In order to add a button to a dialog we must create a new instance of the corresponding class:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;Button *bt = new Button();&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;After this it is possible to set values to the properties, e.g.: Text, Size, Location, BackGroundImage, BackColor, ForeColor, Font etc. The created object is then included into collection of the form controls:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;Controls-&gt;Add(bt);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Each class is connected with many standard events that could be handled programmatically (your own events can be created too). Let’s mention some of the Button control events:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;BackColorChanged — button background color was changed;&lt;/li&gt;&lt;li&gt;Click — there was a click on the button;&lt;/li&gt;&lt;li&gt;DragEnter — an object was dragged to the button;&lt;/li&gt;&lt;li&gt;ForeColorChanged — text color was changed;&lt;/li&gt;&lt;li&gt;GotFocus — button received focus;&lt;/li&gt;&lt;li&gt;KeyDown — key was pressed while button had focus;&lt;/li&gt;&lt;li&gt;MouseDown — mouse button was pressed when cursor was over the button;&lt;/li&gt;&lt;li&gt;MouseUp — mouse button was released when cursor was over the button;&lt;/li&gt;&lt;li&gt;VisibleChanged — button visibility state changed (connected with Visible property).&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;We must create an event callback function that will be called to analyze event parameters and running some actions. Mostly function names look like event names. For example we can expect that for Button object Click event the function name will be OnClick, OnButtonClick or OnBtClick.&lt;br /&gt;&lt;br /&gt;Each of the selected events must be connected with the handler that is an object of the EventHandler class. Namely this handler calls necessary function if event occurs.&lt;br /&gt;E.g. if we build for the Click event a handler that should call Wform16::OnBtClick function then the statement for the handler creation in the Wform16 form class constructor body will be as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;color:#3333ff;"&gt;add_Click(new EventHandler(this, &amp;Wform16::OnBtClick));&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Just the same in a more modern manner (using overloaded += operator):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;bt-&gt;Click += new EventHandler(this, &amp;Wform16::OnBtClick);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Some events (for example Paint) have another form of the same thing:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;Paint += new PaintEventHandler (this, OnPaint);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The last form looks like adding event handler in C# language (see chapter 7[6]).&lt;br /&gt;Every callback function receives two arguments: pointer to an object whose event was generated and additional event data. For example:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;color:#3333ff;"&gt;void Wform16:: OnTimerTick(Object *sender, System::EventArgs *ea)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first argument has universal System::Object* type therefore while applying we must bring it to the necessary type (use static_cast operator, see listing 5.36).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Downloads&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://poleshchuk.spb.ru/cad/Download/Book16eng-2002(AutoCAD2006).zip" target="_blank"&gt;http://poleshchuk.spb.ru/cad/Download/Book16eng-2002(AutoCAD2006).zip&lt;/a&gt;&lt;br /&gt;&lt;a href="http://poleshchuk.spb.ru/cad/Download/Book16eng-2005(AutoCAD2007).zip" target="_blank"&gt;http://poleshchuk.spb.ru/cad/Download/Book16eng-2005(AutoCAD2007).zip&lt;/a&gt;&lt;br /&gt;English Download page is accessible by link &lt;a href="http://poleshchuk.spb.ru/cad/Downloade.htm" target="_blank"&gt;http://poleshchuk.spb.ru/cad/Downloade.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;[1] N.Poleshchuk “AutoCAD: Application Development, Tuning and Customization”, pp. 449–455.&lt;br /&gt;[2] The previous project was created with ObjectARX Wizard using .NET mixed managed code support. (Author’s note)&lt;br /&gt;[3] They define the size, coordinates and background color of the window. (Author’s note)&lt;br /&gt;[4] Framework Class Library.&lt;br /&gt;[5] Opaque Splash Screen As a Modal Dialog. (Author’s note)&lt;br /&gt;[6] Chapter 7. Fortran, Delphi, C#, VB etc. (Author’s note)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/system::windows::forms::timer*&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-114764823269437639?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/114764823269437639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=114764823269437639' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114764823269437639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114764823269437639'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/05/transparent-splash-screen.html' title='Transparent Splash Screen'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-114717647952244316</id><published>2006-05-09T08:56:00.000-03:00</published><updated>2006-05-11T12:25:30.540-03:00</updated><title type='text'>Using MACROS inside ObjectARX</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Sometimes is very tedious to create functions to &lt;strong&gt;access your custom object members&lt;/strong&gt;. In some situations we also forget to call the proper assert method before edit or read the variable. This can cause you some trouble later.&lt;br /&gt;&lt;br /&gt;I have decided to make a bunch of macros to make our life easier. Using these macros you can speed up your development.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to use&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;First, place the following macros inside a general .H file, say &lt;strong&gt;ArxMacros.h&lt;/strong&gt;, and place it inside your project:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;#define _ARX_SGET(x) LPCTSTR Get##x(void) const { assertReadEnabled(); return _s##x; }&lt;br /&gt;#define _ARX_SSET(x) void Set##x(LPCTSTR sValue) { assertWriteEnabled(); _s##x.Format("%s", sValue); }&lt;br /&gt;#define _ARX_IGET(x) int Get##x(void) const { assertReadEnabled(); return _i##x; }&lt;br /&gt;#define _ARX_ISET(x) void Set##x(int iValue) { assertWriteEnabled(); _i##x = iValue; }&lt;br /&gt;#define _ARX_BGET(x) BOOL Get##x(void) const { assertReadEnabled(); return _b##x; }&lt;br /&gt;#define _ARX_BSET(x) void Set##x(BOOL bValue) { assertWriteEnabled(); _b##x = bValue; }&lt;br /&gt;#define _ARX_FGET(x) float Get##x(void) const { assertReadEnabled(); return _f##x; }&lt;br /&gt;#define _ARX_FSET(x) void Set##x(float fValue) { assertWriteEnabled(); _f##x = fValue; }&lt;br /&gt;#define _ARX_DTGET(x) COleDateTime Get##x(void) const { assertReadEnabled(); return _dt##x; }&lt;br /&gt;#define _ARX_DTSET(x) void Set##x(COleDateTime dtValue) { assertWriteEnabled(); _dt##x = dtValue; }&lt;br /&gt;#define _ARX_LGET(x) long Get##x(void) const { assertReadEnabled(); return _l##x; }&lt;br /&gt;#define _ARX_LSET(x) void Set##x(long lValue) { assertWriteEnabled(); _l##x = lValue; }&lt;br /&gt;#define _ARX_DGET(x) double Get##x(void) const { assertReadEnabled(); return _d##x; }&lt;br /&gt;#define _ARX_DSET(x) void Set##x(double dValue) { assertWriteEnabled(); _d##x = dValue; }&lt;br /&gt;#define _ARX_OBJIDGET(x) AcDbObjectId Get##x(void) const { assertReadEnabled(); return _id##x; }&lt;br /&gt;#define _ARX_OBJIDSET(x) void Set##x(AcDbObjectId lValue) { assertWriteEnabled(); _id##x = lValue; }&lt;br /&gt;#define _ARX_PT3DGET(x) const AcGePoint3d&amp; Get##x(void) const { assertReadEnabled(); return _pt##x; }&lt;br /&gt;#define _ARX_PT3DSET(x) void Set##x(AcGePoint3d ptValue) { assertWriteEnabled(); _pt##x = ptValue; }&lt;br /&gt;#define _ARX_PT2DGET(x) const AcGePoint2d&amp; Get##x(void) const { assertReadEnabled(); return _pt##x; }&lt;br /&gt;#define _ARX_PT2DSET(x) void Set##x(AcGePoint2d ptValue) { assertWriteEnabled(); _pt##x = ptValue; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Go to your custom object's class header and place them as follows:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;_ARX_SGET&lt;/strong&gt;&lt;/span&gt;(Name)&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;_ARX_SSET&lt;/strong&gt;&lt;/span&gt;(Name)&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;_ARX_DGET&lt;/strong&gt;&lt;/span&gt;(Number)&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;_ARX_DSET&lt;/strong&gt;&lt;/span&gt;(Number)&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#cc33cc;"&gt;_ARX_PT3DGET&lt;/span&gt;&lt;/strong&gt;(Point)&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;&lt;strong&gt;_ARX_PT3DSET&lt;/strong&gt;&lt;/span&gt;(Point)&lt;br /&gt;&lt;br /&gt;When you compile the code these macros will expand as follows:&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;SetName&lt;/span&gt;&lt;/strong&gt;(LPCTSTR sValue);&lt;br /&gt;LPCTSTR &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;GetName&lt;/span&gt;&lt;/strong&gt;(void) const;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;br /&gt;void &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;SetNumber&lt;/span&gt;&lt;/strong&gt;(double dValue);&lt;br /&gt;double &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;GetNumber&lt;/strong&gt;&lt;/span&gt;(void) const;&lt;br /&gt;&lt;br /&gt;void &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;SetPoint&lt;/span&gt;&lt;/strong&gt;(AcGePoint3d ptValue);&lt;br /&gt;const AcGePoint3d&amp; &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;GetPoint&lt;/span&gt;&lt;/strong&gt;(void) const;&lt;br /&gt;&lt;br /&gt;As they refer to local class variable we need to add them will proper naming convention (note that I put a prefix on each variable inside macros using a letter to identify its type):&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;CString&lt;/span&gt;&lt;/strong&gt; _sName;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;strong&gt;double&lt;/strong&gt;&lt;/span&gt; _dNumber;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt;&lt;/strong&gt; _ptPoint;&lt;br /&gt;&lt;br /&gt;You don't need to place anything else inside your class CPP file. Of course if you need a special behavior when accessing your members you will need to fully create the access function.&lt;br /&gt;&lt;br /&gt;That's it, now you have your access functions ready to use.&lt;br /&gt;&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-114717647952244316?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/114717647952244316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=114717647952244316' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114717647952244316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114717647952244316'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/05/using-macros-inside-objectarx.html' title='Using MACROS inside ObjectARX'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-114124140462929080</id><published>2006-03-01T16:29:00.000-03:00</published><updated>2006-03-01T16:30:04.900-03:00</updated><title type='text'>AutoCAD 2007</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Today, 1st March 2006, all beta sites are allowed do discuss about the next release of AutoCAD.&lt;br /&gt;Named AutoCAD 2007 it will present several exciting new features specially on 3D, Visualization and Render engines.&lt;br /&gt;&lt;br /&gt;Regarding to the programming side, there are several and important issues related to this new release. I will discuss them further but I would present below a brief introduction about these impacts:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Binary Compatibility Break&lt;/span&gt;&lt;/strong&gt;: AutoCAD 2007 is being compiled with new Visual Studio 2005 which uses MFC 8.0 and .NET Framework 2.0. This will cause a binary break on your ObjectARX applications and they will need to be recompiled with the new ObjectARX 2007 SDK and Visual Studio 2005. Once you compile your application with the new ObjectARX 2007 SDK you can't load it on previous version so, for a couple of years and until your clients don't upgrade too, you will need to live with two releases using side by side versions of AutoCAD, ObjectARX and Visual Studio;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;UNICODE support&lt;/span&gt;&lt;/strong&gt;: AutoCAD 2007 requires that your ObjectARX application fully support and use unicode. This will require a full review in your code converting all non-unicode string variables and calls to unicode. This can take long time depending on how your code strings are used and organized;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;New Solid and 3D API&lt;/span&gt;&lt;/strong&gt;: AutoCAD 2007 brings several features on 3D solids modeling and 3D visualization. The Render engine was totally redesigned and now supports new types of materials, tranparency, visual styles and much more;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Several .NET API improvements&lt;/span&gt;&lt;/strong&gt;: New CUI API and Tool Palette Management. AutoLISP interoperability from .NET (now you can call LISP function and send/receive parameters from .NET).&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;There are much more and you really need to see by yourself.&lt;br /&gt;&lt;br /&gt;I'm working on a new set of tutorials and documents to explore the new Visual Studio 2005 compiler, ObjectARX 2007 and AutoCAD 2007. Stay tuned for the upcoming articles.&lt;/p&gt;&lt;p&gt;As soon as the AutoCAD 2007 is released Autodesk will make available the new ObjectARX 2007 SDK for downloading. Stay tuned on Autodesk website during the next days.&lt;/p&gt;&lt;p&gt;Cheers!&lt;br /&gt;Fernando Malard.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-114124140462929080?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/114124140462929080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=114124140462929080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114124140462929080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/114124140462929080'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2006/03/autocad-2007.html' title='AutoCAD 2007'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-112352209824733643</id><published>2005-08-08T14:19:00.000-03:00</published><updated>2005-08-08T14:28:18.256-03:00</updated><title type='text'>Contest cancelled</title><content type='html'>&lt;div align="justify"&gt;Hello,&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;Our contest was cancelled because no application was submitted.&lt;/div&gt;&lt;div align="justify"&gt;To allow other users to also participate, we have changed the Contest as follows: &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;- The contest will be about applications developed with ObjectARX (don't need to show AutoCAD 2006 new features anymore);&lt;/div&gt;&lt;div align="justify"&gt;- The contest will be opened only through AUGI (Autodesk User Group International);&lt;/div&gt;&lt;div align="justify"&gt;- Users who want to participate will need to register at AUGI (&lt;a href="http://www.augi.com"&gt;www.augi.com&lt;/a&gt;) and register to ATP086 (ObjectARX for Dummies) class (&lt;a href="http://www.augi.com/education/schedule.asp"&gt;http://www.augi.com/education/schedule.asp&lt;/a&gt;)&lt;/div&gt;&lt;div align="justify"&gt;- At the end of this ATP course we will judge the best ObjectARX application;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;Kindest regards,&lt;/div&gt;&lt;div align="justify"&gt;Fernando.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-112352209824733643?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/112352209824733643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=112352209824733643' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/112352209824733643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/112352209824733643'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/08/contest-cancelled.html' title='Contest cancelled'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-112128458022084248</id><published>2005-07-13T16:49:00.000-03:00</published><updated>2005-07-13T16:56:20.226-03:00</updated><title type='text'>Contest registration postponed</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;I would like to announce that the key dates of our Contest has been postponed.&lt;br /&gt;New key dates are:&lt;br /&gt;&lt;br /&gt;Registration and application deploy: &lt;span style="font-weight: bold;"&gt;July, 29&lt;/span&gt;&lt;br /&gt;Contest results: &lt;span style="font-weight: bold;"&gt;August, 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope this give more time to users decide to participate on this Contest.&lt;br /&gt;Invite your friends to participate too!&lt;br /&gt;Remember, we are providing 2 copies of AutoCAD 2006 (NFR)!&lt;br /&gt;&lt;br /&gt;Cheers!&lt;br /&gt;Fernando.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-112128458022084248?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/112128458022084248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=112128458022084248' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/112128458022084248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/112128458022084248'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/07/contest-registration-postponed.html' title='Contest registration postponed'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111987175108633021</id><published>2005-06-27T08:24:00.000-03:00</published><updated>2005-06-27T08:29:11.090-03:00</updated><title type='text'>Register and submit your application by 15th July</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I would like to invite all users who not have submitted their applications yet and did not make the registration that both can be done until 15th July.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111987175108633021?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111987175108633021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111987175108633021' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111987175108633021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111987175108633021'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/06/register-and-submit-your-application.html' title='Register and submit your application by 15th July'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111940174043356686</id><published>2005-06-21T21:51:00.000-03:00</published><updated>2005-06-21T21:55:40.436-03:00</updated><title type='text'>AutoCAD 2006 Tips</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;I would like to suggest a link that provides some tips for AutoCAD 2006. Maybe from within this content you may extract a great idea for the Contest Application:&lt;br /&gt;&lt;br /&gt;&lt;a style="font-weight: bold; color: rgb(51, 51, 255);" href="http://usa.autodesk.com/adsk/servlet/ps/dl/index?siteID=123112&amp;id=2387193&amp;amp;linkID=2475176#section1"&gt;AutoCAD 2006 Tips&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Remember, submit your registration by 25th June.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111940174043356686?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111940174043356686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111940174043356686' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111940174043356686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111940174043356686'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/06/autocad-2006-tips.html' title='AutoCAD 2006 Tips'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111928849748607412</id><published>2005-06-20T14:25:00.000-03:00</published><updated>2005-06-20T14:28:17.490-03:00</updated><title type='text'>Contest Registration will close this week</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;Please, remember that our Contest Registration will end on 25th June. Please send your registration form filled out and start to build your sample!&lt;br /&gt;&lt;br /&gt;You can be one of the winners and get your full copy of AutoCAD 2006 (not for resale). First place also receives a full license of VisualAssistX.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111928849748607412?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111928849748607412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111928849748607412' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111928849748607412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111928849748607412'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/06/contest-registration-will-close-this.html' title='Contest Registration will close this week'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111818758040594475</id><published>2005-06-07T20:21:00.000-03:00</published><updated>2005-06-07T20:39:40.413-03:00</updated><title type='text'>Contest registration will open next June 10th</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;First ObjectARX for Dummies Contest&lt;/span&gt; will be officially opened on next Friday (&lt;span style="font-weight: bold;"&gt;June 10th&lt;/span&gt;). By now everyone may download the contest rules &lt;a href="http://www.drawex.com/ThirdParty/files/ObjectARX/Contest1/ContestRules.rtf"&gt;&lt;span style="font-weight: bold;"&gt;here&lt;/span&gt;&lt;/a&gt;. Please fill this rules form and return to me from &lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;June 10th until June 25th&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;For those who not have an &lt;span style="font-weight: bold;"&gt;AutoCAD 2006&lt;/span&gt; version to build and test their samples I would suggest you to download a &lt;span style="font-weight: bold;"&gt;30 day evaluation copy of AutoCAD&lt;/span&gt; or use one from a friend or your company's computer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;Be creative and explore the new AutoCAD 2006 features!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To be fare with everyone I will limit all support questions to basic features to avoid give any privilege to any contest user.&lt;br /&gt;&lt;br /&gt;The winners will be judged by me, &lt;span style="font-weight: bold;"&gt;Shaan Hurley&lt;/span&gt;  (from &lt;span style="font-weight: bold;"&gt;Autodesk&lt;/span&gt;) and &lt;span style="font-weight: bold;"&gt;Lynn Allen&lt;/span&gt; (from &lt;span style="font-weight: bold;"&gt;Autodesk&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Key Dates:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Contest Opens on: &lt;span style="font-weight: bold;"&gt;10th June 2005&lt;/span&gt;&lt;br /&gt;Last Date for Registration: &lt;span style="font-weight: bold;"&gt;25th June 2005&lt;/span&gt;&lt;br /&gt;Last Date for Submission: &lt;span style="font-weight: bold;"&gt;15th July 2005&lt;/span&gt;&lt;br /&gt;Contest Results: &lt;span style="font-weight: bold;"&gt;25th July 2005&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Good luck to everyone!&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Fernando.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111818758040594475?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111818758040594475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111818758040594475' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111818758040594475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111818758040594475'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/06/contest-registration-will-open-next.html' title='Contest registration will open next June 10th'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111790108598290457</id><published>2005-06-04T13:04:00.002-03:00</published><updated>2008-03-28T17:34:13.128-03:00</updated><title type='text'>Class 14 - Creating a Custom Entity (step by step)</title><content type='html'>&lt;div align="justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;On this class I will complete the Class 13 with a tutorial to show you how to create a simple custom entity step by step. This entity has some features that will help you to see what is possible to do using ObjectARX. Please read carefully the following instructions.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;-Create a &lt;strong&gt;Blank Solution&lt;/strong&gt; called &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;CustomEntitySample&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;-Add a new &lt;strong&gt;DBX&lt;/strong&gt; project called &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;CustEntityDBX&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;-Add a new &lt;strong&gt;ARX&lt;/strong&gt; project called &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;CustEntityARX&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;-Remember to &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;enable MFC Extension&lt;/span&gt;&lt;/strong&gt; on both projects;&lt;br /&gt;-Create a &lt;strong&gt;dependency from ARX project to DBX&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_001.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_001.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;-Go to DBX project and open &lt;strong&gt;Autodesk Class Explorer&lt;/strong&gt;;&lt;br /&gt;-Right click on &lt;strong&gt;CustEntityDBX&lt;/strong&gt; node and select "&lt;strong&gt;Add ObjectDBX Custom Object...&lt;/strong&gt;":&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_002.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_002.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;-Choose &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;MyCustomEntity&lt;/span&gt;&lt;/strong&gt; as class name and derive it from &lt;strong&gt;AcDbEntity&lt;/strong&gt;;&lt;br /&gt;-Other fields will be filled automatically (you may change these values);&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_003.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_003.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;-Go to the &lt;strong&gt;Protocols&lt;/strong&gt; TAB and enable both &lt;strong&gt;Osnap&lt;/strong&gt; and &lt;strong&gt;Grip-points&lt;/strong&gt; protocols:&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_004.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_004.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;-&lt;strong&gt;Rebuild&lt;/strong&gt; your project to see if everything is ok;&lt;br /&gt;-Now, open again the &lt;strong&gt;Autodesk Class Explorer&lt;/strong&gt;, go to &lt;strong&gt;CustEntityDBX&lt;/strong&gt; project;&lt;br /&gt;-Select the &lt;strong&gt;MyCustomEntity&lt;/strong&gt; node (if it is not there, click on &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Refresh&lt;/span&gt;&lt;/strong&gt; icon);&lt;br /&gt;-Right click on it and select "&lt;strong&gt;Add Variable...&lt;/strong&gt;":&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_005.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_005.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;-Name it as "&lt;strong&gt;m_PtA&lt;/strong&gt;", type will be an &lt;strong&gt;AcGePoint3d&lt;/strong&gt; and its access will be protected;&lt;br /&gt;-Enable "&lt;strong&gt;Participate to DWG filing protocol&lt;/strong&gt;", disable "&lt;strong&gt;Increase Version number&lt;/strong&gt;";&lt;br /&gt;-Enable "&lt;strong&gt;Implement Get/Put methods&lt;/strong&gt;" and fill desired comments for it;&lt;br /&gt;-Repeat the process and create : "&lt;strong&gt;m_PtB&lt;/strong&gt;", "&lt;strong&gt;m_PtAB&lt;/strong&gt;" and "&lt;strong&gt;m_PtBA&lt;/strong&gt;":&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_006.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_006.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;-Now, add a &lt;strong&gt;CString&lt;/strong&gt; variable called "&lt;strong&gt;m_Text&lt;/strong&gt;";&lt;br /&gt;-&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Remember to correct the CString manipulation and filing as we have done in Lab3&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;-Now you should compile your code ok;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_007.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_007.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;Before continue, we will need to &lt;strong&gt;remove some functions&lt;/strong&gt; that we will not use. First remove the following from .H file:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual Acad::ErrorStatus &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getGripPoints&lt;/span&gt;&lt;/strong&gt; (&lt;br /&gt;AcDbGripDataPtrArray &amp;amp;grips, const double curViewUnitSize, const int gripSize,&lt;br /&gt;const AcGeVector3d &amp;amp;curViewDir, const int bitflags) const;&lt;br /&gt;&lt;br /&gt;virtual Acad::ErrorStatus &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;moveGripPointsAt&lt;/span&gt;&lt;/strong&gt; (&lt;br /&gt;const AcDbVoidPtrArray &amp;amp;gripAppData,&lt;br /&gt;const AcGeVector3d &amp;amp;offset, const int bitflags);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There are 4 methods &lt;strong&gt;getOsnapPoints&lt;/strong&gt;(). We will only use the following method:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual Acad::ErrorStatus &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getOsnapPoints&lt;/span&gt;&lt;/strong&gt; (&lt;br /&gt;AcDb::OsnapMode osnapMode, int gsSelectionMark, const AcGePoint3d &amp;amp;pickPoint,&lt;br /&gt;const AcGePoint3d &amp;amp;lastPoint, const AcGeMatrix3d &amp;amp;viewXform,&lt;br /&gt;AcGePoint3dArray &amp;amp;snapPoints, AcDbIntArray &amp;amp;geomIds) const ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, you will need to &lt;strong&gt;delete the body of these functions&lt;/strong&gt; from cpp file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WORLDDRAW&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-To &lt;strong&gt;draw our custom entity&lt;/strong&gt;, we will need to add the following code to &lt;strong&gt;worldDraw()&lt;/strong&gt; method:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;assertReadEnabled();&lt;br /&gt;&lt;span style="color:#009900;"&gt;// Bounding Polyline&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt; pts[4];&lt;br /&gt;pts[0] = m_PtA;&lt;br /&gt;pts[1] = m_PtAB;&lt;br /&gt;pts[2] = m_PtB;&lt;br /&gt;pts[3] = m_PtBA;&lt;br /&gt;&lt;br /&gt;mode-&gt;subEntityTraits().setSelectionMarker(1); &lt;span style="color:#009900;"&gt;// Mark 1&lt;/span&gt;&lt;br /&gt;mode-&gt;subEntityTraits().setColor(1); &lt;span style="color:#009900;"&gt;// Red&lt;/span&gt;&lt;br /&gt;mode-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;geometry&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;polygon&lt;/span&gt;&lt;/strong&gt;(4,pts);&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// Entity's Text&lt;/span&gt;&lt;br /&gt;mode-&gt;subEntityTraits().setSelectionMarker(2); &lt;span style="color:#009900;"&gt;// Mark 2&lt;/span&gt;&lt;br /&gt;mode-&gt;subEntityTraits().setColor(256); &lt;span style="color:#009900;"&gt;// ByLayer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcGiTextStyle&lt;/span&gt; style;&lt;br /&gt;style.setFileName(_T("txt.shx"));&lt;br /&gt;style.setBigFontFileName(_T(""));&lt;br /&gt;style.setTextSize(25);&lt;br /&gt;style.loadStyleRec();&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt; txtPt((m_PtB.x+m_PtA.x)/2.0, (m_PtB.y+m_PtA.y)/2.0, m_PtA.z);&lt;br /&gt;&lt;br /&gt;mode-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;geometry&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;text&lt;/span&gt;&lt;/strong&gt;(txtPt, AcGeVector3d::kZAxis,&lt;br /&gt;(m_PtAB-m_PtA),m_Text, m_Text.GetLength(),Adesk::kFalse, style);&lt;br /&gt;&lt;br /&gt;return &lt;span style="color:#3333ff;"&gt;Adesk::kTrue&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;GRIP Points&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-Open remaining &lt;strong&gt;getGripPoints()&lt;/strong&gt; method inside &lt;strong&gt;MyCustomEntity&lt;/strong&gt; implementation (cpp);&lt;br /&gt;-We would like to enable &lt;strong&gt;5 grips&lt;/strong&gt; for this entity. One &lt;strong&gt;at each point&lt;/strong&gt; (A,B,AB and BA) plus one at the center;&lt;br /&gt;-Inside the &lt;strong&gt;getGripPoints()&lt;/strong&gt;, add the following code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;gripPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtA);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;gripPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtAB);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;gripPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtB);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;gripPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtBA);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;gripPoints&lt;/span&gt;&lt;/strong&gt;.append(&lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt;((m_PtB.x+m_PtA.x)/2.0,&lt;br /&gt;(m_PtB.y+m_PtA.y)/2.0,m_PtA.z));&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;-Now, when user clicks on each Grip we would like to perform an action. This is done using the &lt;strong&gt;moveGripPointsAt()&lt;/strong&gt; method;&lt;br /&gt;-We need to check the index of each fired grip accordingly to the &lt;strong&gt;getGripPoints()&lt;/strong&gt; method and then apply the transformation;&lt;br /&gt;-Inside remaining &lt;strong&gt;moveGripPointsAt()&lt;/strong&gt; method, add the following code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;assertWriteEnabled();&lt;br /&gt;for(int i=0; i&lt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;indices&lt;/span&gt;&lt;/strong&gt;.length(); i++) {&lt;br /&gt;&lt;strong&gt;int idx = &lt;span style="color:#ff0000;"&gt;indices&lt;/span&gt;.at(i);&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// For A and center point&lt;/span&gt;&lt;br /&gt;if (idx==0 idx==4) m_PtA += &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;offset&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// For AB and center point&lt;/span&gt;&lt;br /&gt;if (idx==1 idx==4) m_PtAB += &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;offset&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// For B and center point&lt;/span&gt;&lt;br /&gt;if (idx==2 idx==4) m_PtB += &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;offset&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// For BA and center point&lt;/span&gt;&lt;br /&gt;if (idx==3 idx==4) m_PtBA += &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;offset&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;}&lt;br /&gt;return (&lt;span style="color:#3333ff;"&gt;Acad::eOk&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;OSNAP Points&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-Open the &lt;strong&gt;getOsnapPoints()&lt;/strong&gt; method. We will add 3 Osnap modes: &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;EndPoint, MidPoint and Center&lt;/span&gt;&lt;/strong&gt;:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;assertReadEnabled();&lt;br /&gt;switch (&lt;strong&gt;osnapMode&lt;/strong&gt;) {&lt;br /&gt;&lt;br /&gt;case &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeEnd&lt;/span&gt;&lt;/strong&gt;:&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtA);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtAB);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtB);&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtBA);&lt;br /&gt;break;&lt;br /&gt;&lt;br /&gt;case &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeMid&lt;/span&gt;&lt;/strong&gt;:&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtA+((m_PtAB-m_PtA).length()/2.0)*((m_PtAB-m_PtA).normalize()));&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtAB+((m_PtB-m_PtAB).length()/2.0)*((m_PtB-m_PtAB).normalize()));&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtB+((m_PtBA-m_PtB).length()/2.0)*((m_PtBA-m_PtB).normalize()));&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(m_PtBA+((m_PtA-m_PtBA).length()/2.0)*((m_PtA-m_PtBA).normalize()));&lt;br /&gt;break;&lt;br /&gt;&lt;br /&gt;case &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeCen&lt;/span&gt;&lt;/strong&gt;:&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;snapPoints&lt;/span&gt;&lt;/strong&gt;.append(AcGePoint3d((m_PtB.x+m_PtA.x)/2.0,&lt;br /&gt;(m_PtB.y+m_PtA.y)/2.0, m_PtA.z));&lt;br /&gt;break;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;return (&lt;span style="color:#3333ff;"&gt;Acad::eOk&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;TRANSFORMATION&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-The custom entity transformation is done through &lt;strong&gt;transformBy()&lt;/strong&gt; method;&lt;br /&gt;-Open the &lt;strong&gt;Autodesk Class Explorer&lt;/strong&gt;, expand the &lt;strong&gt;MyCustomEntity&lt;/strong&gt; node, expand &lt;strong&gt;Base Classes&lt;/strong&gt; node and then expand &lt;strong&gt;AcDbEntity&lt;/strong&gt; node;&lt;br /&gt;-Scroll down the list and select:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;Acad::ErrorStatus &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(const &lt;span style="color:#3333ff;"&gt;AcGeMatrix3d&lt;/span&gt; &amp;amp;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-&lt;strong&gt;Right click&lt;/strong&gt; on this method and select "&lt;strong&gt;Implement Base Class Method&lt;/strong&gt;";&lt;br /&gt;-This function logic is very simple, just add the following code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;assertWriteEnabled();&lt;br /&gt;m_PtA.&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(xform);&lt;br /&gt;m_PtAB.&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(xform);&lt;br /&gt;m_PtB.&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(xform);&lt;br /&gt;m_PtBA.&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(xform);&lt;br /&gt;return (&lt;span style="color:#3333ff;"&gt;Acad::eOk&lt;/span&gt;);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;-This function will allow the custom entity to be transformed;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ARX PROJECT&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-First we will need to add a new command called "&lt;strong&gt;MyCustEnt&lt;/strong&gt;";&lt;br /&gt;-This will create a method inside &lt;strong&gt;acxrEntryPoint.cpp&lt;/strong&gt; file;&lt;br /&gt;-Now, add the necessary include instruction after the #include "StdAfx.h":&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;#include&lt;/span&gt;&lt;/strong&gt; "..\CustEntityDBX\MyCustomEntity.h"&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;-Inside the method we will create our entity:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#009900;"&gt;// Input information&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;ads_point&lt;/span&gt;&lt;/strong&gt; pt1,pt2;&lt;br /&gt;if (&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;acedGetPoint&lt;/span&gt;&lt;/strong&gt;(&lt;span style="color:#993399;"&gt;NULL&lt;/span&gt;,_T("Set the first point:\n"),pt1) != &lt;span style="color:#993399;"&gt;RTNORM&lt;/span&gt;)&lt;br /&gt;return;&lt;br /&gt;if (&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;acedGetCorner&lt;/span&gt;&lt;/strong&gt;(pt1,_T("Set the second point:\n"),pt2) != &lt;span style="color:#993399;"&gt;RTNORM&lt;/span&gt;)&lt;br /&gt;return;&lt;br /&gt;&lt;br /&gt;TCHAR buffer[512];&lt;br /&gt;if (&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;acedGetString&lt;/span&gt;&lt;/strong&gt;(0,_T("Enter the text:\n"),buffer) != &lt;span style="color:#993399;"&gt;RTNORM&lt;/span&gt;)&lt;br /&gt;return;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// Setup entity&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;MyCustomEntity&lt;/span&gt;&lt;/strong&gt; *pEnt = new &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;MyCustomEntity&lt;/span&gt;&lt;/strong&gt;();&lt;br /&gt;pEnt-&gt;put_m_PtA(asPnt3d(pt1));&lt;br /&gt;pEnt-&gt;put_m_PtAB(AcGePoint3d(pt2[X],pt1[Y],pt1[Z]));&lt;br /&gt;pEnt-&gt;put_m_PtB(asPnt3d(pt2));&lt;br /&gt;pEnt-&gt;put_m_PtBA(AcGePoint3d(pt1[X],pt2[Y],pt2[Z]));&lt;br /&gt;pEnt-&gt;put_m_Text(buffer);&lt;br /&gt;&lt;br /&gt;// Post to Database&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcDbBlockTable&lt;/span&gt; *pBlockTable;&lt;br /&gt;acdbHostApplicationServices()-&gt;workingDatabase()-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getSymbolTable&lt;/span&gt;&lt;/strong&gt;(pBlockTable,&lt;br /&gt;AcDb::kForRead);&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcDbBlockTableRecord&lt;/span&gt; *pBlockTableRecord;&lt;br /&gt;pBlockTable-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getAt&lt;/span&gt;&lt;/strong&gt;(&lt;strong&gt;&lt;span style="color:#993399;"&gt;ACDB_MODEL_SPACE&lt;/span&gt;&lt;/strong&gt;, pBlockTableRecord,AcDb::kForWrite);&lt;br /&gt;pBlockTable-&gt;close();&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcDbObjectId&lt;/span&gt; retId = AcDbObjectId::kNull;&lt;br /&gt;pBlockTableRecord-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;appendAcDbEntity&lt;/span&gt;&lt;/strong&gt;(retId, pEnt);&lt;br /&gt;pBlockTableRecord-&gt;close();&lt;br /&gt;pEnt-&gt;close();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;TEST&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;-&lt;strong&gt;Rebuild&lt;/strong&gt; your project;&lt;br /&gt;-Open AutoCAD and load &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;DBX module first and then load the ARX&lt;/span&gt;&lt;/strong&gt;;&lt;br /&gt;-Fire command &lt;strong&gt;MYCUSTENT&lt;/strong&gt; and create as many entities as you want;&lt;br /&gt;-Test it against GRIP edit, MOVE, ROTATE, SCALE;&lt;br /&gt;-Fire a LINE command and try to get precision points (EndPoint, MidPoint and Center) over your entities;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_008.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_008.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/class13_009.jpg"&gt;&lt;img style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; MARGIN: 2px; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" src="http://photos1.blogger.com/img/282/3168/400/class13_009.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/Class13/CustomEntitySample.zip"&gt;Download this sample (VS2002) here!&lt;/a&gt;&lt;br /&gt;&lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/VS2005/CustomEntitySample.zip"&gt;Download this sample (VS2002 and VS2005) here!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Have fun!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111790108598290457?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111790108598290457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111790108598290457' title='49 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111790108598290457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111790108598290457'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/06/class-14-creating-custom-entity-step.html' title='Class 14 - Creating a Custom Entity (step by step)'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>49</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111722174064555073</id><published>2005-05-27T16:17:00.000-03:00</published><updated>2005-05-28T11:23:58.406-03:00</updated><title type='text'>Class 13 - Deriving from AcDbEntity</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;On previous class you saw that we can derive from &lt;strong&gt;AcDbObject&lt;/strong&gt; to create powerful custom objects and store them inside &lt;strong&gt;NOD&lt;/strong&gt;. On this class you will see that we can also create &lt;strong&gt;custom entities&lt;/strong&gt;, deriving from &lt;strong&gt;AcDbEntity&lt;/strong&gt; or one of its derived classes, which will present you a new way of thinking about how much powerful an ObjectARX application can be.&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;At the launch of AutoCAD 13 ObjectARX SDK opened a new world for developers and for Autodesk itself. Custom entities allows developers to build &lt;strong&gt;rich graphical applications&lt;/strong&gt; and present several new features not included into native AutoCAD entities. Autodesk also start to develop other applications based on new entities that brought great functionalities and unique experience.&lt;br /&gt;&lt;br /&gt;When you think about a custom entity you need to first think on how it will be used, handled, edited and all features it will present to users. This will allow you to &lt;strong&gt;outline the custom entity behavior&lt;/strong&gt; and list all tasks it will need to support and perform. This step is very important to decide if is better to develop a custom entity or if is better to use a native AutoCAD entity adding some data using &lt;strong&gt;XData&lt;/strong&gt; or &lt;strong&gt;XRecords&lt;/strong&gt;. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;In other hand, when you use &lt;strong&gt;standard AutoCAD entities&lt;/strong&gt; you will need also to &lt;strong&gt;handle its behavior&lt;/strong&gt; to support and manage all things users may perform with it. This is not quite simple and depending on how creative are your users it will take you much time. When you adopt the custom entity solution it will give you much advantage on handling user operations but it will be more complex to implement.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Advantages on using custom entities&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Several advantages will point you to the custom entities approach. I would like to list some of these advantages just to allow you to perceive how powerful it is:&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Custom graphics&lt;/span&gt;&lt;/strong&gt;: When you create your own custom entity you are responsible for its graphics. ObjectARX provides you some &lt;strong&gt;primitive drawing functions&lt;/strong&gt; that allow you to draw your custom entity using everything you need. No matter if your entity is too simple or too complex, ObjectARX provides tools to do that. &lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Custom Grips and OSNAPs&lt;/span&gt;&lt;/strong&gt;: It is also up to you implement or not Grips and Object Snap functionalities to your custom entities. You may need some specific OSNAP points and advanced Grip functions, go ahead, use them! &lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Custom transformation&lt;/span&gt;&lt;/strong&gt;: Your custom entity can be transformed using your own criteria. This takes full advantage of powerful &lt;strong&gt;AcGe library&lt;/strong&gt; included into ObjectARX. &lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Embedded native entities&lt;/span&gt;&lt;/strong&gt;: If you would like to build an entity that looks like some native entities you can embed those entities into your custom entity and take advantage of all already implemented code. Suppose you need to build a custom entity that is much like a Polyline with a hatch inside. This can be easily done by embedding an &lt;strong&gt;AcDbHatch&lt;/strong&gt; entity inside your &lt;strong&gt;AcDbPolyline&lt;/strong&gt; derived custom entity.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Custom entity graphics&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;AcGi&lt;/strong&gt; library provides all you need to construct your &lt;strong&gt;custom entity's graphics&lt;/strong&gt;. Basically your custom entity will be presented on AutoCAD screen using one or both of the following methods:&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual Adesk::Boolean&lt;br /&gt;&lt;strong&gt;AcDbEntity&lt;/strong&gt;::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;worldDraw&lt;/span&gt;&lt;/strong&gt; (&lt;span style="color:#3333ff;"&gt;AcGiWorldDraw&lt;/span&gt; * pWd);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;virtual void&lt;br /&gt;&lt;strong&gt;AcDbEntity&lt;/strong&gt;::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;viewportDraw&lt;/span&gt;&lt;/strong&gt; (&lt;span style="color:#3333ff;"&gt;AcGiViewportDraw&lt;/span&gt; * pVd);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The first function, called &lt;strong&gt;worldDraw&lt;/strong&gt;(), is responsible to &lt;strong&gt;draw standard graphics&lt;/strong&gt; for your entity. The second function, called &lt;strong&gt;viewportDraw&lt;/strong&gt;(), is optional and it allows you to &lt;strong&gt;draw viewport dependent graphics&lt;/strong&gt;. These functions receive a drawing context pointer that will allow you to perform your drawing as well.&lt;br /&gt;&lt;br /&gt;These functions are &lt;strong&gt;called several times&lt;/strong&gt; due several reasons and &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;you need to provide the code inside them as faster and efficient as you can&lt;/span&gt;&lt;/strong&gt;. Don't perform heavy calculations, long loops and other time consuming tasks there. If you are using native entities to draw you custom entity does not declare them inside these functions. Declare them as members of your class and just forward the calls inside &lt;strong&gt;worldDraw&lt;/strong&gt;() or &lt;strong&gt;viewportDraw&lt;/strong&gt;() to these embedded entities.&lt;br /&gt;&lt;br /&gt;AutoCAD performs the &lt;strong&gt;drawing process&lt;/strong&gt; walking through all database entities and calling first the &lt;strong&gt;worldDraw&lt;/strong&gt;() method. If the &lt;strong&gt;worldDraw&lt;/strong&gt;() method returns &lt;strong&gt;Adesk::kFalse&lt;/strong&gt;, AutoCAD also walks through each viewport and call entity's &lt;strong&gt;viewportDraw&lt;/strong&gt;() method. Exactly at this point you may draw a different graphic depending on each viewport configuration.&lt;br /&gt;&lt;br /&gt;The provided &lt;strong&gt;drawing primitives&lt;/strong&gt; are quite simple and I will just list them here: &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Circle, Circular arc, Polyline, Polygon, Mesh, Shell, Text, Xline and Ray&lt;/span&gt;&lt;/strong&gt;. Please refer to the &lt;strong&gt;AcGi&lt;/strong&gt; documentation inside ObjectARX SDK for instructions and detailed information on how to use them. Primitives are called using a &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;geometry()&lt;/span&gt;&lt;/strong&gt; function.&lt;br /&gt;&lt;br /&gt;Custom entities allows you to also &lt;strong&gt;subdivide&lt;/strong&gt; them. This feature is done using the &lt;strong&gt;AcGiSubEntityTraits&lt;/strong&gt; object. The &lt;strong&gt;AcGiSubEntityTraits&lt;/strong&gt; object sets graphical attribute values using the following traits functions: &lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Color&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Layer&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Linetype&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Polygon fill type &lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;Selection marker&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div align="justify"&gt;This way you can &lt;strong&gt;separate logical information through its graphics&lt;/strong&gt;. For instance, if you entity has some texts and some lines you may separate them into two different subentities. Further, if you would like to draw part of your entity using a specific color or linetype, this is also done using subentities. &lt;strong&gt;Each subentity could have its own mark&lt;/strong&gt;. This will allow you do perform advanced interation with users by discovering on which subentity user has clicked. If you would like to do that, before draw your subentity graphics, give a call to &lt;strong&gt;setSelectionMarker&lt;/strong&gt;() passing an incremental index.&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;Inside &lt;strong&gt;viewportDraw&lt;/strong&gt;() function you will also have access to caller viewport information through &lt;strong&gt;AcGiViewport&lt;/strong&gt; object inside the &lt;strong&gt;AcGiViewportDraw&lt;/strong&gt; object passed in. The viewport geometry object provides the same primitives world geometry object plus the following polygon and polyline primitives, which use eye and display space coordinates: &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;polylineEye, polygonEye, polylineDc and polygonDc&lt;/span&gt;&lt;/strong&gt;. Some &lt;strong&gt;examples&lt;/strong&gt; of both &lt;strong&gt;worldDraw&lt;/strong&gt;() and &lt;strong&gt;viewportDraw&lt;/strong&gt;() methods are presented below:&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;Adesk::Boolean&lt;/span&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;worldDraw&lt;/span&gt;&lt;/strong&gt;(&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcGiWorldDraw&lt;/span&gt;&lt;/strong&gt; *pW) {&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;blockquote&gt;&lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt; verts[5];&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#006600;"&gt;// Create some random points&lt;/span&gt;&lt;br /&gt;verts[0] = verts[4] = &lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt;(-0.5, -0.5, 0.0);&lt;br /&gt;verts[1] = &lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt;( 0.5, -0.5, 0.0);&lt;br /&gt;verts[2] = &lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt;( 0.5, 0.5, 0.0);&lt;br /&gt;verts[3] = &lt;span style="color:#3333ff;"&gt;AcGePoint3d&lt;/span&gt;(-0.5, 0.5, 0.0);&lt;br /&gt;&lt;span style="color:#006600;"&gt;&lt;br /&gt;// Set the subentity color as 3&lt;/span&gt;&lt;br /&gt;pW-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;subEntityTraits&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;setColor&lt;/span&gt;&lt;/strong&gt;(3);&lt;br /&gt;&lt;span style="color:#006600;"&gt;&lt;br /&gt;// Draw the polyline primitive&lt;/span&gt;&lt;br /&gt;pW-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;geometry&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;polyline&lt;/span&gt;&lt;/strong&gt;(5, verts);&lt;br /&gt;&lt;br /&gt;return &lt;span style="color:#3333ff;"&gt;Adesk::kTrue&lt;/span&gt;;&lt;/blockquote&gt;&lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;void&lt;/span&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;viewportDraw&lt;/span&gt;&lt;/strong&gt;(&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcGiViewportDraw&lt;/span&gt;&lt;/strong&gt;* pV){&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;blockquote&gt;&lt;div align="justify"&gt;AcGePoint2d &lt;span style="color:#000000;"&gt;lleft, uright;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;br /&gt;// Get viewport's DC coordinates&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;pV-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;viewport&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getViewportDcCorners&lt;/span&gt;&lt;/strong&gt;(lleft,uright);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;br /&gt;// Perform some math here&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;double xsize = uright.x - lleft.x;&lt;br /&gt;double ysize = uright.y - lleft.y;&lt;br /&gt;xsize /= 10.0;&lt;br /&gt;ysize /= 10.0;&lt;br /&gt;double xcenter = uright.x - xsize;&lt;br /&gt;double ycenter = uright.y - ysize;&lt;br /&gt;double hxsize = xsize / 2.0;&lt;br /&gt;double hysize = ysize / 2.0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;AcGePoint3d &lt;span style="color:#000000;"&gt;verts[5];&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;// Set vertex initial value&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;for (int i=0; i&amp;lt;5; i++) {&lt;/div&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;div align="justify"&gt;&lt;blockquote&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Courier New;color:#000000;"&gt;&lt;span style="font-size:85%;"&gt;verts[i].x = xcenter;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Courier New;color:#000000;"&gt;&lt;span style="font-size:85%;"&gt;verts[i].y = ycenter;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Courier New;color:#000000;"&gt;verts[i].z = 0.0;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;div align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="color:#009900;"&gt;// Perform some adjustments&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;verts[0].x -= hxsize;&lt;br /&gt;verts[0].y += hysize;&lt;br /&gt;verts[1].x += hxsize;&lt;br /&gt;verts[1].y += hysize;&lt;br /&gt;verts[2].x += hxsize;&lt;br /&gt;verts[2].y -= hysize;&lt;br /&gt;verts[3].x -= hxsize;&lt;br /&gt;verts[3].y -= hysize;&lt;br /&gt;verts[4] = verts[0];&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;br /&gt;// Set the subentity color as 3&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;pV-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;subEntityTraits&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;setColor&lt;/span&gt;&lt;/strong&gt;(3);&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;&lt;br /&gt;// Draw the polyline on DC context&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;pV-&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;geometry&lt;/span&gt;&lt;/strong&gt;().&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;polylineDc&lt;/span&gt;&lt;/strong&gt;(5, verts);&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;p align="justify"&gt;&lt;strong&gt;Implementing Object Snap (OSNAP)&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Your custom entity probably will need to provide some &lt;strong&gt;precision points&lt;/strong&gt; through &lt;strong&gt;Object Snap&lt;/strong&gt; feature. Depending on how much complex your custom entity is you will need to implement several &lt;strong&gt;OSNAP&lt;/strong&gt; points and several types like EndPoint, Center, etc. To add OSNAP features to your custom entity you will need to add the following method to your class (there are other signatures):&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:Courier New;font-size:85%;"&gt;virtual &lt;span style="color:#3333ff;"&gt;Acad::ErrorStatus&lt;/span&gt; AcDbEntity::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getOsnapPoints&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;AcDb::OsnapMode&lt;/span&gt;&lt;/strong&gt; osnapMode,&lt;br /&gt;int gsSelectionMark,&lt;br /&gt;const AcGePoint3d&amp; pickPoint,&lt;br /&gt;const AcGePoint3d&amp;amp; lastPoint,&lt;br /&gt;const AcGeMatrix3d&amp; viewXform,&lt;br /&gt;AcGePoint3dArray&amp;amp; snapPoints,&lt;br /&gt;AcDbIntArray&amp; geomIds) const; &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;This function will allow you to fill the passed in &lt;strong&gt;AcGePoint3dArray&lt;/strong&gt; with those points that match with the provided &lt;strong&gt;osnapMode&lt;/strong&gt;. Possible values to osnapMode are:&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;p align="justify"&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeEnd&lt;/span&gt;&lt;/strong&gt;: endpoint on the entity that is nearest to the pickPoint.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeMid&lt;/span&gt;&lt;/strong&gt;: midpoint (of any line, arc, etc., subentity) that is nearest to the pickPoint.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeCen&lt;/span&gt;&lt;/strong&gt;: center point (of any circle or arc subentity) that is nearest to the pickPoint.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeNode&lt;/span&gt;&lt;/strong&gt;: node point that is nearest to the pickPoint.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeQuad&lt;/span&gt;&lt;/strong&gt;: quad point that's nearest to pickPoint.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeIns&lt;/span&gt;&lt;/strong&gt;: insertion point of the entity (the insertion of a BlockReference or an MText object).&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModePerp&lt;/span&gt;&lt;/strong&gt;: intersection point of the entity and a line perpendicular to it passing through lastPoint.&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeTan&lt;/span&gt;&lt;/strong&gt;: point on the entity where a line passing through lastPoint will be tangent to the entity&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcDb::kOsModeNear&lt;/span&gt;&lt;/strong&gt;: Find the point on the entity that's nearest to pickPoint.&lt;/p&gt;&lt;/span&gt;&lt;p align="justify"&gt;Imagine your custom entity is a rectangle and the user is running a LINE command and hover your entity with the &lt;strong&gt;EndPoint&lt;/strong&gt; OSNAP enabled. Your entity will need to respond AutoCAD providing those points that could be used as EndPoints of your entity. In this case, inside your &lt;strong&gt;getOsnapPoints&lt;/strong&gt;() function, you will need to fill the &lt;strong&gt;AcGePoint3dArray&lt;/strong&gt; with the points of the rectangle corner. AutoCAD choose which of these points are inside the aperture box and the closest point to the cursor. So, your function will be something like:&lt;/p&gt;&lt;span style="font-family:courier new;"&gt;&lt;p align="justify"&gt;&lt;span style="color:#3333ff;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Acad::ErrorStatus&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getOsnapPoints&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;AcDb::OsnapMode&lt;/span&gt; osnapMode,&lt;br /&gt;int gsSelectionMark,&lt;br /&gt;const AcGePoint3d&amp; pickPoint,&lt;br /&gt;const AcGePoint3d&amp;amp; lastPoint,&lt;br /&gt;const AcGeMatrix3d&amp; viewXform,&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;AcGePoint3dArray&lt;/span&gt;&lt;/strong&gt;&amp;amp; snapPoints,&lt;br /&gt;AcDbIntArray&amp; geomIds) const {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:#ff0000;"&gt;assertReadEnabled&lt;/span&gt;&lt;strong&gt;();&lt;br /&gt;switch (&lt;span style="color:#3333ff;"&gt;osnapMode&lt;/span&gt;) {&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;case&lt;/strong&gt; &lt;span style="color:#3333ff;"&gt;AcDb::kOsModeEnd&lt;/span&gt;&lt;strong&gt;:&lt;br /&gt;snapPoints.append(pt[0]);&lt;br /&gt;snapPoints.append(pt[1]);&lt;br /&gt;snapPoints.append(pt[2]);&lt;br /&gt;snapPoints.append(pt[3]);&lt;br /&gt;break;&lt;/strong&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;strong&gt;}&lt;br /&gt;return &lt;span style="color:#3333ff;"&gt;Acad::eOk&lt;/span&gt;;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The &lt;strong&gt;intersection OSNAP&lt;/strong&gt; is not implemented through &lt;strong&gt;getOsnapPoints&lt;/strong&gt;() method. As it is much more complex there is a special function called &lt;strong&gt;intersectWith&lt;/strong&gt;() to handle that. I won't present details about this here but you may read and find further information inside ObjectARX SDK documentation.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Implementing GRIP and Stretch points&lt;/strong&gt;&lt;/p&gt;&lt;p align="justify"&gt;Grip points provides a &lt;strong&gt;great and simple way to user edit and transform entities&lt;/strong&gt;. You will probably want to implement this feature for your entity. Further, stretch points will allow users to stretch your entity as well. These two features are &lt;strong&gt;very simple to implement&lt;/strong&gt; and make your entity much more flexible and powerful.&lt;br /&gt;&lt;br /&gt;Basically you just need to inform which are your &lt;strong&gt;key points&lt;/strong&gt; to Grip and stretch. Other functions will be responsible on set the behavior of your entity when each Grip and stretch point are used. Depending on the complexity of your entity these functions may become a little bit complex.&lt;br /&gt;&lt;br /&gt;For the Grip points feature you will need to implement a couple of functions. The first function, called &lt;strong&gt;getGripPoints&lt;/strong&gt;(), will return those points where you would like to enable a Grip. The second function, called &lt;strong&gt;moveGripPointsAt&lt;/strong&gt;() will perform the action when Grips are fired:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual Acad::ErrorStatus&lt;br /&gt;AcDbEntity::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getGripPoints&lt;/span&gt;&lt;/strong&gt; (AcGePoint3dArray&amp; gripPoints,&lt;br /&gt;AcDbIntArray&amp;amp; osnapModes,AcDbIntArray&amp; geomIds) const;&lt;br /&gt;&lt;br /&gt;virtual Acad::ErrorStatus&lt;br /&gt;AcDbEntity::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;moveGripPointsAt&lt;/span&gt;&lt;/strong&gt; (const AcDbIntArray&amp; indices,&lt;br /&gt;const AcGeVector3d&amp;amp; offset);&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;Remember that Grip points don't need to be created only where there is a part of your graphics. You can, for instance, create a Grip at the center of a rectangle and there is nothing drawn there.&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;getGripPoints&lt;/strong&gt;() function receive 3 arguments. Currently only the first argument is used. It is an &lt;strong&gt;array of 3D points&lt;/strong&gt; passed in by AutoCAD. This array contains all points involved into the current Grip operation. As other entities may be involved into this operation this array may already be filled. You just will append your desired points to this array. The points you have appended inside &lt;strong&gt;getGripPoints&lt;/strong&gt;() will be &lt;strong&gt;identified by an index&lt;/strong&gt; from the order they were appended to the point array.&lt;br /&gt;&lt;br /&gt;The &lt;strong&gt;moveGripPointsAt&lt;/strong&gt;() function will receive the &lt;strong&gt;index array and a 3D vector&lt;/strong&gt; sent by AutoCAD with the &lt;strong&gt;current transformation (AcGeVector3d)&lt;/strong&gt; being applied. At this time you just need to &lt;strong&gt;loop the index array&lt;/strong&gt;, get each of its values (the index) and, depending on this value fire the transformation at the desired point. Imagine again your entity is a rectangle and you have 5 Grip points, one of each corner and one at the center. For each corner you will apply only the transformation to its grip and for the center grip you will apply the transformation to all of your points. The corner grip operation will result into a stretch at that corner and the center grip operation will result into a move of the whole entity. To apply the transformation to each point just call the &lt;strong&gt;transformBy&lt;/strong&gt;() method passing in the &lt;strong&gt;AcGeVector3d&lt;/strong&gt; received from AutoCAD.&lt;br /&gt;&lt;br /&gt;In other hand, stretch points are defined and controlled by another two functions. They are much like the Grip functions and sometimes you just return a call to the Grip functions inside respective Stretch functions:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual Acad::ErrorStatus&lt;br /&gt;AcDbEntity::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getStretchPoints&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;AcGePoint3dArray&amp; stretchPoints) const;&lt;br /&gt;&lt;br /&gt;virtual Acad::ErrorStatus&lt;br /&gt;AcDbEntity::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;moveStretchPointsAt&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;const AcDbIntArray&amp; indices, const AcGeVector3d&amp;amp; offset);&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="justify"&gt;The behavior of stretch functions are &lt;strong&gt;almost the same as the Grip functions&lt;/strong&gt; and if your stretch points will behavior like Grip points you may just forward the call as below:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;Acad::ErrorStatus&lt;/span&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getStretchPoints&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;AcGePoint3dArray&amp; stretchPoints) const {&lt;br /&gt;AcDbIntArray osnapModes,geomIds;&lt;br /&gt;&lt;strong&gt;return&lt;/strong&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;getGripPoints&lt;/span&gt;&lt;/strong&gt;(stretchPoints,osnapModes,geomIds);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:courier new;"&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;Acad::ErrorStatus&lt;/span&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;moveStretchPointsAt&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;const AcDbIntArray&amp; indices, const AcGeVector3d&amp;amp; offset) {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;strong&gt;return&lt;/strong&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;moveGripPointsAt&lt;/span&gt;&lt;/strong&gt;(indices,offset);&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;The same concept of &lt;strong&gt;worldDraw&lt;/strong&gt;() and &lt;strong&gt;viewportDraw&lt;/strong&gt;() functions also applies here to the &lt;strong&gt;moveGripPointsAt&lt;/strong&gt;() and &lt;strong&gt;moveStretchPointsAt&lt;/strong&gt;() functions. They are called several times and &lt;strong&gt;they need to be as faster as you can&lt;/strong&gt;. When you click at an entity's grip the &lt;strong&gt;moveGripPointsAt&lt;/strong&gt;() function is called for every small mouse movement.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Implementing Transformation&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="justify"&gt;Your custom entity needs to support transformation if you would like to allow users to perform commands like &lt;strong&gt;MOVE, ROTATE and SCALE&lt;/strong&gt;. This feature is implemented through &lt;strong&gt;transformBy&lt;/strong&gt;() method which receives a transformation matrix representing the current transformation being applied to your entity. Inside this function you will apply this matrix to your entity's data to reflect the modifications. The &lt;strong&gt;AcGeMatrix3d&lt;/strong&gt; class support all types of transformations and encapsulate them through a matrix:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual &lt;span style="color:#3333ff;"&gt;Acad::ErrorStatus&lt;/span&gt;&lt;br /&gt;AcDbEntity::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(const &lt;span style="color:#3333ff;"&gt;&lt;strong&gt;AcGeMatrix3d&lt;/strong&gt;&lt;/span&gt;&amp; xform);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A typical implementation of transformBy() function could be:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="color:#3333ff;"&gt;Acad::ErrorStatus&lt;/span&gt; MyEnt::&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;transformBy&lt;/span&gt;&lt;/strong&gt;(&lt;br /&gt;const &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;AcGeMatrix3d&lt;/span&gt;&lt;/strong&gt;&amp; xform) {&lt;br /&gt;&lt;br /&gt;pt[0].transformBy(xform);&lt;br /&gt;pt[1].transformBy(xform);&lt;br /&gt;pt[2].transformBy(xform);&lt;br /&gt;pt[3].transformBy(xform);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In some special cases that I won't present here, you may need to apply the transformation to a clone or copy of your original entity. This is done using the &lt;strong&gt;getTransformedCopy&lt;/strong&gt;() method which receives the transformation matrix and a &lt;strong&gt;pointer to be filled with the entity's transformed copy&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;Too much information? Next class I will present a short and practical example with a custom entity. Stay tuned!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111722174064555073?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111722174064555073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111722174064555073' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111722174064555073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111722174064555073'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/class-13-deriving-from-acdbentity.html' title='Class 13 - Deriving from AcDbEntity'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111687137001969087</id><published>2005-05-23T14:47:00.000-03:00</published><updated>2005-05-23T15:02:50.033-03:00</updated><title type='text'>First ObjectARX for Dummies Contest</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;I have some good news for you.&lt;br /&gt;Recently came to my mind an idea to promote a &lt;span style="font-weight: bold;"&gt;contest&lt;/span&gt; for you but I thought it will much more interesting if I can offer some &lt;span style="font-weight: bold;"&gt;prizes&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The contest will go live after I present the class about custom entities and it will be about &lt;span style="font-weight: bold;"&gt;AutoCAD 2006 new features&lt;/span&gt;. Users will create ObjectARX samples &lt;span style="font-weight: bold;"&gt;using at least one of the new AutoCAD 2006 features&lt;/span&gt;. The prizes will be:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1st place&lt;/span&gt;: An AutoCAD 2006 NFR (Not for resale) full copy + Visual Assist X&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2nd place&lt;/span&gt;: An AutoCAD 2006 NFR (Not for resale) full copy&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;AutoCAD 2006 NFR&lt;/span&gt; copies will be provided by &lt;span style="font-weight: bold;"&gt;Autodesk &lt;/span&gt;(thanks to &lt;span style="font-weight: bold;"&gt;Shaan Hurley&lt;/span&gt;) and the copy of &lt;span style="font-weight: bold;"&gt;Visual Assist X&lt;/span&gt; will be provided by &lt;span style="font-weight: bold;"&gt;Whole Tomato&lt;/span&gt; software (thanks to &lt;span style="font-weight: bold;"&gt;Jeff&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;All samples submitted by users will be made available at this site and the winners will be chosen by me and two additional people (I trying one people from Autodesk and one AutoCAD author).&lt;br /&gt;&lt;br /&gt;Samples will be judged by its &lt;span style="font-weight: bold;"&gt;creativity and innovation&lt;/span&gt;. Remember that the contest is about AutoCAD 2006 new features and they must be the most important feature of your samples.&lt;br /&gt;&lt;br /&gt;For now, start to study the ObjectARX 2006 SDK and how to use the its new features.&lt;br /&gt;Stay tuned for the official contest start, rules and agreements.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111687137001969087?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111687137001969087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111687137001969087' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111687137001969087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111687137001969087'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/first-objectarx-for-dummies-contest.html' title='First ObjectARX for Dummies Contest'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111656222012445120</id><published>2005-05-20T01:10:00.002-03:00</published><updated>2009-03-24T22:24:55.132-03:00</updated><title type='text'>Lab 3 - Solved</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Here are the steps to build the sample:&lt;br /&gt;&lt;br /&gt;-Create a &lt;strong&gt;Blank Workspace&lt;/strong&gt; called Shapes;&lt;br /&gt;-Add the two projects: &lt;strong&gt;ShapesUi&lt;/strong&gt; (ARX) and &lt;strong&gt;ShapesObj&lt;/strong&gt; (DBX). Both with MFC extensions;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab3_0011.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab3_0011.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-Create a &lt;strong&gt;dependency&lt;/strong&gt; from ShapesUi to ShapesObj;&lt;br /&gt;-Compile de project with &lt;strong&gt;Build All&lt;/strong&gt; option;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab3_002.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab3_002.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-Open &lt;strong&gt;Autodesk Class Explorer&lt;/strong&gt; and right click over &lt;strong&gt;ShapesObj&lt;/strong&gt; project;&lt;br /&gt;-Select "&lt;strong&gt;Add an ObjectDBX Custom Object&lt;/strong&gt;" option;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab3_003.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab3_003.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-Enter the &lt;strong&gt;Class Name&lt;/strong&gt; as &lt;strong&gt;ShapeObject&lt;/strong&gt;. DWG protocol functions are automatically enabled. Click &lt;strong&gt;Finish&lt;/strong&gt;;&lt;br /&gt;-Two files will be created in your ShapesObj project: &lt;strong&gt;ShapeObject.h&lt;/strong&gt; and &lt;strong&gt;ShapeObject.cpp&lt;/strong&gt;;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab3_004.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab3_004.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-Open &lt;strong&gt;Autodesk Class Explorer&lt;/strong&gt; again and right ShapeObject class. Select &lt;strong&gt;Add variable...&lt;/strong&gt;;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab3_006.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab3_006.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-Enter the variable name (I suggest you to prefix all members with &lt;strong&gt;m_&lt;/strong&gt;), enable "&lt;strong&gt;Implement Get/Put methods&lt;/strong&gt;" option;&lt;br /&gt;-Select "&lt;strong&gt;Access&lt;/strong&gt;" as &lt;strong&gt;protected&lt;/strong&gt; because we will use the &lt;strong&gt;Get/Put&lt;/strong&gt; functions to change variables;&lt;br /&gt;-Fill the "&lt;strong&gt;Comment&lt;/strong&gt;" field with a description and &lt;strong&gt;uncheck&lt;/strong&gt; the "&lt;strong&gt;Increase version number&lt;/strong&gt;" option. Click &lt;strong&gt;Finish&lt;/strong&gt;;&lt;br /&gt;&lt;br /&gt;-&lt;strong&gt;Repeat this process&lt;/strong&gt; for each of our variables: &lt;strong&gt;m_d, m_tw, m_bf, m_tf and m_desig&lt;/strong&gt;;&lt;br /&gt;-Go to the header file of your custom object class and make some adjustments to group variables and functions;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab3_008.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab3_008.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-Compile your project. You will get one error:&lt;br /&gt;"&lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;cannot convert parameter 1 from 'CString *...&lt;/span&gt;&lt;/strong&gt;".&lt;br /&gt;&lt;br /&gt;This is due the problem when writing and reading CString types.&lt;br /&gt;We need to make some changes into &lt;strong&gt;dwgInFields()&lt;/strong&gt; and &lt;strong&gt;dwgOutFields()&lt;/strong&gt; methods:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;dwgOutFields&lt;/b&gt;:&lt;br /&gt;&lt;b&gt;from&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;pFiler-&amp;gt;&lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;writeItem&lt;/span&gt;&lt;/strong&gt;(m_desig);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;to&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;pFiler-&amp;gt;&lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;writeString&lt;/span&gt;&lt;/strong&gt;(&lt;strong&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;static_cast&lt;/span&gt;&lt;/strong&gt;&amp;lt;const TCHAR*&amp;gt;(m_desig));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;dwgInFields&lt;/b&gt;:&lt;br /&gt;&lt;b&gt;from&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;pFiler-&amp;gt;&lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;readItem&lt;/span&gt;&lt;/strong&gt;(&amp;amp;m_desig);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;to&lt;/b&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;TCHAR* temp = NULL;&lt;br /&gt;pFiler-&amp;gt;&lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;readString&lt;/span&gt;&lt;/strong&gt;(&amp;amp;temp);&lt;br /&gt;m_desig.Format(_T("%s"),temp);&lt;br /&gt;&lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;acutDelString&lt;/span&gt;&lt;/strong&gt;(temp);&lt;/span&gt; &lt;p&gt;&lt;/p&gt;&lt;p&gt;-Now, let's change the &lt;strong&gt;CString&lt;/strong&gt; access functions:&lt;/p&gt;&lt;p&gt;&lt;b&gt;from:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;CString ShapeObject::get_m_desig(void) const&lt;br /&gt;{&lt;br /&gt;assertReadEnabled () ;&lt;br /&gt;return (m_desig) ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Acad::ErrorStatus ShapeObject::put_m_desig(CString newVal)&lt;br /&gt;{&lt;br /&gt;assertWriteEnabled () ;&lt;br /&gt;m_desig =newVal ;&lt;br /&gt;return (Acad::eOk) ;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;to:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;void ShapeObject::get_m_desig(CString&amp;amp; newVal) const&lt;br /&gt;{&lt;br /&gt;assertReadEnabled () ;&lt;br /&gt;newVal.Format(_T("%s"),m_desig) ;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Acad::ErrorStatus ShapeObject::put_m_desig(LPCTSTR newVal)&lt;br /&gt;{&lt;br /&gt;assertWriteEnabled () ;&lt;br /&gt;m_desig.Format(_T("%s"),newVal);&lt;br /&gt;return (Acad::eOk) ;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This will avoid &lt;b&gt;heap violation problems&lt;/b&gt; when passing strings from one&lt;br /&gt;module to another. Remember to also change the respective function declarations.&lt;br /&gt;&lt;br /&gt;- Open the &lt;b&gt;acrxEntryPoint.cpp&lt;/b&gt;, inside &lt;b&gt;ShapesUi&lt;/b&gt; project, and add&lt;br /&gt;the following include:&lt;/p&gt;&lt;p&gt;&lt;span style="COLOR: rgb(51,51,255);font-family:Courier;font-size:85%;"  &gt;&lt;strong&gt;#include "..\ShapesObj\ShapeObject.h"&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- Now, we will use the &lt;b&gt;Class 12&lt;/b&gt; &lt;b&gt;createMyObjects()&lt;/b&gt; and &lt;b&gt;&lt;br /&gt;listMyObjects()&lt;/b&gt; functions to deal with our objects. Add these functions to&lt;br /&gt;&lt;b&gt;acrxEntryPoint.cpp&lt;/b&gt; file, before the application class and &lt;b&gt;make proper&lt;br /&gt;adjustments&lt;/b&gt;. Remember that our application dictionary will be called "&lt;b&gt;SHAPEAPP&lt;/b&gt;";&lt;/p&gt;&lt;p&gt;- Create two commands (&lt;b&gt;CSHAPE&lt;/b&gt; and &lt;b&gt;LSHAPE&lt;/b&gt;) and map each&lt;br /&gt;one to above functions. Be creative, optimize your code as much as you can!&lt;br /&gt;&lt;br /&gt;- Now, before create the research function we will need to add the &lt;b&gt;==&lt;br /&gt;operator &lt;/b&gt;to our custom object:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Courier;font-size:85%;"&gt;bool &lt;strong&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;operator ==&lt;/span&gt;&lt;/strong&gt;(const ShapeObject&amp;amp; arg) {&lt;br /&gt;if (&amp;amp;arg == this) return true;&lt;br /&gt;&lt;br /&gt;// We will need to use a tolerance as our values are double&lt;br /&gt;// Let's use 0.1&lt;br /&gt;&lt;br /&gt;if ( (fabs(m_d - arg.m_d ) &amp;lt; 0.1) &amp;amp;&amp;amp;&lt;br /&gt;(fabs(m_tw - arg.m_tw) &amp;lt; 0.1) &amp;amp;&amp;amp;&lt;br /&gt;(fabs(m_bf - arg.m_bf) &amp;lt; 0.1) &amp;amp;&amp;amp;&lt;br /&gt;(fabs(m_tf - arg.m_tf) &amp;lt; 0.1) )&lt;br /&gt;&lt;br /&gt;return true;&lt;br /&gt;else&lt;br /&gt;return false;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- To create a &lt;strong&gt;research function&lt;/strong&gt; use the list function as a base and try to&lt;br /&gt;find an existing shape before create a new one.&lt;br /&gt;&lt;br /&gt;- See the solved sample code to all detailed solutions.&lt;/p&gt;&lt;p&gt;Remember, to test the application first load the DBX module and then the ARX.&lt;br /&gt;To unload, first unload the ARX module then the DBX.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Download this sample's source code &lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/Labs/ARXLAB3.zip"&gt;here&lt;/a&gt;!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;See you next class!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111656222012445120?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111656222012445120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111656222012445120' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111656222012445120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111656222012445120'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/lab-3-solved.html' title='Lab 3 - Solved'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111566026308036121</id><published>2005-05-09T14:33:00.001-03:00</published><updated>2008-04-11T07:59:58.204-03:00</updated><title type='text'>User Samples</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I have received the &lt;span style="FONT-WEIGHT: bold"&gt;first &lt;/span&gt;user sample today.&lt;br /&gt;Thanks to Nikolay Poleshchuk from Russia.&lt;br /&gt;His sample is called book9eng.zip and is available at OFCDesk ftp.&lt;br /&gt;He is a LISP programmer and he is starting to learn ObjectARX.&lt;br /&gt;&lt;pre style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255)"&gt;&lt;tt&gt;www.cad.dp.ua/english/poleschuk_e.html&lt;/tt&gt;&lt;/pre&gt;Keep sending me your samples!&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111566026308036121?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111566026308036121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111566026308036121' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111566026308036121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111566026308036121'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/user-samples.html' title='User Samples'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111560651177388961</id><published>2005-05-08T23:07:00.000-03:00</published><updated>2006-05-11T20:26:49.386-03:00</updated><title type='text'>Lab 3 - Creating a custom object</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;Our third Lab will cover custom objects. You will need to create a &lt;span style="font-weight: bold;"&gt;custom object&lt;/span&gt;, its properties, functions and Dictionary related methods.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Requirements&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;* Class 1 to 12;&lt;br /&gt;* AutoCAD 2004/2005/2006 or compatible vertical installed;&lt;br /&gt;* Visual Studio .NET 2002 installed;&lt;br /&gt;* ObjectARX Wizard installed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Objectives&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;The main idea is to create the first part of a complete &lt;span style="font-weight: bold;"&gt;custom shape application&lt;/span&gt;. This part consist of building the custom object which will represent the shape form with properties that allows you to completely define it.&lt;br /&gt;&lt;br /&gt;The second step will be the &lt;span style="font-weight: bold;"&gt;custom entity&lt;/span&gt; which will refer to its associated shape. As several entities may use the same shape it is not a good idea to repeat the shape information inside each entity. Exactly due that we will create this custom object which will store de shape information and share this information with all custom entities related to it.&lt;br /&gt;&lt;br /&gt;It will be an &lt;span style="font-weight: bold;"&gt;"I" shape&lt;/span&gt; with &lt;span style="font-weight: bold;"&gt;equal top and bottom flanges&lt;/span&gt; and it will need to store the following information:&lt;br /&gt;&lt;br /&gt;-web height (&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;d&lt;/span&gt;) - &lt;span style="color: rgb(51, 51, 255);"&gt;double&lt;/span&gt;;&lt;br /&gt;-web thickness (&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;tw&lt;/span&gt;) - &lt;span style="color: rgb(51, 51, 255);"&gt;double&lt;/span&gt;;&lt;br /&gt;-flange width (&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;bf&lt;/span&gt;) - &lt;span style="color: rgb(51, 51, 255);"&gt;double&lt;/span&gt;;&lt;br /&gt;-flange thickness (&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;tf&lt;/span&gt;) - &lt;span style="color: rgb(51, 51, 255);"&gt;double&lt;/span&gt;;&lt;br /&gt;-shape name (&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;desig&lt;/span&gt;) - &lt;span style="color: rgb(51, 51, 255);"&gt;CString&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Instructions&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;- You will create two projects. The first, called &lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;ShapesUi &lt;/span&gt;(which will be the &lt;span style="font-weight: bold;"&gt;ObjectARX &lt;/span&gt;module) and the second called &lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;ShapesObj &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(&lt;/span&gt;which will be the &lt;span style="font-weight: bold;"&gt;ObjectDBX &lt;/span&gt;module)&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;using ObjectARX Wizard;&lt;br /&gt;- Enable Using &lt;span style="font-weight: bold;"&gt;MFC &lt;/span&gt;option in both projects;&lt;br /&gt;- After created both projects, open the &lt;span style="font-weight: bold;"&gt;Autodesk View toolbar&lt;/span&gt; , select the &lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;ShapesObj &lt;/span&gt;project and create the &lt;span style="font-weight: bold;"&gt;custom object&lt;/span&gt; called &lt;span style="font-weight: bold; color: rgb(51, 51, 255);"&gt;ShapeObject&lt;/span&gt;;&lt;br /&gt;- Override filling functions (&lt;span style="font-weight: bold;"&gt;dwgOutFields &lt;/span&gt;/ &lt;span style="font-weight: bold;"&gt;dwgInFields&lt;/span&gt;);&lt;br /&gt;- Implement all necessary properties to this object and provide is persistence through &lt;span style="font-weight: bold;"&gt;DWG filling&lt;/span&gt; functions;&lt;br /&gt;- Create two functions. One to &lt;span style="font-weight: bold;"&gt;create the object&lt;/span&gt; and stored it inside NOD and other to &lt;span style="font-weight: bold;"&gt;list all existing&lt;/span&gt; objects. Use your custom Dictionary as &lt;span style="font-weight: bold;"&gt;ShapeApp&lt;/span&gt;;&lt;br /&gt;- Use &lt;span style="font-weight: bold;"&gt;"*" as the key name&lt;/span&gt; of each shape inside &lt;span style="font-weight: bold;"&gt;ShapeApp&lt;/span&gt; Dictionary;&lt;br /&gt;- Create a &lt;span style="font-weight: bold;"&gt;research function&lt;/span&gt; which will receive the shape information and will lookup an existing shape that matches with the information. If it is found, return it's &lt;span style="font-weight: bold;"&gt;ObjectId &lt;/span&gt;instead of create a &lt;span style="font-weight: bold;"&gt;duplicated shape&lt;/span&gt;. If it is not found, create a &lt;span style="font-weight: bold;"&gt;new shape&lt;/span&gt; and return its brand new &lt;span style="font-weight: bold;"&gt;ObjectId&lt;/span&gt;;&lt;br /&gt;- Don't forget to create a &lt;span style="font-weight: bold;"&gt;== operator&lt;/span&gt; for your class to make easy to &lt;span style="font-weight: bold;"&gt;compare shapes&lt;/span&gt; when researching the Dictionary;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Tips&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;- Use the class 12 code fragment to help you with this project;&lt;br /&gt;- Add properties using ARXWizard because it will create the access methods and will put the filling line at &lt;span style="font-weight: bold;"&gt;dwgInFields&lt;/span&gt;() and &lt;span style="font-weight: bold;"&gt;dwgOutFields&lt;/span&gt;() functions;&lt;br /&gt;- Be careful about &lt;span style="font-weight: bold;"&gt;code flow &lt;/span&gt;inside Dictionary manipulation functions;&lt;br /&gt;- Double check your &lt;span style="font-weight: bold;"&gt;open / close&lt;/span&gt; scopes;&lt;br /&gt;- Test &lt;span style="font-weight: bold;"&gt;SAVE &lt;/span&gt;and &lt;span style="font-weight: bold;"&gt;OPEN &lt;/span&gt;the &lt;span style="font-weight: bold;"&gt;DWG &lt;/span&gt;to assert that the custom objects are successfully saved and loaded;&lt;br /&gt;- Use ARXDBG to verify if your custom objects are placed into the right place;&lt;br /&gt;- Use the ObjectARX &lt;span style="font-weight: bold;"&gt;documentation &lt;/span&gt;when necessary;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Support&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;If you have any questions please post your issue on this article to share with others.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Expected time&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;- I will give you &lt;span style="font-weight: bold;"&gt;7 days&lt;/span&gt; to accomplish this Lab;&lt;br /&gt;- After this period, I will post my suggested solution for this.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111560651177388961?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111560651177388961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111560651177388961' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111560651177388961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111560651177388961'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/lab-3-creating-custom-object.html' title='Lab 3 - Creating a custom object'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111551537845507800</id><published>2005-05-07T22:08:00.001-03:00</published><updated>2008-04-11T07:59:26.269-03:00</updated><title type='text'>Call for user samples</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;I have received some messages from users about their samples and I would like to invite all users to post their samples at this Blog. This is a great opportunity to show yourself to other users and share your great ideas to solve common problems.&lt;br /&gt;&lt;br /&gt;So, if you would like to do this you will need to proceed as follows:&lt;br /&gt;&lt;br /&gt;1) Compact your sample project into a &lt;span style="FONT-WEIGHT: bold"&gt;ZIP&lt;/span&gt; file (please exclude all &lt;span style="FONT-WEIGHT: bold"&gt;Debug&lt;/span&gt; \ &lt;span style="FONT-WEIGHT: bold"&gt;Release &lt;/span&gt;directories and all &lt;span style="FONT-WEIGHT: bold"&gt;NCB &lt;/span&gt;files). This will reduce the file size significantly. Include a &lt;span style="FONT-WEIGHT: bold"&gt;ReadMe.txt&lt;/span&gt; file in your sample root folder with the following information:&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Author&lt;/span&gt;: Your name&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Current version&lt;/span&gt;: number this version&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Release history&lt;/span&gt;: list all releases and respective remarks&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;About this sample&lt;/span&gt;: Describe here the sample and what it does, steps to run, limitations, etc.&lt;br /&gt;&lt;br /&gt;2) Send your sample and the above information to &lt;a style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255)" href="mailto:fpmalard@yahoo.com.br"&gt;fpmalard@yahoo.com.br&lt;/a&gt;;&lt;br /&gt;&lt;br /&gt;3) As soon as I read your e-mail I will post it on &lt;span style="FONT-WEIGHT: bold"&gt;OFCDesk FTP&lt;/span&gt; area inside a &lt;span style="FONT-WEIGHT: bold"&gt;UserSamples &lt;/span&gt;folder.&lt;br /&gt;&lt;br /&gt;4) Don't be shame to send codes with errors or with incomplete logic. The main idea is to share your great ideas with others!&lt;br /&gt;&lt;br /&gt;I'm waiting for your samples!&lt;br /&gt;Regards,&lt;br /&gt;Fernando.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111551537845507800?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111551537845507800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111551537845507800' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111551537845507800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111551537845507800'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/call-for-user-samples.html' title='Call for user samples'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111540933790961042</id><published>2005-05-06T16:55:00.000-03:00</published><updated>2005-05-06T16:55:37.970-03:00</updated><title type='text'></title><content type='html'>&lt;a href='http://photos1.blogger.com/img/282/3168/320/AutoCAD_prog.jpg'&gt;&lt;img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/282/3168/400/AutoCAD_prog.jpg'&gt;&lt;/a&gt;&lt;br /&gt;Quick vote results about AutoCAD programming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111540933790961042?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111540933790961042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111540933790961042' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111540933790961042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111540933790961042'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/quick-vote-results-about-autocad.html' title=''/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111499294595499806</id><published>2005-05-01T21:03:00.001-03:00</published><updated>2008-03-24T23:58:54.815-03:00</updated><title type='text'>Class 12 - Deriving from AcDbObject</title><content type='html'>&lt;p align="justify"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;I will start with &lt;b&gt;Custom Objects&lt;/b&gt; and then proceed with custom entities on the next class. Custom objects can be used for several purposes and they are very powerful. Once your application creates and manage a custom object you will be able to construct &lt;b&gt;complex application &lt;/b&gt;structures as well as much more &lt;b&gt;intelligent and efficient data storage&lt;/b&gt;.&lt;/p&gt;&lt;p align="justify"&gt;Starting with a simple example, suppose that you will need to build an ObjectARX application which implements some bars that has a length property and several types of shapes. Is possible that more than one bar has the same shape and it would be nice if you can provide a single instance of shape's information and share it among all bars using this shape.&lt;/p&gt;&lt;p align="justify"&gt;The first impulse is to repeat the information on each bar no matter you will duplicate information. This works but will generate additional problems beyond the first problem which is the unnecessary space used to store the same information. Suppose that you need to update the shape and you would affect all bars that are using this shape. If your information is repeated in all bars you will need to open each bar and update its information. In other hand, if shape's information is stored into one single place and bars reflect this information you will need only to update this information in one place and all bars using this shape will be updated as soon as you update the shape's information.&lt;/p&gt;&lt;p align="justify"&gt;AutoCAD use this technique on several features like layers, text styles, groups, etc. You will use exactly a custom object to store this information and share it, through its &lt;b&gt;ObjectId&lt;/b&gt;, among all "clients" of this object.&lt;/p&gt;&lt;p align="justify"&gt;&lt;b&gt;How to begin&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;As discussed on previous class, you will need to derive from &lt;b&gt;AcDbObject&lt;/b&gt; to be able to build &lt;b&gt;your own custom object&lt;/b&gt;. This can be easily done using the &lt;b&gt;ARXWizard&lt;/b&gt; or you can do by yourself creating the class by hand.&lt;/p&gt;&lt;p align="justify"&gt;After create the class you need build some methods to &lt;b&gt;create, store and acquire those objects&lt;/b&gt; instances from its container. Well, but where you should store your custom objects? AutoCAD provides a general purpose container called &lt;b&gt;Named Object Dictionary&lt;/b&gt; (&lt;b&gt;NOD&lt;/b&gt;). &lt;b&gt;NOD&lt;/b&gt; is capable to store and persist any custom object derived from &lt;b&gt;AcDbObject&lt;/b&gt;. It uses a &lt;b&gt;dictionary like storage structure&lt;/b&gt; where you put a unique key (at the same level) and an object instance through its pointer and ObjectId. There are other custom object containers like &lt;b&gt;Extension Dictionary&lt;/b&gt; that I will avoid due our course audience.&lt;/p&gt;&lt;p align="justify"&gt;The &lt;b&gt;NOD container&lt;/b&gt; could (and should) be organized by folders to make your dictionary as much organized as you can. The &lt;b&gt;first node should be your application name&lt;/b&gt; to avoid conflict with other third-party ObjectARX applications that could use the NOD at the same time as you. The &lt;b&gt;second level should contain all your business groups of objects&lt;/b&gt;. This will really depend on how many and the number of custom object types you have. NOD does not prohibit you to stored different classes at the same level but I really recommend you to avoid this except in case you need to stored generic objects together like on a Preferences group of objects.&lt;/p&gt;&lt;p align="justify"&gt;You don't need to always &lt;b&gt;Open&lt;/b&gt; and &lt;b&gt;Close&lt;/b&gt; the NOD and go deep to find where are your desired object every time you need to access it. You can build some kind of &lt;b&gt;cache of the most used Objects through its ObjectId&lt;/b&gt; and manage this cache to be updated for every single opened drawing. Remember that NOD is part of &lt;b&gt;AcDbDatabase&lt;/b&gt; object and it is &lt;b&gt;per document&lt;/b&gt;. So, you need to care about to build and fill your dictionary for every brand new drawing. &lt;/p&gt;&lt;p align="justify"&gt;&lt;b&gt;How to persist your custom objects&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;As I said before, the most used place to store custom objects is the &lt;b&gt;NOD&lt;/b&gt; which is an &lt;b&gt;AcDbDictionary&lt;/b&gt;. NOD takes care of its child objects because it is a container. So, when the &lt;b&gt;AcDbDatabase&lt;/b&gt; object is issued to save its data by AutoCAD it also pass this message to its child objects and NOD is one of them. Once NOD receives this message it walks through its structure and call &lt;b&gt;dwgOutFields()&lt;/b&gt; for every object stored there. The same process occurs when you open the drawing and the &lt;b&gt;dwgInFields()&lt;/b&gt; is called by &lt;b&gt;AcDbDatabase&lt;/b&gt; on NOD and consequently on its children. Exactly due that you will need to override the &lt;b&gt;DWG filling&lt;/b&gt; methods to make possible to persist your custom objects among &lt;b&gt;DWG open/close sessions&lt;/b&gt;.&lt;/p&gt;&lt;p align="justify"&gt;Essential &lt;b&gt;functions to override&lt;/b&gt; in your custom object class are:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;virtual Acad::ErrorStatus &lt;span style="color:#ff0000;"&gt;&lt;b&gt;dwgInFields&lt;/b&gt;&lt;/span&gt;(AcDbDwgFiler* filer);&lt;br /&gt;virtual Acad::ErrorStatus &lt;span style="color:#ff0000;"&gt;&lt;b&gt;dwgOutFields&lt;/b&gt;&lt;/span&gt;(AcDbDwgFiler* filer) const;&lt;br /&gt;virtual Acad::ErrorStatus &lt;span style="color:#ff0000;"&gt;&lt;b&gt;dxfInFields&lt;/b&gt;&lt;/span&gt;(AcDbDxfFiler* filer);&lt;br /&gt;virtual Acad::ErrorStatus &lt;span style="color:#ff0000;"&gt;&lt;b&gt;dxfOutFields&lt;/b&gt;&lt;/span&gt;(AcDbDxfFiler* filer) const;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;If you don't plan to support DXF interface to your custom object you could avoid them.&lt;/p&gt;&lt;p align="justify"&gt;&lt;b&gt;Object's state management&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;On &lt;b&gt;class 5&lt;/b&gt; we have talked about object states when opening objects. Inside your custom object class you need to pay attention to call the &lt;b&gt;proper assert method&lt;/b&gt; to make sure that all proper events and processes are fired when your object's state has changed. &lt;b&gt;This is very important!&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;Those functions who change your object's data state must first call the &lt;b&gt;assertWriteEnabled()&lt;/b&gt; function and then apply the required modifications. Functions who only read information from your object and does not affect its data state must call &lt;b&gt;assertReadEnabled()&lt;/b&gt; function and also I really recommend that you make all these as const functions. This will avoid you to accidentally change the object's state when it is opened for read what will cause an assert error message. If you forget to call the proper assert method strange things may occur like call &lt;b&gt;UNDO&lt;/b&gt; and your object stay unchanged and a lot other &lt;b&gt;bizarre things&lt;/b&gt;.&lt;/p&gt;&lt;p align="justify"&gt;&lt;b&gt;How to create a custom object&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;To implement your custom object you will need to do the following:&lt;/p&gt;&lt;p align="justify"&gt;1- Derive from AcDbObject;&lt;br /&gt;2- Implement your data;&lt;br /&gt;3- Implement access functions (read/write) with proper assert calls;&lt;br /&gt;4- Implement the filling methods persisting and reading your data;&lt;/p&gt;&lt;p align="justify"&gt;As a baseline, I will present a short example here:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;// Class declaration&lt;br /&gt;// -------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;class &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass&lt;/b&gt;&lt;/span&gt; : public &lt;span style="color:#ff0000;"&gt;&lt;b&gt;AcDbObject&lt;/b&gt;&lt;/span&gt; {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;public:&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;ACRX_DECLARE_MEMBERS&lt;/b&gt;&lt;/span&gt;(&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;MyClass&lt;/span&gt;&lt;/strong&gt;);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;MyClass&lt;/span&gt;&lt;/strong&gt;() {};&lt;br /&gt;virtual ~&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;MyClass&lt;/span&gt;&lt;/strong&gt;() {};&lt;br /&gt;&lt;br /&gt;Acad::ErrorStatus getVal (int&amp;amp; val) const;&lt;br /&gt;Acad::ErrorStatus setVal (int val);&lt;br /&gt;&lt;br /&gt;Acad::ErrorStatus getString (CString&amp;amp; str) const;&lt;br /&gt;Acad::ErrorStatus setString (LPCTSTR str);&lt;br /&gt;&lt;br /&gt;virtual Acad::ErrorStatus &lt;span style="color:#ff0000;"&gt;&lt;b&gt;dwgInFields&lt;/b&gt;&lt;/span&gt;(AcDbDwgFiler*);&lt;br /&gt;virtual Acad::ErrorStatus &lt;span style="color:#ff0000;"&gt;&lt;b&gt;dwgOutFields&lt;/b&gt;&lt;/span&gt;(AcDbDwgFiler*) const;&lt;br /&gt;&lt;br /&gt;private:&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; m_Val;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;CString&lt;/b&gt;&lt;/span&gt; m_Str; &lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;};&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;// Class Definition&lt;br /&gt;// -------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;ACRX_DXF_DEFINE_MEMBERS&lt;/b&gt;&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass&lt;/b&gt;&lt;/span&gt;,&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;AcDbObject&lt;/b&gt;&lt;/span&gt;, AcDb::kDHL_CURRENT,&lt;br /&gt;AcDb::kMReleaseCurrent, 0, &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MYCLASS&lt;/b&gt;&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MYSAMP&lt;/b&gt;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;Acad::ErrorStatus &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass::getVal&lt;/b&gt;&lt;/span&gt; (int&amp;amp; val) const {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;assertReadEnabled&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;val = m_Val;&lt;br /&gt;return Acad::eOk;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;Acad::ErrorStatus &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass::setVal&lt;/b&gt;&lt;/span&gt; (int val) { &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;assertWriteEnabled&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000000;"&gt;m_Val = val;&lt;br /&gt;return Acad::eOk;&lt;/span&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;Acad::ErrorStatus &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass::getString&lt;/b&gt;&lt;/span&gt; (CString&amp;amp; str) const { &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;assertReadEnabled&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;str.Format(_T("%s"),m_Str);&lt;br /&gt;return Acad::eOk;&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;Acad::ErrorStatus &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass::setString&lt;/b&gt;&lt;/span&gt; (LPCTSTR str) { &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;assertWriteEnabled&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#000000;"&gt;m_Str.Format(_T("%s"),str);&lt;br /&gt;return Acad::eOk;&lt;/span&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;Acad::ErrorStatus &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass::dwgInFields&lt;/b&gt;&lt;/span&gt;(AcDbDwgFiler* pFiler) { &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;assertWriteEnabled&lt;/span&gt;();&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;AcDbObject::dwgInFields(pFiler);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;Adesk::Int16 _val = 0;&lt;br /&gt;pFiler-&amp;gt;&lt;strong&gt;readInt16&lt;/strong&gt;(&amp;amp;_val);&lt;br /&gt;m_Val = _val;&lt;br /&gt;TCHAR* _temp = NULL;&lt;br /&gt;pFiler-&amp;gt;&lt;strong&gt;readString&lt;/strong&gt;(&amp;amp;_temp);&lt;br /&gt;m_Str.Format(_T("%s"),_temp);&lt;br /&gt;&lt;strong&gt;acutDelString&lt;/strong&gt;(_temp);&lt;br /&gt;&lt;br /&gt;return pFiler-&amp;gt;filerStatus();&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;Acad::ErrorStatus &lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass::dwgOutFields&lt;/b&gt;&lt;/span&gt;(AcDbDwgFiler* pFiler) const { &lt;/span&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;assertReadEnabled&lt;/span&gt;();&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;AcDbObject::dwgOutFields(pFiler);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;pFiler-&amp;gt;&lt;strong&gt;writeInt16&lt;/strong&gt;(m_Val);&lt;br /&gt;pFiler-&amp;gt;&lt;strong&gt;writeString&lt;/strong&gt;(static_cast&amp;lt;const TCHAR*&amp;gt;(m_Str));&lt;br /&gt;&lt;br /&gt;return pFiler-&amp;gt;filerStatus();&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;// -------------------------------------------&lt;br /&gt;// Entry Point&lt;br /&gt;// -------------------------------------------&lt;br /&gt;&lt;/span&gt;AcRx::AppRetCode &lt;span style="color:#ff0000;"&gt;&lt;b&gt;acrxEntryPoint&lt;/b&gt;&lt;/span&gt;(AcRx::AppMsgCode msg, void* appId) {&lt;br /&gt;switch (msg) {&lt;br /&gt;case AcRx::&lt;span style="color:#0000ff;"&gt;&lt;b&gt;kInitAppMsg&lt;/b&gt;&lt;/span&gt;: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;acrxDynamicLinker-&amp;gt;unlockApplication(appId);&lt;br /&gt;acrxDynamicLinker-&amp;gt;registerAppMDIAware(appId);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;MyClass::rxInit();&lt;br /&gt;acrxBuildClassHierarchy();&lt;/b&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;break;&lt;br /&gt;&lt;br /&gt;case AcRx::&lt;span style="color:#0000ff;"&gt;&lt;b&gt;kUnloadAppMsg&lt;/b&gt;&lt;/span&gt;: &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;deleteAcRxClass(MyClass::desc());&lt;/b&gt;&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;break;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return AcRx::kRetOK;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;b&gt;How to create and store your custom object&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;The NOD container is based on AcDbDictionary class which has several methods to read, write and erase entries. Your application needs to take care of NOD entries and be responsible to create instances of your custom class and store these objects inside the NOD. Each object stored must have a key defined or a generic key using the star * as its name.&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;void &lt;b&gt;createMyObjects&lt;/b&gt;() {&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDbDictionary&lt;/b&gt;&lt;/span&gt; *pNamedobj = NULL;&lt;br /&gt;acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;getNamedObjectsDictionary&lt;/b&gt;&lt;/span&gt;(pNamedobj, AcDb::kForWrite); &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDbDictionary&lt;/b&gt;&lt;/span&gt; *pDict = NULL;&lt;br /&gt;if (pNamedobj-&amp;gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;getAt&lt;/b&gt;&lt;/span&gt;(_T("&lt;span style="color:#800080;"&gt;&lt;b&gt;MYDICT&lt;/b&gt;&lt;/span&gt;"),(AcDbObject*&amp;amp;) pDict,&lt;br /&gt;AcDb::kForWrite) == &lt;b&gt;&lt;span style="color:#0000ff;"&gt;Acad::eKeyNotFound&lt;/span&gt;&lt;/b&gt;) {&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;pDict = &lt;span style="color:#ff0000;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDbDictionary&lt;/b&gt;&lt;/span&gt;;&lt;br /&gt;AcDbObjectId DictId;&lt;br /&gt;pNamedobj-&amp;gt;setAt(_T("&lt;span style="color:#800080;"&gt;&lt;b&gt;MYDICT&lt;/b&gt;&lt;/span&gt;"), pDict, DictId);&lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;br /&gt;pNamedobj-&amp;gt;close();&lt;br /&gt;&lt;br /&gt;if (pDict) { &lt;/span&gt;&lt;/p&gt;&lt;span style="color:#0000ff;"&gt;&lt;blockquote&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;MyClass&lt;/span&gt; *pObj1 = &lt;span style="color:#ff0000;"&gt;new&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;MyClass&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;pObj1-&amp;gt;setVal(1);&lt;br /&gt;pObj1-&amp;gt;setString(_T("String1"));&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;MyClass&lt;/span&gt; *pObj2 = &lt;span style="color:#ff0000;"&gt;new&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;MyClass&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;pObj2-&amp;gt;setVal(2);&lt;br /&gt;pObj2-&amp;gt;setString(_T("String2"));&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;AcDbObjectId&lt;/span&gt; rId1, rId2;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:courier new;font-size:85%;color:#000000;"&gt;pDict-&amp;gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;setAt&lt;/span&gt;&lt;/strong&gt;(_T("&lt;strong&gt;&lt;span style="color:#663366;"&gt;*M&lt;/span&gt;&lt;/strong&gt;"),pObj1, rId1);&lt;br /&gt;pDict-&amp;gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;setAt&lt;/span&gt;&lt;/strong&gt;(_T("&lt;strong&gt;&lt;span style="color:#663366;"&gt;*M&lt;/span&gt;&lt;/strong&gt;"),pObj2, rId2);&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;pObj1-&amp;gt;close();&lt;br /&gt;pObj2-&amp;gt;close();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;pDict-&amp;gt;close();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;/span&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;b&gt;How to verify if my objects are really stored inside NOD?&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;You will need to iterate the NOD entries to find your dictionary and then perform an iteration over its entries. The process should be something like this:&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;void &lt;b&gt;listMyObjects&lt;/b&gt;() {&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDbDictionary&lt;/b&gt;&lt;/span&gt; *pNamedobj = NULL;&lt;br /&gt;acdbHostApplicationServices()-&amp;gt;workingDatabase()&lt;br /&gt;-&amp;gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;getNamedObjectsDictionary&lt;/b&gt;&lt;/span&gt;(pNamedobj, AcDb::kForRead); &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDbDictionary&lt;/b&gt;&lt;/span&gt; *pDict = NULL;&lt;br /&gt;pNamedobj-&amp;gt;getAt(_T("&lt;span style="color:#800080;"&gt;&lt;b&gt;MYDICT&lt;/b&gt;&lt;/span&gt;"), (AcDbObject*&amp;amp;)pDict,AcDb::kForRead);&lt;br /&gt;pNamedobj-&amp;gt;close();&lt;br /&gt;&lt;br /&gt;if (pDict == NULL) {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;acutPrintf(_T("\nThe dictionary MYDICT does not exist. Please create it first!"));&lt;br /&gt;return; &lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDbDictionaryIterator&lt;/b&gt;&lt;/span&gt;* pDictIter= pDict-&amp;gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;newIterator&lt;/b&gt;&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;MyClass&lt;/b&gt;&lt;/span&gt; *pMyClass;&lt;br /&gt;int _val;&lt;br /&gt;CString _str;&lt;br /&gt;&lt;br /&gt;for (; !pDictIter-&amp;gt;done(); pDictIter-&amp;gt;next()) {&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;pMyClass = NULL;&lt;br /&gt;pDictIter-&amp;gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;getObject&lt;/b&gt;&lt;/span&gt;((AcDbObject*&amp;amp;)pMyClass,&lt;span style="color:#0000ff;"&gt;&lt;b&gt;AcDb::kForRead&lt;/b&gt;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;if (pMyClass != NULL) {&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;pMyClass-&amp;gt;getVal(_val);&lt;br /&gt;pMyClass-&amp;gt;getString(_str);&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;pMyClass-&amp;gt;close();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;acutPrintf(_T("\nMyClass: val=%d, str=%s"),_val,_str); &lt;/span&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#ff0000;"&gt;&lt;b&gt;delete pDictIter;&lt;br /&gt;pDict-&amp;gt;close();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;Stay tuned for the next Lab which will require you to build a custom object. See you there!&lt;/p&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111499294595499806?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111499294595499806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111499294595499806' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111499294595499806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111499294595499806'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/05/class-12-deriving-from-acdbobject.html' title='Class 12 - Deriving from AcDbObject'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111439489907382550</id><published>2005-04-24T22:51:00.000-03:00</published><updated>2005-04-24T23:53:09.876-03:00</updated><title type='text'>Class 11 - Custom ObjectARX Class</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In my personal opinion, the greatest feature of &lt;span style="font-weight: bold;"&gt;ObjectARX &lt;/span&gt;is the capability to develop your own &lt;span style="font-weight: bold;"&gt;objects and entities&lt;/span&gt;. This powerful feature will allow you to create &lt;span style="font-weight: bold;"&gt;complex applications&lt;/span&gt; and provide your users a unique experience using your software.&lt;br /&gt;&lt;br /&gt;This feature is possible since ObjectARX beginning (officially at &lt;span style="font-weight: bold;"&gt;AutoCAD R13&lt;/span&gt;). Since Autodesk provided this feature, its own developers thought that they could develop their selves &lt;span style="font-weight: bold;"&gt;vertical solutions&lt;/span&gt; for the most interesting market areas. At that time, products like MAP, MCAD and ADT start to show up.&lt;br /&gt;&lt;br /&gt;Today there are several vertical products based on AutoCAD made by Autodesk and much more developed by third-party companies.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How is this possible?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ObjectARX takes full advantage of &lt;span style="font-weight: bold;"&gt;C++ language features&lt;/span&gt; like &lt;span style="font-weight: bold;"&gt;inheritance&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;polymorphism &lt;/span&gt;and &lt;span style="font-weight: bold;"&gt;overriding &lt;/span&gt;among many others. This allows Autodesk to publish part of AutoCAD source code using a SDK like package with library and header files.&lt;br /&gt;&lt;br /&gt;Beyond this point, ObjectARX exports some classes allowing you to derive from them and &lt;span style="font-weight: bold;"&gt;implement your own behavior&lt;/span&gt; taking advantage of all ready-to-use methods and overriding those ones you need.&lt;br /&gt;&lt;br /&gt;This way, when your custom class is defined and implemented your &lt;span style="font-weight: bold;"&gt;application will be compiled and linked with AutoCAD native libraries and headers &lt;/span&gt;and will be possible to load your module (DLL) at runtime to use your own objects inside AutoCAD! Great hum?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;When to use and when not to use custom objects&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Even being a powerful feature of ObjectARX, custom objects are not the best solution for any kind of implementation. Sometimes is better to user another solution like &lt;span style="font-weight: bold;"&gt;XData &lt;/span&gt;or &lt;span style="font-weight: bold;"&gt;XRecords&lt;/span&gt;. This will totally depend on how much complex your application is and how much complex will be the way users will interact with your product.&lt;br /&gt;&lt;br /&gt;You need to &lt;span style="font-weight: bold;"&gt;be sure when to use or not custom classes&lt;/span&gt; inside ObjectARX. Personally I perform some questions to myself that will help me to decide:&lt;br /&gt;&lt;br /&gt;- My product's elements are &lt;span style="font-weight: bold;"&gt;simple or complex&lt;/span&gt;?&lt;br /&gt;- My elements are only complex in terms of &lt;span style="font-weight: bold;"&gt;non-graphical data&lt;/span&gt; or they will require &lt;span style="font-weight: bold;"&gt;complex graphical representation&lt;/span&gt;?&lt;br /&gt;- Do I need to &lt;span style="font-weight: bold;"&gt;protect my element's data&lt;/span&gt; when the drawing is out of my company?&lt;br /&gt;- Will my elements present a &lt;span style="font-weight: bold;"&gt;complex interaction with users&lt;/span&gt; very different from AutoCAD native entities?&lt;br /&gt;- Do I need to &lt;span style="font-weight: bold;"&gt;share common information&lt;/span&gt; among my elements?&lt;br /&gt;&lt;br /&gt;These questions will really help you to decide or not to user custom classes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to use a custom objects?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The first step is to &lt;span style="font-weight: bold;"&gt;choose your base class&lt;/span&gt;. This will depend on what type of custom object are you willing to implement. Basically you need to choose if &lt;span style="font-weight: bold;"&gt;it will represent an entity or a data object&lt;/span&gt;. If it will be an entity you will need to derive it from &lt;span style="font-weight: bold;"&gt;AcDbEntity &lt;/span&gt;or other of its derived classes. In other hand, if it will not have graphical appearance, you will derive it from &lt;span style="font-weight: bold;"&gt;AcDbObject&lt;/span&gt;. There are some ObjectARX classes that does not allow you to derive from. Take a look at ObjectARX documentation for a complete list.&lt;br /&gt;&lt;br /&gt;It is very important to you clearly understand these differences between AcDbEntity and AcDbObject. &lt;span style="font-weight: bold;"&gt;Remember that every AcDbEntity if also an AcDbObject but NOT ALL AcDbObject is an AcDbEntity&lt;/span&gt;. This is because &lt;span style="font-weight: bold;"&gt;AcDbEntity is derived from AcDbObject&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;I really would like you to walk through the ObjectARX class hierarchy to locate yourself in that tree and see clearly what are we talking about. There is a DWG file, called &lt;span style="font-weight: bold;"&gt;classmap.dwg&lt;/span&gt;, inside your ObjectARX SDK folder called &lt;span style="font-weight: bold;"&gt;\classmap&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Runtime Identification&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;AutoCAD requires that every custom class has its own runtime type identification. This will be used by AutoCAD and by your own application. Basically you don't need to care about this because there are &lt;span style="font-weight: bold;"&gt;MACROS &lt;/span&gt;to do this job for you. The &lt;span class="courier"&gt;&lt;span style="font-weight: bold;"&gt;AcRxObject &lt;/span&gt;class is the responsible to perform this feature and exactly due that it is on the top of AcRx tree.&lt;br /&gt;&lt;br /&gt;The runtime identification is made by some functions like the following:&lt;br /&gt;&lt;/span&gt; &lt;ul&gt; &lt;li class="bullet_1_begin"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:85%;" class="courier" &gt;desc()&lt;/span&gt;&lt;span style="font-size:85%;"&gt;, a static member  function that returns the class descriptor object of a particular (known)  class.&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt; &lt;li class="bullet_1"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:85%;" class="courier" &gt;cast()&lt;/span&gt;&lt;span class="body"  style="font-size:85%;"&gt;, a static  member function that &lt;/span&gt;&lt;span style="font-size:85%;"&gt;returns an object of the specified type, or &lt;/span&gt;&lt;span class="courier"  style="font-size:85%;"&gt;NULL&lt;/span&gt;&lt;span style="font-size:85%;"&gt; if the object is not of the required class (or a  derived class).&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;  &lt;/li&gt;&lt;li class="bullet_1"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:85%;" class="courier" &gt;isKindOf()&lt;/span&gt;&lt;span style="font-size:85%;"&gt; returns whether an  object belongs to the specified class (or a derived class). &lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;ul&gt; &lt;li class="bullet_1_end"&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 255);font-size:85%;" class="courier" &gt;isA()&lt;/span&gt;&lt;span style="font-size:85%;"&gt; returns the class  descriptor object of an object whose class is unknown.&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; These functions are pretty useful because they help you to get &lt;span style="font-weight: bold;"&gt;runtime important information&lt;/span&gt; from AutoCAD native objects and your own objects. A good example if when you have a pointer to an &lt;span style="font-weight: bold;"&gt;AcDbEntity &lt;/span&gt;and would like to know if it is an &lt;span style="font-weight: bold;"&gt;AcDbCircle or an AcDbLine&lt;/span&gt;. How? Just use the above functions to get the information or even try to cast the pointer.&lt;br /&gt;&lt;br /&gt;To declare these functions you will need to use the following MACRO inside your class declaration:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);font-size:85%;" &gt;ACRX_DECLARE_MEMBERS&lt;/span&gt;&lt;span style="font-size:85%;"&gt;(&lt;/span&gt;&lt;span class="courier"  style="font-size:85%;"&gt;CLASS_NAME&lt;/span&gt;&lt;span style="font-size:85%;"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To implement these functions, you will need to use one of the following &lt;span style="font-weight: bold;"&gt;MACROS&lt;/span&gt;:&lt;br /&gt;&lt;ul style="text-align: left;"&gt; &lt;li class="bullet_1_begin"&gt;&lt;span class="courier"  style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;ACRX_NO_CONS_DEFINE_MEMBERS&lt;/span&gt; (CLASS_NAME,  PARENT_CLASS):&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Use for &lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;abstract classes&lt;/span&gt;&lt;span style="font-size:85%;"&gt; and any other classes that should  not be instantiated. &lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div style="text-align: left;"&gt;  &lt;/div&gt; &lt;ul style="text-align: left;"&gt; &lt;li class="bullet_1"&gt;&lt;span class="courier"  style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;ACRX_CONS_DEFINE_MEMBERS &lt;/span&gt;(CLASS_NAME,  PARENT_CLASS, VERNO):&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Use for &lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;transient classes&lt;/span&gt;&lt;span style="font-size:85%;"&gt; that can be instantiated but are  not written to file. &lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div style="text-align: left;"&gt;  &lt;/div&gt; &lt;ul style="text-align: left;"&gt; &lt;li class="bullet_1"&gt;&lt;span class="courier"  style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;ACRX_DXF_DEFINE_MEMBERS &lt;/span&gt;(CLASS_NAME,PARENT_CLASS, DWG_VERSION, MAINTENANCE_VERSION, PROXY_FLAGS, DXF_NAME,  APP):&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Use for classes that can be &lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;written to, or read from, DWG  and DXF&lt;/span&gt;&lt;span style="font-size:85%;"&gt; files.&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;  Additionally, you will need to &lt;span style="font-weight: bold;"&gt;initialize and delete your custom class&lt;/span&gt; from ObjectARX runtime tree which can be done, during your application's &lt;span style="font-weight: bold;"&gt;kInitAppMsg &lt;/span&gt;and &lt;span style="font-weight: bold;"&gt;kUnloadAppMsg &lt;/span&gt;using the following functions implemented by the above MACROS:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;&lt;span style="color: rgb(0, 102, 0);"&gt;// Inside kInitAppMsg function handler&lt;/span&gt;&lt;br /&gt;MyClass::&lt;span style="font-weight: bold;"&gt;rxInit()&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;// Call this only once for all of your custom classes&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;acrxBuildClassHierarchy()&lt;/span&gt;; &lt;span style="color: rgb(0, 102, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 255);font-family:courier new;" &gt;&lt;span style="color: rgb(0, 102, 0);"&gt;// Inside kUnloadAppMsg function handler&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-weight: bold; color: rgb(255, 0, 0);"&gt;deleteAcRxClass&lt;/span&gt;(&lt;span style="color: rgb(51, 51, 255); font-weight: bold;"&gt;MyClass::desc()&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will guarantee that when your application is loaded AutoCAD recognizes your class and when it was not present (unloaded) AutoCAD will transform your class instances into &lt;span style="font-weight: bold;"&gt;Proxy &lt;/span&gt;entities. Proxy entities are a binary package that &lt;span style="font-weight: bold;"&gt;protects and preserves your custom object&lt;/span&gt; during DWG roundtrip without your application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111439489907382550?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111439489907382550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111439489907382550' title='34 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111439489907382550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111439489907382550'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/class-11-custom-objectarx-class.html' title='Class 11 - Custom ObjectARX Class'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>34</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111436300129259315</id><published>2005-04-24T14:08:00.004-03:00</published><updated>2010-05-17T09:46:30.418-03:00</updated><title type='text'>Lab 2 - Solved</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;Hope you have successfully found a solution for this Lab. I will present my solution which does not mean that it is the best solution. It is just my solution.&lt;br /&gt;&lt;br /&gt;After follow the Lab instructions I have successfully created the project and the Dialog (derived from AcUiDialog). I have created the proposed layout with the Combo and Select button.&lt;br /&gt;&lt;br /&gt;Inside the dialog class header, I have added the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;&lt;span style="color: #3333ff; font-weight: bold;"&gt;ads_name&lt;/span&gt; m_sset;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will store my selection set. Next, I have attached an event to my select button which fires the following function:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;BeginEditorCommand&lt;/span&gt;();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;// Issue selection&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;acedSSFree&lt;/span&gt;(m_sset);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;int err = &lt;span style="color: red; font-weight: bold;"&gt;acedSSGet&lt;/span&gt;(NULL, NULL, NULL, NULL, m_sset);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;if (err != &lt;span style="color: #993399; font-weight: bold;"&gt;RTNORM&lt;/span&gt;) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;span style="color: #3333ff; font-weight: bold;"&gt;MessageBox&lt;/span&gt;(_T("Selection error."),_T("DlgColor"),&lt;span style="color: #993399; font-weight: bold;"&gt;MB_ICONEXCLAMATION&lt;/span&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;long length = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;acedSSLength&lt;/span&gt;(m_sset, &amp;amp;length);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;m_btn_apply.&lt;span style="color: #3333ff; font-weight: bold;"&gt;EnableWindow&lt;/span&gt;(length &amp;gt; 0);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;span style="color: red; font-weight: bold;"&gt;CompleteEditorCommand&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will request the user to perform a selection set at AutoCAD screen. Note that we need to hide the dialog and switch back when finished. Note that m_btn_apply should be mapped to the OK button.&lt;br /&gt;&lt;br /&gt;After that, we will need to perform the modifications walking through the selection set, get each entity's ObjectId, open it and then change the color according to the selected Combo item. So, the event fired when clicking on the Apply button will be:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-size: 85%;"&gt;&lt;span style="color: #3333ff; font-weight: bold;"&gt;CAcUiDialog&lt;/span&gt;::OnOK();&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;// Retrieve selected color in ComboBox&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #3333ff;"&gt;AcCmColor &lt;/span&gt;clr;&lt;br /&gt;m_color.&lt;span style="color: red; font-weight: bold;"&gt;GetCurrentItemColor&lt;/span&gt;(clr);&lt;br /&gt;&lt;br /&gt;long i, length;&lt;br /&gt;ads_name ename;&lt;br /&gt;&lt;span style="color: #3333ff;"&gt;AcDbObjectId &lt;/span&gt;entId;&lt;br /&gt;&lt;span style="color: red; font-weight: bold;"&gt;acedSSLength&lt;/span&gt;(m_sset, &amp;amp;length);&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #009900;"&gt;// Traverse selected entities&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #993399; font-weight: bold;"&gt;acdbTransactionManager&lt;/span&gt;-&amp;gt;&lt;span style="color: red; font-weight: bold;"&gt;startTransaction&lt;/span&gt;();&lt;br /&gt;for (i = 0; i &amp;lt; length; i++) { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-size: 85%;"&gt;&lt;span style="color: #009900;"&gt;// Get each entity's objectId&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;acedSSName&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;(m_sset, i, ename);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;acdbGetObjectId&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;(entId, ename);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #009900; font-family: courier new; font-size: 85%;"&gt;// Open the entity and set its color&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: courier new; font-size: 85%;"&gt;AcDbEntity&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;* pEnt = NULL;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;if (&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;acdbTransactionManager&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;-&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;getObject&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;((&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: courier new; font-size: 85%;"&gt;AcDbObject&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;*&amp;amp;)pEnt,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;entId,&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: courier new; font-size: 85%;"&gt;AcDb::kForWrite&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;) == &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: courier new; font-size: 85%;"&gt;Acad::eOk&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;pEnt-&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;setColor&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;(clr);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #009900; font-family: courier new; font-size: 85%;"&gt;// Don't need to close because we're using Transaction&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;acdbTransactionManager&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;-&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;endTransaction&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 85%; font-weight: bold;"&gt;acedSSFree&lt;/span&gt;&lt;span style="font-size: 85%;"&gt;&lt;span style="font-family: courier new;"&gt;(m_sset);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it!&lt;br /&gt;Hope you enjoy this sample.&lt;br /&gt;&lt;br /&gt;You may download this sample from here: &lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/Labs/ARXLAB2.zip"&gt;ARXLAB2.zip&lt;/a&gt;!&lt;br /&gt;&lt;br /&gt;Stay tuned for the next classes! &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111436300129259315?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111436300129259315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111436300129259315' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111436300129259315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111436300129259315'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/lab-2-solved.html' title='Lab 2 - Solved'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111365910040821314</id><published>2005-04-16T10:45:00.001-03:00</published><updated>2008-03-25T00:04:03.058-03:00</updated><title type='text'>Lab 2 - Using a MFC dialog</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Our second Lab will cover MFC contents and some interaction with AutoCAD. The main idea is to keep this lab simple to consolidate MFC and user interaction knowledge.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Requirements&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;* Class 1 to 10;&lt;br /&gt;* AutoCAD 2004/2005/2006 or compatible vertical installed;&lt;br /&gt;* Visual Studio .NET 2002 installed;&lt;br /&gt;* ObjectARX Wizard installed.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Objectives&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;Create a simple ObjectARX module with 1 commands: &lt;span style="FONT-WEIGHT: bold"&gt;DLGCOLOR&lt;/span&gt;. This command will create a simple MFC dialog with a color combo box and one selection button. As the user clicks on this button it will prompt user to select one or more existing entities. After click Apply it will change the color of all selected entity.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Instructions&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;- Create a project called &lt;span style="FONT-WEIGHT: bold"&gt;ARXLAB2 &lt;/span&gt;using ObjectARX Wizard;&lt;br /&gt;- Enable Using MFC option with AutoCAD MFC Extensions;&lt;br /&gt;- Click on the a&gt; icon at ARXWizard's toolbar to open command dialog;&lt;br /&gt;- Right click on the above portion and select New;&lt;br /&gt;- Change the global an local name for &lt;span style="FONT-WEIGHT: bold"&gt;DLGCOLOR &lt;/span&gt;and select Modal as command mode;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/img/282/3168/320/lab2_001.jpg"&gt;&lt;img style="BORDER-RIGHT: rgb(0,0,0) 1px solid; BORDER-TOP: rgb(0,0,0) 1px solid; MARGIN: 2px; BORDER-LEFT: rgb(0,0,0) 1px solid; BORDER-BOTTOM: rgb(0,0,0) 1px solid" src="http://photos1.blogger.com/img/282/3168/400/lab2_001.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;- Open the Visual Studio Editor and add a new dialog layout. Add a &lt;span style="FONT-WEIGHT: bold"&gt;combo box&lt;/span&gt; control and a &lt;span style="FONT-WEIGHT: bold"&gt;button &lt;/span&gt;control;&lt;br /&gt;- Open the &lt;span style="FONT-WEIGHT: bold"&gt;Autodesk Class Explorer&lt;/span&gt;, right click on the root and select &lt;span style="FONT-WEIGHT: bold"&gt;Add MFC Ext. Class&lt;/span&gt;. Select &lt;span style="FONT-WEIGHT: bold"&gt;CAcUiDialog &lt;/span&gt;as the base class;&lt;br /&gt;- In the dialog layout, right click on the combo box and select &lt;span style="FONT-WEIGHT: bold"&gt;Add Variable&lt;/span&gt;. Choose &lt;span style="FONT-WEIGHT: bold"&gt;CAcUiTrueColorComboBox &lt;/span&gt;as its class and name it as &lt;span style="FONT-WEIGHT: bold"&gt;m_color&lt;/span&gt;. Right click on the combo again and select Properties. Set &lt;span style="FONT-WEIGHT: bold"&gt;Has Strings = True&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold"&gt;Owner Draw = Fixed&lt;/span&gt;;&lt;br /&gt;- Now, right click the button and select &lt;span style="FONT-WEIGHT: bold"&gt;Add Variable&lt;/span&gt;. Choose &lt;span style="FONT-WEIGHT: bold"&gt;CAcUiSelectButton &lt;/span&gt;as its class and name it as &lt;span style="FONT-WEIGHT: bold"&gt;m_select&lt;/span&gt;. Right click once more, select Properties. Set &lt;span style="FONT-WEIGHT: bold"&gt;Owner Draw = True&lt;/span&gt;.&lt;br /&gt;- Add the &lt;span style="FONT-WEIGHT: bold"&gt;virtual BOOL OnInitDialog()&lt;/span&gt; method. Inside its implementation add the following:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;CAcUiDialog&lt;/span&gt;::OnInitDialog();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;SetWindowText&lt;/span&gt;(_T("ObjectARX for Dummies - Lab 2"));&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;m_select&lt;/span&gt;.&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AutoLoad&lt;/span&gt;();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;return &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;TRUE&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- Map a click event to selection button. Right click on it, select &lt;span style="FONT-WEIGHT: bold"&gt;Add Event Handler&lt;/span&gt;. Select &lt;span style="FONT-WEIGHT: bold"&gt;BN_CLICKED&lt;/span&gt; event. Inside the event function, we will need to hide the dialog and switch to AutoCAD screen. As we have derived from &lt;span style="FONT-WEIGHT: bold"&gt;CAcUiDialog&lt;/span&gt; it already has a couple of functions to do that. So we will need to hide the dialog, select the desired entities and then show the dialog back. Your function outline will be something like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;BeginEditorCommand&lt;/span&gt;();&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0);font-family:courier new;" &gt;// Perform here the user interaction (allow user to select entities)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;CompleteEditorCommand&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;- Don't forget to switch the resources to your application before open the dialog:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;CAcModuleResourceOverride &lt;/span&gt;res;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;CDlgColor &lt;/span&gt;dlg;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;dlg.&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;DoModal&lt;/span&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Tips&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;- Don't forget to call &lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt; for all selected entities (use a Transaction if you prefer);&lt;br /&gt;- Explore the code to understand what ARX Wizard has created for you;&lt;br /&gt;- Pay attention to code &lt;span style="FONT-WEIGHT: bold"&gt;syntax&lt;/span&gt;;&lt;br /&gt;- Use the ObjectARX &lt;span style="FONT-WEIGHT: bold"&gt;documentation &lt;/span&gt;when necessary;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Support&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;If you have any questions please post your issue on this article to share with others.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Expected time&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;- I will give you &lt;span style="FONT-WEIGHT: bold"&gt;3 days&lt;/span&gt; to accomplish this Lab;&lt;br /&gt;- After this period, I will post my suggested solution for this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111365910040821314?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111365910040821314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111365910040821314' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111365910040821314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111365910040821314'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/lab-2-using-mfc-dialog.html' title='Lab 2 - Using a MFC dialog'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111342199640504875</id><published>2005-04-13T16:30:00.000-03:00</published><updated>2006-11-24T10:36:24.413-02:00</updated><title type='text'>The "Big Picture" - Interview with Jim Quanci (Autodesk)</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;Sometimes we get too deep into programming and loose focus about the most important things involved in our business. Companies are discovering the great benefits of develop their own solutions for AutoCAD. Thinking on this, I have decided to make another interview to allow you to see the "&lt;span style="font-weight: bold; font-style: italic;"&gt;Big Picture&lt;/span&gt;" of &lt;span style="font-weight: bold;"&gt;ObjectARX &lt;/span&gt;development. I have contacted &lt;span style="font-weight: bold;"&gt;Jim Quanci&lt;/span&gt;, &lt;span style="font-weight: bold;"&gt;ADN Program Worldwide (Senior Manager)&lt;/span&gt;, to talk about these things around ObjectARX development. Hope you stop to code a little bit and think about what Jim have answered!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Jim, how long are you an Autodesk member and from where you begin inside Autodesk until reach the current position?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] I have been at Autodesk for just over 15 years – started when Autodesk just released AutoCAD Release 10. I initially started working with Autodesk’s hardware partners of which there were many. This was back in the days when we supported 9 different hardware platforms including several Unix flavors and the Mac. After working with software partners in Americas and then in Asia for several year as part of the Autodesk Registered Developer Program, my team started the Autodesk Developer Network (in 1997).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;On the last Autodesk University people have talked about how to involve users and developers communities around Autodesk products. What is your personal opinion about this strategy and how ADN is contributing on this?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] Companies are becoming increasingly sophisticated users of technology and are being driven to integrate their technology systems to stay competitive. Users and developers are searching for ways to integrate the software technologies they are using for competitive advantage. I believe by creating wide awareness of the capabilities to integrate Autodesk technologies with other systems including CRM and ERP, users and developers will move toward taking advantage of the depth and breadth of Autodesk product customization capabilities. ADN is just one of several programs from Autodesk helping users and developers get the most from their software investments. Along with ADN, other Autodesk programs supporting deeper use of Autodesk products and technologies include Autodesk Subscription, Autodesk Training Centers (ATC), Autodesk Official Training Courseware (AOTC) and Autodesk Inventor Certified Expert.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;ADN is getting bigger and today we can see several companies working on products that run on the top of AutoCAD. Why some people still can't see clearly the power of customized solutions?&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] Today, over 2500 companies from around the world develop custom solutions based on Autodesk platforms. Over 300 companies join ADN for the first time every year. The number of Autodesk customers developing custom built applications to give them a competitive advantage is growing every year. It is just a matter of time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;What are the main benefits to develop your own solutions inside AutoCAD?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] The primary advantage of using an existing design product to build an application on is all about not reinventing the wheel. Autodesk’s is investing hundreds of millions of dollars every year increasing the capabilities of Autodesk design platforms – AutoCAD, Autodesk Inventor, Autodesk Map 3D, Autodesk Architectural desktop, Autodesk Revit and more. Why invest money developing basic design functionality and all the ancillary support software needed to work with printers and graphics cards from numerous manufacturers?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Why so many developers stay away from ObjectARX? Is this due its long learning curve, poor documentation (like books and websites) or just because they love VBA and VisualLISP?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] The idea that people avoid ObjectARX is a misnomer. ObjectARX is the most popular API for ADN members with over 50% of ADN members using ObjectARX – more then LISP, VB and VBA. Among Autodesk customers, LISP, VB and VBA are more popular then ObjectARX which makes a lot of sense as casual part time software developers frequently don’t have the time to become C++ proficient.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;ADN has a subscription cost that is cheap for companies but very expensive for independent developers. Is there any plans to create a lower rate (or even free) limited subscription program for this kind of developers?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] The lowest cost option to join ADN today is 1200 (USD in Americas and APac and Euros in the rest of the world). This includes access to virtually all Autodesk products, unlimited direct support from Autodesk software engineers, and attendance at future technology briefings – at no extra cost. Compare this to the Microsoft Developer Network where one pays $2000 for access to most software and for limited direct support. We are not currently planning a lower cost ADN membership offering. Today we provide basic application development information through the Autodesk Developer Center (www.autodesk.com/adn) with free/self support through customization discussion groups.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;ADN promote several events around the world but these events are closed to ADN members. Is there any Autodesk developer event opened to all users?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] I believe you meant to say are there ADN events that are open to non-ADN members. The answers is yes. We hold software development conferences for non-ADN members at several sites around the world every year – to bring customers up to speed on our latest technologies while we also promote their joining ADN to learn. Last year we held these “open to everyone API conferences” in China, Japan, United States, England, Sweden, and Germany. In this coming year, we expect to hold similar API conferences in China, Russia, Poland, and several other countries. One does need to be an ADN members to participate in our annual “Autodesk Developer Days” conferences where we present confidential information to ADN members on future releases of Autodesk products and technologies.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;How many ADN members are registered today and how Autodesk plans to expand this number?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] There are over 2500 ADN members today and the number is growing every year. We are investing especially heavily this year recruiting new ADN members in China and Eastern Europe.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;We currently have AUGI as an opened group for AutoCAD users. Is that possible that Autodesk support or even create some kind of ADGI (Autodesk Developers Group International) ?&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] Autodesk would be happy to support such a group – as we supported “Autodesk Developers Group Europe” (ADGE) for many years. ADN is the Autodesk support program for professional software developers. We are not currently pursuing creating and ADGE like group ourselves.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;How do you think .NET will change the way developers create solutions today?&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[JIM:] .NET is all about increasing programmer productivity. To some degree, .NET was hijacked by the Internet boom. Many people missed that the primary benefit of .NET is not about the Internet but about giving programmers easy to learn and use powerful tools to get their job done. .NET makes C++ experts faster/more productive. .NET gives VB programmers the power of C++ without the complexity. .NET is a great software development environment and Visual Studio .NET is a great software development tool – a big improvement over past software development technologies.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;Thank you!&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111342199640504875?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111342199640504875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111342199640504875' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111342199640504875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111342199640504875'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/big-picture-interview-with-jim-quanci.html' title='The &quot;Big Picture&quot; - Interview with Jim Quanci (Autodesk)'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111327321892370228</id><published>2005-04-11T22:36:00.000-03:00</published><updated>2005-04-18T00:21:57.146-03:00</updated><title type='text'>Class 10 - Using MFC</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;This class is not fully related to AutoCAD and ObjectARX but it covers an overview of &lt;span style="FONT-WEIGHT: bold"&gt;MFC &lt;/span&gt;library. This library will allow you to create rich interfaces for your ObjectARX applications easily and with professional style.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;MFC &lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255); FONT-STYLE: italic"&gt;Microsoft Foundation Classes&lt;/span&gt;) is a powerful library made to allow windows programmers to easily create rich interfaces following the windows standard interface.&lt;br /&gt;&lt;br /&gt;The MFC class tree is huge and obviously it is not the objective of this class to make you an MFC wizard. I will present here the main concepts involved when using MFC inside AutoCAD and how to take advantage of its power.&lt;br /&gt;&lt;br /&gt;If you would like to use MFC inside your ObjectARX application you will need to link it with &lt;span style="FONT-WEIGHT: bold"&gt;MFC libraries&lt;/span&gt; which can be done dynamically or statically. Currently ObjectARX only support dynamic linked MFC DLL applications because some of AutoCAD libraries were dynamic linked with MFC and you can't mix static and dynamic linked libraries. To make your application dynamic linked with MFC you need to select &lt;span style="FONT-WEIGHT: bold"&gt;MFC Extension DLL&lt;/span&gt; option when creating your application.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Resource Management&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One of the most important concepts when dealing with &lt;span style="FONT-WEIGHT: bold"&gt;MFC libraries&lt;/span&gt; is that they are based on resources. &lt;span style="FONT-WEIGHT: bold"&gt;Resources &lt;/span&gt;are rich information such as bitmaps, icons, string tables, dialog layouts, etc. Each DLL has its own resource package that could be used only by itself or shared with other DLLs (Resource only DLLs for example).&lt;br /&gt;&lt;br /&gt;The problem is that your ObjectARX application is running into AutoCAD host application which has its own resources. To solve this problem you should &lt;span style="FONT-WEIGHT: bold"&gt;switch the resource context&lt;/span&gt; to your DLL, use them, and then switch back to AutoCAD. This can be done manually but there is a couple of classes to help you to easily do that.&lt;br /&gt;&lt;br /&gt;The first class, called &lt;span style="FONT-WEIGHT: bold"&gt;CAcExtensionModule &lt;/span&gt;which will handle your module's own resource and the default resources. To make your application take advantage of this class you will need to create an instance of this class inside each module &lt;span style="FONT-WEIGHT: bold"&gt;DllMain()&lt;/span&gt; function. This can be done using the following:&lt;br /&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_0"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AC_IMPLEMENT_EXTENSION_MODULE&lt;/span&gt;(theArxDLL);&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;HINSTANCE &lt;/span&gt;_hdllInstance = NULL;&lt;br /&gt;&lt;br /&gt;extern "C" int APIENTRY&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255)"&gt;DllMain&lt;/span&gt;(&lt;span style="COLOR: rgb(51,51,255)"&gt;HINSTANCE &lt;/span&gt;hInstance, DWORD dwReason, LPVOID lpReserved) {&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Remove this if you use lpReserved&lt;/span&gt;&lt;br /&gt;UNREFERENCED_PARAMETER(lpReserved);&lt;br /&gt;&lt;br /&gt;if (dwReason == &lt;span style="FONT-WEIGHT: bold"&gt;DLL_PROCESS_ATTACH&lt;/span&gt;) {&lt;br /&gt;&lt;br /&gt;  theArxDLL.&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AttachInstance&lt;/span&gt;(hInstance);&lt;br /&gt;&lt;br /&gt;  hdllInstance = hInstance;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else if (dwReason == &lt;span style="FONT-WEIGHT: bold"&gt;DLL_PROCESS_DETACH&lt;/span&gt;) {&lt;br /&gt;&lt;br /&gt;  theArxDLL.&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;DetachInstance&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return 1;   // ok&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;The second class, called &lt;span style="FONT-WEIGHT: bold"&gt;CAcModuleResourceOverride &lt;/span&gt;is a handy class that performs the &lt;span style="FONT-WEIGHT: bold"&gt;switch &lt;/span&gt;from AutoCAD's resource to your application's resource when it is instantiated and then, when it is destroyed, switch back to AutoCAD. To use it, just declare an object of it before using your own resources. When it goes out of scope it will be destroyed and its destructor will switch back. So, this is the way to go:&lt;br /&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_0"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;CAcModuleResourceOverride&lt;/span&gt; res;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;CMyDialo &lt;/span&gt;dlg;&lt;br /&gt;&lt;br /&gt;dlg.DoModal();&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;br /&gt; &lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt; &lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;This way you will successfully create your dialog and won't face strange errors like: "An unsupported operation was attempted". Another possible error happens with other dialog appearing instead of yours! Crazy hum? Remember that this applies to any type of resources including strings placed into string tables.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Using MFC Built-in support&lt;/strong&gt; &lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt; &lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Autodesk has also provided us some great classes to make our application looks like a native AutoCAD feature and work much more integrated with AutoCAD's interface. There are two collections of MFC built-in classes which are grouped by &lt;span style="FONT-WEIGHT: bold"&gt;AcUi &lt;/span&gt;and &lt;span style="FONT-WEIGHT: bold"&gt;AdUi &lt;/span&gt;prefixes. The AcUi prefixed classes are made to &lt;span style="FONT-WEIGHT: bold"&gt;work inside AutoCAD&lt;/span&gt; environment and the AdUi classes are made to &lt;span style="FONT-WEIGHT: bold"&gt;work outside AutoCAD&lt;/span&gt; but, due to &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;license agreement&lt;/span&gt;, could be used only on applications that &lt;span style="FONT-WEIGHT: bold"&gt;interact with AutoCAD&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Each of these two classes allow us to create buttons like those one we can see inside AutoCAD native dialogs, allow us to create smart edit controls modified to work with angles, points, texts, etc. There are also great combo boxes that allows us to create Layer like combos, linetype combos, color combos, etc.&lt;br /&gt;&lt;br /&gt;These classes really provide you a &lt;span style="FONT-WEIGHT: bold"&gt;professional appearance&lt;/span&gt;. There are also other advanced features like hack into AutoCAD Options dialog creating your own tab, create dockable dialogs, among many others.&lt;br /&gt;&lt;br /&gt;Take a look inside ObjectARX documentation to see a complete list of those classes. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111327321892370228?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111327321892370228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111327321892370228' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111327321892370228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111327321892370228'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/class-10-using-mfc.html' title='Class 10 - Using MFC'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111301841412118372</id><published>2005-04-09T00:46:00.000-03:00</published><updated>2005-04-09T00:46:54.120-03:00</updated><title type='text'></title><content type='html'>&lt;a href='http://photos1.blogger.com/img/282/3168/320/AutoCAD_version.jpg'&gt;&lt;img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/282/3168/400/AutoCAD_version.jpg'&gt;&lt;/a&gt;&lt;br /&gt;AutoCAD's version Poll&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111301841412118372?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111301841412118372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111301841412118372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111301841412118372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111301841412118372'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/autocads-version-poll.html' title=''/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111272053784622801</id><published>2005-04-05T13:48:00.000-03:00</published><updated>2005-04-05T14:08:31.803-03:00</updated><title type='text'>ARXWizard for AutoCAD 2006 - Interview with Cyrille Fauvel (Autodesk)</title><content type='html'>&lt;div style="text-align: justify;"&gt;Hello,&lt;br /&gt;&lt;br /&gt;One of the greatest tools to easily create ObjectARX applications is the &lt;span style="font-weight: bold;"&gt;ARXWizard&lt;/span&gt; tool that comes with ObjectARX SDK. I have contacted &lt;span style="font-weight: bold;"&gt;Cyrille Fauvel&lt;/span&gt;, from &lt;span style="font-weight: bold;"&gt;Autodesk&lt;/span&gt;, and he have answered some questions about the new &lt;span style="font-weight: bold;"&gt;ARXWizard for AutoCAD 2006&lt;/span&gt;. I'm always willing to bring you news direct from Autodesk team and I hope you enjoy this new interview. Stay tuned!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Cyrille, how long are you an ADN / Autodesk member&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] I started developing AutoCAD applications while I was student in 1988. And as far I remember it was on release 2.17 with AutoLISP. I joined the Autodesk engineering team in 1993 for developing AutoCAD and preparing AutoCAD to the European localization. In 1996, I moved to the Developer Support / ADN group, and lately in 2004 into the Autodesk Consulting Division, but still doing ADN work.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] Why and how Autodesk has created the ARXWizard and decided to offer it to developers&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] The original idea of an ARX wizards was coming from Stefan Kraus a Product Support engineer in Germany. At that time, Stefan was working alone on this project and the wizard was just a application template &amp; command wizards on Visual Studio 4.2. When Stefan, moved from Product Support to ADN, Stefan, Albert and myself rewrote the wizards from scratch to improve wizards features and usage for Visual Studio 98. Now that Stefan left them team, and Albert moved to engineering, I am heading the new team who rewrote the Wizards to work in Visual Studio .NET IDEs. The basic idea of having a wizards is from Stefan, but the Wizards has becoming an important tool for ADN and developers for 3 reasons. It helps us a lot to write a lot of little test application when we working on developer problems submitted to us vis the ADN program, and we hope it helps developers in their daily work as well. The last but not least, the Wizards is an evangelism resource and training tool for developers on ObjectARX.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] Do you plan to expand the ARXWizard providing additional tools to other verticals like ADT and MAP&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] Yes, we did introduce ADT and MAP support into the 2005 application wizard, and we hope to continue to extend this capability to other wizards to support specific OMF and MSP features.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Is there any plans to create a specific Wizard for .NET applications in VB.NET and C#?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] :-) they are here in the 2006 version. But like for ADT/OMF and MAP we are still having a lot of work to do to come to the same level of features the pure ObjectARX wizards have.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] What's new in ARXWizard 2006&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:]&lt;br /&gt;- support for .NET application&lt;br /&gt;- .NET custom object wrapper wizard&lt;br /&gt;- .NET application wizards&lt;br /&gt;- .NET/ARX mixed managed code application wizard&lt;br /&gt;- a JIG wizard&lt;br /&gt;- Updates for the reactor and MFC classes&lt;br /&gt;- Localizable commands for ARX application.&lt;br /&gt;- Code gallery&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Is ARXWizard 2006 backward compatible with 2004 and 2005? Is there any issue?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] Hum, ... Yes and No&lt;br /&gt;In theory it is fully compatible, but in practice there is a little glitch there, let me explain the problem.&lt;br /&gt;Projects created with previous version of the wizards (namely 2004 and 2005 versions) will have no problem even if modified with the 2006 wizards version. However, new projects generated with the new version of the wizards will not load into AutoCAD if compiled with previous version of the ObjectARX SDK. :-( The reason of this failure is because the 2006 application wizard do not generate a .def file anymore. Instead the acrxEntryPoint() and acrxGetApiVersion() symbols are exported using #pragma and __declspec from the dbxEntryPoint.h. Since these 'exports' are only in ObjectARX 2006 dbxEntryPoint.h version of the file, a project generated using 2006 version of the Wizards but compiled with the ObjectARX 2004 SDK will not have is symbols exported unless, you add a .def, or copy the dbxEntryPoint.h and arxEntryPoint.h files from ARX 2006 to older ARX SDK (these 2 last files are fully compatible with previous ARX SDK version).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Users could download the most recent version of ARXWizard only through LiveUpdate tool?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] No, if they want they can download it directly from http://adn.autodesk.com/liveupdate/wizards2006.zip Liveupdate will download this file only if there is a more recent version.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;What should developers be aware to avoid a ARXWizard created project to become corrupted?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] With the 2004/5/6 versions of the Wizards, there is no more restrictions on what developers can or can't do. Visual Studio .NET IDE comes with an internal parser the wizards are using. So as long VC++ can compile, our wizards can work. However, there is a problem with the MS Intellisense database in .NET 2002 &amp; 2003. This intellisense database do not get updated with ARX symbols when you load a new project, or a project which had not the intellisense database created. The only workaround I found was to manually open the StdAfx.h file to force the refresh. If you forget to do this, Visual Studio may freeze for 2 or 3 minutes when the Visual Studio will try to parse the project. VS tries to parse a project every time you add a new class via a wizard for example.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Do you think is important to user knows exactly what ARXWizard is doing behind the scenes?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] Excepted the ARX AddIn, all wizards source code are public and located at 'C:\Program Files\Autodesk\ObjectARX Wizards for AutoCAD 2006'. Feel free to study :-)&lt;br /&gt;I don't think you need to know exactly what is done behind the scene, the ARX wizards generate code very similar to what ATL wizards.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] &lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;Is the ARXWizard team opened to users suggestions through e-mail or maybe feedback surveys?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[CYRILLE:] We have an email address for getting help on Wizards and make suggestions. It is oarxwiz-feedback@autodesk.com for AutoCAD/ObjectARX and invapiwiz-feedback@autodesk.com for the Inventor Wizards which I develop alone this time. But I want to highlight here that we are open to all new ideas, suggestions, and Wizards code submissions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;/span&gt;Thank You!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(51, 153, 153);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111272053784622801?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111272053784622801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111272053784622801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111272053784622801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111272053784622801'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/arxwizard-for-autocad-2006-interview.html' title='ARXWizard for AutoCAD 2006 - Interview with Cyrille Fauvel (Autodesk)'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111255188058232884</id><published>2005-04-03T15:01:00.001-03:00</published><updated>2008-03-24T23:55:41.073-03:00</updated><title type='text'>Class 9 - Interacting with AutoCAD</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;On the last class I have presented how to perform &lt;span style="FONT-WEIGHT: bold"&gt;selection sets&lt;/span&gt;. This class I will show how can you interact with AutoCAD using &lt;span style="FONT-WEIGHT: bold"&gt;global functions&lt;/span&gt; and acquiring information such as &lt;span style="FONT-WEIGHT: bold"&gt;numbers&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold"&gt;coordinates&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold"&gt;system variables&lt;/span&gt; and much more.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Invoking Commands&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ObjectARX provide us two global functions that allows us to&lt;span style="FONT-WEIGHT: bold"&gt; invoke registered commands&lt;/span&gt;. This functionality is very handy and will help users to perform quick operations that don't require complex procedures. Even this method is quite simple you should avoid using it in complex and huge operations. This method may also create problems when dealing with events handling.&lt;br /&gt;&lt;br /&gt;The two provided functions are &lt;span style="FONT-WEIGHT: bold"&gt;acedCmd() &lt;/span&gt;and &lt;span style="FONT-WEIGHT: bold"&gt;acedCommand()&lt;/span&gt;. The first one invokes the command through a passed in resbuf list which will inform all command parameters. The second function will receive a variable number of parameters which will reproduce the way you fire the command from the prompt interface. Below are these functions signature:&lt;br /&gt;&lt;p class="signatureInEnd"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;p class="signatureInEnd"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;int &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;acedCmd&lt;/span&gt;&lt;span style="font-size:85%;"&gt;(const struct &lt;/span&gt;&lt;span style="COLOR: rgb(51,51,255);font-size:85%;" &gt;resbuf &lt;/span&gt;&lt;span style="font-size:85%;"&gt;* rbp);&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;int &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;acedCommand&lt;/span&gt;&lt;span style="font-size:85%;"&gt;(int rtype, ... unnamed);&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;To build the resbuf list when using acedCmd() there is a utility function called &lt;span style="FONT-WEIGHT: bold"&gt;acutBuildList()&lt;/span&gt; which constructs this &lt;span style="FONT-WEIGHT: bold"&gt;linked list&lt;/span&gt; easily. You just need to pass paired values with codes that describe the types and end the list with a 0 or &lt;span style="FONT-WEIGHT: bold"&gt;RTNONE &lt;/span&gt;value. Another good practice is to clear the command prompt, calling &lt;span style="FONT-WEIGHT: bold"&gt;acedCommand(RTNONE)&lt;/span&gt; , after issued the command. Don't forget to &lt;span style="FONT-WEIGHT: bold"&gt;free memory&lt;/span&gt; used, when using resbuf pointers, through the &lt;span style="FONT-WEIGHT: bold"&gt;acutRelRb()&lt;/span&gt; utility function to avoid memory leaks. There are several ways to use theses functions and I will show some of them below:&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;acedCmd():&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;a) Moving the last created entity based on (0,0,0):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_point&lt;/span&gt; pt;&lt;br /&gt;pt[0] = pt[1] = pt[2] = 0.0;&lt;br /&gt;struct &lt;span style="COLOR: rgb(51,51,255)"&gt;resbuf&lt;/span&gt; *Mv;&lt;br /&gt;Mv = &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acutBuildList&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;,_T("_MOVE"),&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;,_T("_LAST"),&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;,_T(""),&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTPOINT&lt;/span&gt;,pt,&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;,&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;PAUSE&lt;/span&gt;,&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;0&lt;/span&gt;);&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedCmd&lt;/span&gt;(Mv);&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedCommand&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTNONE&lt;/span&gt;);&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acutRelRb&lt;/span&gt;(Mv);&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;b) Calling a "redraw" native command:&lt;br /&gt;&lt;pre class="prog_in_end_0"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;st&lt;span class="courier"&gt;ruct &lt;span style="COLOR: rgb(51,51,255)"&gt;resbuf &lt;/span&gt;*cmdlist;&lt;/span&gt;&lt;br /&gt;&lt;span class="courier"&gt;cmdlist = &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acutBuildList&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("_REDRAW"), &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;0&lt;/span&gt;);&lt;/span&gt;&lt;span class="courier"&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedCmd&lt;/span&gt;(cmdlist);&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedCommand&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTNONE&lt;/span&gt;);&lt;br /&gt;&lt;span class="courier"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acutRelRb&lt;/span&gt;(cmdlist);&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span class="courier"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="FONT-WEIGHT: bold"&gt;acedCommand():&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;a) Calling a ZOOM command and pausing for user input:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedCommand&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("Zoom"), &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;PAUSE&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTNONE&lt;/span&gt;);&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;b) Creating both a Circle and a Line entities:&lt;br /&gt;&lt;pre class="prog_in_end_0"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedCommand&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("circle"), &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("10,10"),&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;PAUSE&lt;/span&gt;,&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("line"), &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("10,10"), &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T("20,20"),&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTSTR&lt;/span&gt;, _T(""), &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;0&lt;/span&gt;);&lt;/blockquote&gt;&lt;/pre&gt;&lt;span style="FONT-WEIGHT: bold"&gt;System Variables&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Your application will probably need to access AutoCAD &lt;span style="FONT-WEIGHT: bold"&gt;system variables&lt;/span&gt; that can be read or write. ObjectARX provide two functions to deal with these variables using the resbuf structure to access and/or modify values. The function are called &lt;span style="FONT-WEIGHT: bold"&gt;acedGetVar()&lt;/span&gt; and &lt;span style="FONT-WEIGHT: bold"&gt;acedSetVar()&lt;/span&gt; and below are their signatures:&lt;br /&gt;&lt;p class="signatureInEnd"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="signatureInEnd"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;int &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedGetVar&lt;/span&gt;(const ACHAR * sym,struct &lt;span style="COLOR: rgb(51,51,255)"&gt;resbuf &lt;/span&gt;* result);&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="signatureInEnd"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;int &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSetVar&lt;/span&gt;(const ACHAR * sym,const struct &lt;span style="COLOR: rgb(51,51,255)"&gt;resbuf &lt;/span&gt;* val);&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="signatureInEnd"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;The first parameter is the variable name the second the resbuf pointer to set / get information. The following example show how to change the &lt;span style="FONT-WEIGHT: bold"&gt;FILLET &lt;/span&gt;radius which is stored through a system variable:&lt;br /&gt;&lt;pre class="prog_in_0"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;struct resbuf rb, rb1;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedGetVar&lt;/span&gt;(_T("FILLETRAD"), &amp;amp;rb);&lt;br /&gt;rb1.restype = &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RTREAL&lt;/span&gt;;&lt;br /&gt;rb1.resval.rreal = 1.0;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold;font-size:85%;" &gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;acedSetVar&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;(_T("FILLETRAD"), &amp;amp;rb1);&lt;/span&gt;&lt;/blockquote&gt;&lt;/pre&gt;It is very important that you specify the correct type of resbuf item acquired.&lt;br /&gt;In this case, the FILLET radius is a real number which is &lt;span style="FONT-WEIGHT: bold"&gt;RTREAL &lt;/span&gt;type.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;User Input Functions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There are additional global functions to allow interaction with users via command prompt interface. Each of these functions could be used alone or with other ones. The following table shows what each function does:&lt;br /&gt;&lt;br /&gt;&lt;table class="BasicRight" cellspacing="0" rules="cols"&gt;&lt;tbody&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetInt &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets an integer value &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetReal &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets a real value &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetDist &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets a distance &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetAngle &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets an angle (oriented to 0 degrees specified by the ANGBASE) &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetOrient&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets an angle (oriented to 0 degrees at the right) &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetPoint &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets a point &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetCorner &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets the corner of a rectangle &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetKword &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets a keyword &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;acedGetString &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Gets a string &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Each of these functions returns a int number as a &lt;span style="FONT-WEIGHT: bold"&gt;result code&lt;/span&gt; that could be one of the following:&lt;br /&gt;&lt;br /&gt;&lt;table class="BasicRight" cellspacing="0" rules="cols"&gt;&lt;tbody&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RTNORM &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;User entered a valid value &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RTERROR&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;The function call failed &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RTCAN &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;User entered &lt;span class="small_caps"&gt;&lt;!--thinsp--&gt;ESC&lt;!--thinsp--&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RTNONE &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;User entered only &lt;span class="small_caps"&gt;&lt;!--thinsp--&gt;ENTER&lt;!--thinsp--&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RTREJ &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;AutoCAD rejected the request as invalid &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RTKWORD &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;User entered a keyword or arbitrary text &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;AutoCAD allows you to &lt;span style="FONT-WEIGHT: bold"&gt;prevent invalid values&lt;/span&gt; when user respond to your input functions. This feature can be made through the &lt;span style="FONT-WEIGHT: bold"&gt;acedInitGet()&lt;/span&gt; function which can receive one or a combination of the following values:&lt;br /&gt;&lt;br /&gt;&lt;table class="BasicRight" cellspacing="0" rules="cols"&gt;&lt;tbody&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_NONULL&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Disallow null input &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_NOZERO &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Disallow zero values &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_NONEG &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Disallow negative values &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_NOLIM &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Do not check drawing limits, even if LIMCHECK is on &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_DASH &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Use dashed lines when drawing rubber-band line or box &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_2D &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Ignore&lt;span class="italic__Override"&gt; &lt;/span&gt;&lt;span class="italic__Override"&gt;Z&lt;/span&gt;&lt;span class="italic__Override"&gt; &lt;/span&gt;coordinate of 3D points (acedGetDist() only) &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL" style="FONT-WEIGHT: bold"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;RSG_OTHER &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"  style="font-family:courier new;"&gt;&lt;p class="table_body"&gt;&lt;span style="font-size:85%;"&gt;Allow arbitrary input—whatever the user enters&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;The following example shows how to acquire a value greater than zero:&lt;br /&gt;&lt;pre class="prog_in_end_0"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;blockquote&gt;int age = -1;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedInitGet&lt;/span&gt;(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RSG_NONULL&lt;/span&gt;  &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RSG_NOZERO&lt;/span&gt;  &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;RSG_NONEG&lt;/span&gt;, NULL);&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedGetInt&lt;/span&gt;(_T("How old are you? "), &amp;amp;age);&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111255188058232884?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111255188058232884/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111255188058232884' title='74 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111255188058232884'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111255188058232884'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/class-9-interacting-with-autocad.html' title='Class 9 - Interacting with AutoCAD'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>74</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111255101136599600</id><published>2005-04-03T14:56:00.000-03:00</published><updated>2005-04-03T14:56:51.366-03:00</updated><title type='text'></title><content type='html'>&lt;a href='http://photos1.blogger.com/img/282/3168/320/March2005.jpg'&gt;&lt;img border='0' style='border:1px solid #000000; margin:2px' src='http://photos1.blogger.com/img/282/3168/400/March2005.jpg'&gt;&lt;/a&gt;&lt;br /&gt;March Hit Graph&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111255101136599600?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111255101136599600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111255101136599600' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111255101136599600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111255101136599600'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/04/march-hit-graph.html' title=''/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111195962297484218</id><published>2005-03-27T18:34:00.001-03:00</published><updated>2008-03-24T23:51:31.970-03:00</updated><title type='text'>Class 8 - Selection Sets</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;On this class we will cover the first ways we can interact with user to allow our application to get information from &lt;span style="FONT-WEIGHT: bold"&gt;drawing screen&lt;/span&gt; You probably will need to use this method inside your application.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is one of the most important ways to interact with user because it will allow you to get information from drawing screen through selected entities. Some times you will request user to select entities individually and sometimes you will select them using a filter.&lt;br /&gt;&lt;br /&gt;A selection set is a &lt;span style="FONT-WEIGHT: bold"&gt;group of entities which are currently selected&lt;/span&gt; by an user or by an application. The most important concept involved when selecting entities from screen is that AutoCAD will return their names through a type called &lt;span style="FONT-WEIGHT: bold"&gt;ads_name&lt;/span&gt;. This type contains the entity name (which is valid only on the current session) and it can be converted to ObjectId using the &lt;span style="FONT-WEIGHT: bold"&gt;acdbGetObjectId()&lt;/span&gt; global function:&lt;br /&gt;&lt;/div&gt;&lt;p class="signatureInEnd" style="TEXT-ALIGN: justify;font-family:courier new;" &gt;&lt;span style="font-size:85%;"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;Acad::ErrorStatus&lt;/span&gt; &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acdbGetObjectId&lt;/span&gt; (&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObjectId&lt;/span&gt;&amp;amp; objId, const &lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; objName);&lt;/span&gt;&lt;/p&gt;&lt;div style="TEXT-ALIGN: justify"&gt;This function receives the &lt;span style="FONT-WEIGHT: bold"&gt;ads_name&lt;/span&gt; and convert it to an &lt;span style="FONT-WEIGHT: bold"&gt;AcDbObjectId&lt;/span&gt;. Most of selection set functions will still use the ads_name as parameters and on theses cases you don't need to convert it. The &lt;span style="FONT-WEIGHT: bold"&gt;ads_name can store several entities or just one&lt;/span&gt;. This will depend on how you or the user has performed the selection.&lt;br /&gt;&lt;br /&gt;The selection is made using a function called &lt;span style="FONT-WEIGHT: bold"&gt;acedSSGet()&lt;/span&gt; which will apply a selection or prompt the user to do that. The function signature is:&lt;br /&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_end_0"&gt;int &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet &lt;/span&gt;(const ACHAR *str, const void *pt1, const void *pt2,&lt;br /&gt;const struct resbuf *entmask, &lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; ss);&lt;/pre&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;How to use&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It receives a selection option, two points, a mask and returns the resulting selection set. After use the selection set it needs to be released and this is done through the &lt;span style="FONT-WEIGHT: bold"&gt;acedSSFree() &lt;/span&gt;function The selection option will instruct AutoCAD interface to do one of the following methods:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;table class="BasicRight" style="FONT-SIZE: 85%; FONT-FAMILY: courier new" cellspacing="0" rules="cols"&gt;&lt;tbody&gt;&lt;tr class="row_0"&gt;&lt;th class="BasicRight_CELL"&gt;&lt;p class="table_heading"&gt;Selection Code &lt;/p&gt;&lt;/th&gt;&lt;th class="BasicRight_CELL" style="TEXT-ALIGN: left"&gt;&lt;p class="table_heading"&gt;Description &lt;/p&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;NULL &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Single-point selection (if pt1 is specified)&lt;br /&gt;or user selection (if pt1 is also NULL) &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;# &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Nongeometric (all, last, previous) &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;:$ &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Prompts supplied &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;. &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;User pick &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;:? &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Other callbacks &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;A &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;All &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;B &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Box &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;C &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Crossing &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;CP &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Crossing Polygon &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;:D &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Duplicates OK &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;:E &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Everything in aperture &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;F &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Fence &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;G &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Groups &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;I &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Implied &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;:K &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Keyword callbacks &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;L &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Last &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;M &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Multiple &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;P &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Previous &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;:S &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Force single object selection only &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;W &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Window &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_2"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;WP &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Window Polygon &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="row_1"&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;X &lt;/p&gt;&lt;/td&gt;&lt;td class="BasicRight_CELL"&gt;&lt;p class="table_body"&gt;Extended search (search whole database)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;This way we can perform the selection by several ways. Some examples are presented below:&lt;br /&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_point&lt;/span&gt; pt1, pt2;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; ssname;&lt;br /&gt;pt1[X] = pt1[Y] = pt1[Z] = 0.0;&lt;br /&gt;pt2[X] = pt2[Y] = 5.0; pt2[Z] = 0.0; &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Get the current PICKFIRST or ask user for a selection&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(NULL, NULL, NULL, NULL, ssname); &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Get the current PICKFIRST set&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;"I")&lt;/span&gt;, NULL, NULL, NULL, ssname); &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Repeat the previous selection set&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;"P")&lt;/span&gt;, NULL, NULL, NULL, ssname); &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Selects the last created entity&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;"L")&lt;/span&gt;, NULL, NULL, NULL, ssname); &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Selects entity passing through point (5,5)&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(NULL, pt2, NULL, NULL, ssname); &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Selects entities inside the window from point (0,0) to (5,5)&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(153,51,153)"&gt;"W")&lt;/span&gt;, pt1, pt2, NULL, ssname);&lt;/pre&gt;&lt;/blockquote&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Using Selection filters&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Filters are a powerful way to speed up selection sets and avoid runtime operations to verify entities. You can use single filters or composed filters. Each filter is specified through a structure called resbuf. A &lt;span style="FONT-WEIGHT: bold"&gt;resbuf is a linked list&lt;/span&gt; which store several types of information and may contains several items. To use a filter we need to construct it and pass it as a parameters of &lt;span style="FONT-WEIGHT: bold"&gt;acedSSGet()&lt;/span&gt; method. The selection is performed but each selected entity will need to respect the filter. There are a lot of filters we can create and the SDK documentation cover all of them. The most used examples are presented below:&lt;br /&gt;&lt;/div&gt;&lt;blockquote style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_0"&gt;struct &lt;span style="COLOR: rgb(51,51,255)"&gt;resbuf &lt;/span&gt;eb1, eb2;&lt;br /&gt;TCHAR sbuf1[10], sbuf2[10];&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; ssname1, ssname2; &lt;/pre&gt;&lt;pre class="prog_in_0"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;eb1.restype = 0;&lt;/span&gt; &lt;span style="COLOR: rgb(0,153,0)"&gt;// Entity name filter&lt;/span&gt;&lt;br /&gt;_tcscpy(sbuf1, _T("CIRCLE"));&lt;br /&gt;eb1.resval.rstring = sbuf1;&lt;br /&gt;eb1.rbnext = NULL;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Retrieve all circles&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;"X"&lt;/span&gt;), NULL, NULL, &amp;amp;eb1, ssname1); &lt;/pre&gt;&lt;pre class="prog_in_end_0"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;eb2.restype = 8;&lt;/span&gt; &lt;span style="COLOR: rgb(0,153,0)"&gt;// Layer name filter&lt;/span&gt;&lt;br /&gt;_tcscpy(sbuf2, _T("0"));&lt;br /&gt;eb2.resval.rstring = sbuf2;&lt;br /&gt;eb2.rbnext = NULL;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Retrieve all entities on layer 0&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;"X"&lt;/span&gt;), NULL, NULL, &amp;amp;eb2, ssname2);&lt;/pre&gt;&lt;/blockquote&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;pre class="prog_in_end_0"&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Modifying entities through a selection set&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To modify entities inside a selection set we need to walk through selection items, get each one, convert the &lt;strong&gt;ads_name&lt;/strong&gt; to an &lt;strong&gt;ObjectId&lt;/strong&gt;, open the entity for write, modify it and then close it. This operation can also be done using a transaction which is, in long operations, much better.&lt;br /&gt;&lt;br /&gt;To show you how to walk through a selection set I will present a short code to select all CIRCLE entities inside the drawing and then change its color to red. The operation is pretty simple and is done this way:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Construct the filter&lt;/span&gt;&lt;br /&gt;struct &lt;span style="COLOR: rgb(51,51,255)"&gt;resbuf &lt;/span&gt;eb1;&lt;br /&gt;TCHAR sbuf1[10];&lt;br /&gt;eb1.restype = 0; &lt;span style="COLOR: rgb(0,153,0)"&gt;// Entity name&lt;/span&gt;&lt;br /&gt;_tcscpy(sbuf1, _T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;"CIRCLE"&lt;/span&gt;));&lt;br /&gt;eb1.resval.rstring = sbuf1;&lt;br /&gt;eb1.rbnext = NULL;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Select All Circles&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; ss;&lt;br /&gt;if (&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSGet&lt;/span&gt;(_T(&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;"X"&lt;/span&gt;), NULL, NULL, &amp;amp;eb1, ss) != &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;RTNORM&lt;/span&gt;){&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote style="TEXT-ALIGN: justify;font-family:courier new;" &gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acutRelRb&lt;/span&gt;(&amp;amp;eb1);&lt;br /&gt;return;&lt;/span&gt;&lt;/blockquote&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Free the resbuf&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acutRelRb&lt;/span&gt;(&amp;amp;eb1);&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Get the length (how many entities were selected)&lt;/span&gt;&lt;br /&gt;long length = 0;&lt;br /&gt;if ((&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSLength&lt;/span&gt;( ss, &amp;amp;length ) != &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;RTNORM&lt;/span&gt;)  (length == 0)) {&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote style="TEXT-ALIGN: justify;font-family:courier new;" &gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSFree&lt;/span&gt;( ss );&lt;br /&gt;return;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; ent;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObjectId &lt;/span&gt;id = &lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObjectId::kNull&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Walk through the selection set and open each entity&lt;/span&gt;&lt;br /&gt;for (long i = 0; i &amp;lt; length; i++) {&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;blockquote style="TEXT-ALIGN: justify;font-family:courier new;" &gt;&lt;span style="font-size:85%;"&gt;if (&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSName&lt;/span&gt;(ss,i,ent) != &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;RTNORM&lt;/span&gt;) continue;&lt;br /&gt;if (&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acdbGetObjectId&lt;/span&gt;(id,ent) != &lt;span style="COLOR: rgb(51,51,255)"&gt;Acad::eOk&lt;/span&gt;) continue;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbEntity&lt;/span&gt;* pEnt = NULL;&lt;br /&gt;if (&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acdbOpenAcDbEntity&lt;/span&gt;(pEnt,id,&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForWrite&lt;/span&gt;) != &lt;span style="COLOR: rgb(51,51,255)"&gt;Acad::eOk&lt;/span&gt;)&lt;br /&gt;continue;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Change color&lt;/span&gt;&lt;br /&gt;pEnt-&amp;gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;setColorIndex&lt;/span&gt;(1);&lt;br /&gt;pEnt-&amp;gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;close&lt;/span&gt;();&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Free selection&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;acedSSFree&lt;/span&gt;( ss );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have used some new functions (like &lt;span style="FONT-WEIGHT: bold"&gt;acdbOpenAcDbEntity&lt;/span&gt;) that are also part of ObjectARX SDK. Pay attention to the memory releases regarding to selection set and resbuf types. Note that I have used also a function called &lt;span style="FONT-WEIGHT: bold"&gt;acedSSLength&lt;/span&gt;() to get the length of selection set.&lt;br /&gt;&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;The &lt;strong&gt;acedSSName&lt;/strong&gt;() function get an at the passed index. If we have more than one entity selected this loop will get every single entity into this selection set.&lt;/div&gt;&lt;div style="TEXT-ALIGN: justify"&gt;&lt;br /&gt;See you next class. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111195962297484218?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111195962297484218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111195962297484218' title='58 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111195962297484218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111195962297484218'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/03/class-8-selection-sets.html' title='Class 8 - Selection Sets'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>58</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111152136534302860</id><published>2005-03-22T16:48:00.000-03:00</published><updated>2005-03-22T16:59:53.146-03:00</updated><title type='text'>AutoCAD 2006 - Interview with Albert Szilvasy (Autodesk)</title><content type='html'>Hello,&lt;br /&gt;&lt;br /&gt;I would like to present a short interview that I made (by e-mail) with a friend from &lt;span style="font-weight: bold;"&gt;Autodesk&lt;/span&gt;. His name is &lt;span style="font-weight: bold;"&gt;Albert Szilvasy&lt;/span&gt; and he is one of the best programmers I ever know from ADN. Since 1999 he is one of the main developers of AutoCAD. See the full interview below. Hope you enjoy!&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] Albert, how long are you an ADN / AutoCAD team member?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] I think I I've been an ADN member since '95. I joined Autodesk in '97 (ADN support)  and the AutoCAD team in '99.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] Autodesk has just released the AutoCAD 2006 which has a lot of new features. Which one is your favorite?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] I'm afraid I'm a bit jaded: my favorite is the expanded .NET API.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] AutoCAD 2006 has increased the .NET API implementation? How long you expect finish to expose the whole API?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] I don't think we will ever "finish". As we add new features to AutoCAD the .NET API will evolve. The .NET API already covers 95% of what one can do with ObjectARX in C++. I expect that the final gap between the unmanged C++ and .NET API will decrease over time. In fact, I expect that some features will be exposed in the .NET API only and not in ObjectARX since their underlying implementation will be managed code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] .NET will be just one more customization option or Autodesk plans to remove AutoLISP or VBA soon?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] We have no plans to remove AutoLISP or VBA. Customers rely on these technologies. We actively encourage customers to use the .NET API for new work simply because we believe it is a more productive environment.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] Is now possible to create custom objects using .NET API? If so, is there any sample in SDK?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:]No, it isn't possible to create custom objects using the .NET API. However, we do have a sample that shows you how to wrap custom objects so that they are accessible from any .NET language. The wrapper is for the "Polysamp" sample. It is on the ObjectARX SDK for AutoCAD 2006.&lt;br /&gt;We have had a lot of internal debate if we should expose the creation of custom objects to .NET developers. We decided that we have higher piority items for AutoCAD 2006. This debate is still ongoing. In my opinion custom objects is an overused feature. Many times developers want to be able to "subclass" existing entities on a instance by instance basis. I think we could provide more value to developers if we allowed them to do this instead of simply re-exposing the existing custom object APIs.&lt;br /&gt;Compare the ObjectARX custom object mechanism to what Windows offers with window classes: you can register new window classes (this is roughly equivalent to our custom objects) but you can also subclass existing windows. You can take an existing window instance and change its behavior completely. AutoCAD Map provides similar capability with its "stylization" feature: it essentially hijacks the worldDraw/viewportDraw function for certain instances. I think this mechanism could be generalized to allow 3rd party developers to specify custom callback for "transformBy", "getGripPoints", "worldDraw" etc. on an instance by instance basis. We are looking for the opinions of the community to figure out where to go next here.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] The only option to load .NET modules is still only through the NETLOAD command? Is there a way to unload them in 2006?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] To load a .net module you either use the netload command or demand loading registry keys (you need to use the special "MANAGED"&lt;br /&gt;dword value to mark the dll as a .NET module). You still can't unload assemblies in AutoCAD 2006. The CLR does not support unloading of individual assemblies. It only supports unloading entire Appdomains.&lt;br /&gt;This is a complication that we didn't want to introduce at this stage.&lt;br /&gt;We may do it in a future release though since .NET 2.0 makes working with AppDomains easier. Nevertheless, I expect that the new Edit and Continue feature in Visual Studio 2005 will make the ability to unload assemblies a less requested feature.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] The new interface customization without the old MNU based files will provide new features? Is there a new COM interface to customize menus and toolbars?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] Yes. We switched to a new format so that we can introduce new features easier. The COM API to customize toolbars and menus at runtime hasn't changed and works as it has been since R2000. Customers have asked for more programmetic access to the CUI file itself so we are looking into that.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] The major problem in VC.NET is about application load speed because .NET framework initialization takes some seconds to start. AutoCAD 2006 has improved this?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] AutoCAD initializes the .NET framework on a background thread during startup. So if you have multiple processor (or multiple cores on your CPU) then the startup impact should be very little. .NET applications that are demand loaded during an AutoCAD session will load very fast since most of the .NET framework (mscorwrks.dll, system.dll,&lt;br /&gt;system.windows.forms.dll) are already loaded by AutoCAD during startup.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] In AU2004 Autodesk has talked about the community involved around its products. How do you see the future of ADN network and AutoCAD developer communities and professionals?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] I'm a technologiest. I don't really have much opinion here.&lt;br /&gt;The world is becoming more interconnected so I think communities like the Autodesk Developer Network will become more important. I see that trend with Microsoft and other industry heavyweights with large developer communities.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;[Fernando:] What can you tell us about the next AutoCAD releases in terms of customization features?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;[ALBERT:] I can't really talk about specifics. I recommend that you look at the trends of the last few years and extrapolate. I'd expect that you won't be far off the mark.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Thank you Albert!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111152136534302860?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111152136534302860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111152136534302860' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111152136534302860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111152136534302860'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/03/autocad-2006-interview-with-albert.html' title='AutoCAD 2006 - Interview with Albert Szilvasy (Autodesk)'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111142512014393115</id><published>2005-03-21T13:59:00.001-03:00</published><updated>2008-03-24T23:47:52.592-03:00</updated><title type='text'>Class 7 - Containers</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;On this class I will present the concepts and features of ObjectARX &lt;span style="FONT-WEIGHT: bold"&gt;container objects&lt;/span&gt;. We have talked a little bit about them before but now we will go into further details.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The container object purpose is to store and manage objects of the same type or class. There are two types of containers: &lt;span style="FONT-WEIGHT: bold"&gt;Symbol Tables and Dictionaries&lt;/span&gt;. Each type of container has some specific functionalities that were designed to allow easy and efficient access methods.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Symbol Tables&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This type of container is designed to store the so called records. Each Symbol Table object store its &lt;span style="FONT-WEIGHT: bold"&gt;records &lt;/span&gt;using an &lt;span style="FONT-WEIGHT: bold"&gt;unique entry name&lt;/span&gt;. Through this entry you can obtain the record pointer and read or write information. The container may also receive new entries or even has entries removed (in case they are not used by other objects).&lt;br /&gt;&lt;br /&gt;To walk through an object container entries you will need to use a proper &lt;span style="FONT-WEIGHT: bold"&gt;iterator &lt;/span&gt;which will allow you to get entries and access its objects. AutoCAD has some Symbol Tables to store layers, linetypes, text styles and other objects. As these containers work almost the same way, there is a common base class for each of Symbol Tables, its records and the proper iterators.&lt;br /&gt;&lt;br /&gt;The Symbol Table class tree is as follows:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255); FONT-STYLE: italicfont-family:courier new;font-size:100%;"  &gt;AcDbSymbolTable&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbAbstractViewTable&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;AcDbViewportTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;AcDbViewTable&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbBlockTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbDimStyleTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbLayerTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbLinetypeTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbRegAppTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbTextStyleTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbUCSTable&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255); FONT-STYLE: italicfont-family:courier new;font-size:100%;"  &gt;&lt;br /&gt;AcDbSymbolTableRecord&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbAbstractViewTableRecord&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;AcDbViewportTableRecord&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;AcDbViewTableRecord&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbBlockTableRecord&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbDimStyleTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Record&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbLayerTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Record&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbLinetypeTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Record&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbRegAppTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbTextStyleTable&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbUCSTable&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255); FONT-STYLE: italicfont-family:courier new;font-size:100%;"  &gt;&lt;br /&gt;AcDbSymbolTableIterator&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbAbstractViewTableIterator&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;AcDbViewportTableIterator&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(0,153,0)"&gt;AcDbViewTableIterator&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbBlockTableIterator&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbDimStyleTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbLayerTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbLinetypeTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbRegAppTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbTextStyleTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;AcDbUCSTable&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;Iterator&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;So, to &lt;span style="FONT-WEIGHT: bold"&gt;create a layer&lt;/span&gt;, for instance, you will need to:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Open current Database;&lt;/li&gt;&lt;li&gt;Open AcDbLayerTable (for write);&lt;/li&gt;&lt;li&gt;Create an AcDbLayerTableRecord (using new operator);&lt;/li&gt;&lt;li&gt;Configure the AcDbLayerTableRecord;&lt;/li&gt;&lt;li&gt;Add it to AcDbLayerTable which is its proper container;&lt;/li&gt;&lt;li&gt;Close the record;&lt;/li&gt;&lt;li&gt;Close the container.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void &lt;span style="COLOR: rgb(255,0,0)"&gt;createLayer&lt;/span&gt;() {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbLayerTable &lt;/span&gt;*pLayerTbl = NULL;&lt;br /&gt;acdbHostApplicationServices()-&gt;workingDatabase()&lt;br /&gt;-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;getSymbolTable&lt;/span&gt;(pLayerTbl, &lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForWrite&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;if (!pLayerTbl-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;has&lt;/span&gt;(_T("&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;MYLAYER&lt;/span&gt;"))) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbLayerTableRecord &lt;/span&gt;*pLayerTblRcd = &lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;new &lt;/span&gt;AcDbLayerTableRecord;&lt;br /&gt;pLayerTblRcd-&gt;setName(_T("&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(204,51,204)"&gt;MYLAYER&lt;/span&gt;"));&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcCmColor &lt;/span&gt;color;&lt;br /&gt;color.setColorIndex(1); // red&lt;br /&gt;pLayerTblRcd-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;setColor&lt;/span&gt;(color);&lt;br /&gt;pLayerTbl-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;add&lt;/span&gt;(pLayerTblRcd);&lt;br /&gt;pLayerTblRcd-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;} else acutPrintf("\nLayer already exists");&lt;br /&gt;pLayerTbl-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;/blockquote&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To &lt;span style="FONT-WEIGHT: bold"&gt;list all existing layers&lt;/span&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Open current Database;&lt;/li&gt;&lt;li&gt;Open AcDbLayerTable (for read);&lt;/li&gt;&lt;li&gt;Create an AcDbLayerTableIterator;&lt;/li&gt;&lt;li&gt;Perform a loop through container entries;&lt;/li&gt;&lt;li&gt;Get the key name for each entry;&lt;/li&gt;&lt;li&gt;Close the container.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;void &lt;span style="COLOR: rgb(255,0,0)"&gt;iterateLayers&lt;/span&gt;() {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbLayerTable&lt;/span&gt;* pLayerTbl = NULL;&lt;br /&gt;acdbHostApplicationServices()-&gt;workingDatabase()&lt;br /&gt;-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;getSymbolTable&lt;/span&gt;(pLayerTbl, &lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForRead&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbLayerTableIterator&lt;/span&gt;* pLayerIterator;&lt;br /&gt;pLayerTbl-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;newIterator&lt;/span&gt;(pLayerIterator);&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbLayerTableRecord&lt;/span&gt;* pLayerTblRcd;&lt;br /&gt;TCHAR* pLName;&lt;br /&gt;for (; !pLayerIterator-&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;done()&lt;/span&gt;; pLayerIterator-&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;step()&lt;/span&gt;) {&lt;br /&gt;&lt;blockquote&gt;pLayerIterator-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;getRecord&lt;/span&gt;(pLayerTblRcd, &lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForRead&lt;/span&gt;);&lt;br /&gt;pLayerTblRcd-&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;getName&lt;/span&gt;(pLName);&lt;br /&gt;pLayerTblRcd-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;br /&gt;acutPrintf(_T("\nLayer name: %s"),pLName);&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;acutDelString&lt;/span&gt;(pLName);&lt;/blockquote&gt;}&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: rgb(255,0,0)"&gt;delete pLayerIterator&lt;/span&gt;;&lt;br /&gt;pLayerTbl-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;/blockquote&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Dictionaries&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This type of container is designed to store generic &lt;span style="FONT-WEIGHT: bold"&gt;AcDbObject derived class objects&lt;/span&gt;. This container is very useful because we can also store our custom objects inside it. The dictionary structure is much like a tree structure where we have nodes and entries. Inside the same node, entries can not repeat its name because they need to be unique inside the same level. These are the so called &lt;span style="FONT-WEIGHT: bold"&gt;Key entries&lt;/span&gt; and each Key entry will map to an &lt;span style="FONT-WEIGHT: bold"&gt;AcDbObject pointer&lt;/span&gt; which can be retrieved directly or through an interator (&lt;span style="FONT-WEIGHT: bold"&gt;AcDbDictionaryIterator&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;To store an object we need to create an entry using the &lt;span style="FONT-WEIGHT: bold"&gt;setAt()&lt;/span&gt; method passing also the object pointer which we already have instantiated with the new operator. After add this object we need to &lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt; it. AcDbDictionary container will return the given &lt;span style="FONT-WEIGHT: bold"&gt;AcDbObjectId &lt;/span&gt;for each entry.&lt;br /&gt;&lt;br /&gt;This container is also used by some AutoCAD features like &lt;span style="FONT-WEIGHT: bold"&gt;groups &lt;/span&gt;and &lt;span style="FONT-WEIGHT: bold"&gt;multiline styles&lt;/span&gt;. We will cover more about Dictionaries on the Custom Objects chapter.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111142512014393115?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111142512014393115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111142512014393115' title='32 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111142512014393115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111142512014393115'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/03/class-7-containers.html' title='Class 7 - Containers'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>32</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111136815297374840</id><published>2005-03-20T21:54:00.002-03:00</published><updated>2009-03-24T22:23:18.342-03:00</updated><title type='text'>Lab 1 - Solved</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;Hope you did solve this lab. I will present my solution now but this doesn't mean that this is the best or the only way to go.&lt;br /&gt;&lt;br /&gt;After have created the project and added the two commands as the Lab instructions said, open the &lt;span style="FONT-WEIGHT: bold"&gt;acrxEntryPoint.cpp&lt;/span&gt; file, move your cursor into &lt;span style="FONT-WEIGHT: bold"&gt;CARXLAB1App &lt;/span&gt;class and add the following code:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;br /&gt;static &lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObjectId&lt;/span&gt; &lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;addToModelSpace&lt;/span&gt;(&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbEntity&lt;/span&gt;* pEnt) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObjectId&lt;/span&gt; entId = AcDbObjectId::kNull;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Get Block Table&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbBlockTable&lt;/span&gt;* pBlockTable = NULL;&lt;br /&gt;acdbHostApplicationServices()-&gt;workingDatabase()&lt;br /&gt;-&gt;&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;getBlockTable&lt;/span&gt;(pBlockTable,&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForRead&lt;/span&gt;);&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Get Block Table Record (Model Space)&lt;/span&gt;&lt;br /&gt;if (pBlockTable) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbBlockTableRecord&lt;/span&gt;* pBTR = NULL;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Open ModelSpace (for write)&lt;/span&gt;&lt;br /&gt;pBlockTable-&gt;&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;getAt&lt;/span&gt;(&lt;span style="COLOR: rgb(204,51,204); FONT-WEIGHT: bold"&gt;ACDB_MODEL_SPACE&lt;/span&gt;,&lt;br /&gt;pBTR,&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForWrite&lt;/span&gt;);&lt;br /&gt;if (pBTR) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Add entity and get its ObjectId&lt;/span&gt;&lt;br /&gt;pBTR-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;appendAcDbEntity&lt;/span&gt;(entId,pEnt);&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Close BTR&lt;/span&gt;&lt;br /&gt;pBTR-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;/blockquote&gt;}&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Close Block Table&lt;/span&gt;&lt;br /&gt;pBlockTable-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;br /&gt;&lt;/blockquote&gt;}&lt;br /&gt;return entId;&lt;br /&gt;&lt;/blockquote&gt;}&lt;br /&gt;&lt;br /&gt;static void &lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;ARXLAB1_CENTS&lt;/span&gt;(void) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// First, let's create the Circle&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcGePoint3d &lt;/span&gt;cenPt(0,0,0);&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbCircle&lt;/span&gt;* pCirc = &lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;new &lt;/span&gt;AcDbCircle(cenPt,&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcGeVector3d::kZAxis&lt;/span&gt;,10.0);&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Add the circle to database and close it&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;addToModelSpace&lt;/span&gt;(pCirc);&lt;br /&gt;pCirc-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Now, let's create the Line&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcGePoint3d &lt;/span&gt;startPt(0,0,0);&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcGePoint3d &lt;/span&gt;endPt(10,10,0);&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbLine&lt;/span&gt;* pLine = &lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;new &lt;/span&gt;AcDbLine(startPt,endPt);&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Add the line to database and close it&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;addToModelSpace&lt;/span&gt;(pLine);&lt;br /&gt;pLine-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;br /&gt;&lt;/blockquote&gt;}&lt;br /&gt;&lt;br /&gt;static void &lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;ARXLAB1_CHENTS&lt;/span&gt;(void) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_name&lt;/span&gt; en;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;ads_point&lt;/span&gt; pt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Prompt for selection&lt;/span&gt;&lt;br /&gt;if (&lt;span style="FONT-WEIGHT: bold"&gt;acedEntSel&lt;/span&gt;(_T("\nSelect an entity: "),&lt;br /&gt;en, pt) == &lt;span style="COLOR: rgb(204,51,204); FONT-WEIGHT: bold"&gt;RTNORM&lt;/span&gt;) {&lt;br /&gt;&lt;blockquote&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObjectId &lt;/span&gt;eId = AcDbObjectId::kNull;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Get the ObjectId from ads_name&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;acdbGetObjectId&lt;/span&gt;(eId, en);&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbEntity&lt;/span&gt;* pEnt = NULL;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Open entity (for Write) to chance its color&lt;/span&gt;&lt;br /&gt;if (&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;acdbOpenObject&lt;/span&gt;((&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDbObject&lt;/span&gt;*&amp;amp;)pEnt,&lt;br /&gt;eId,&lt;span style="COLOR: rgb(51,51,255)"&gt;AcDb::kForWrite&lt;/span&gt;) == &lt;span style="COLOR: rgb(51,51,255)"&gt;Acad::eOk&lt;/span&gt;) {&lt;br /&gt;&lt;blockquote&gt;pEnt-&gt;&lt;span style="COLOR: rgb(255,0,0); FONT-WEIGHT: bold"&gt;setColorIndex&lt;/span&gt;(1);&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;// Close the entity!&lt;/span&gt;&lt;br /&gt;pEnt-&gt;&lt;span style="FONT-WEIGHT: bold"&gt;close()&lt;/span&gt;;&lt;/blockquote&gt;}&lt;br /&gt;&lt;/blockquote&gt;}&lt;br /&gt;else acutPrintf(_T("\nCommand aborted."));&lt;br /&gt;&lt;/blockquote&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The first function, called &lt;span style="FONT-WEIGHT: bold"&gt;addtoModelSpace() &lt;/span&gt;is a generic utility function which adds an arbitrary entity to ModelSpace and return its ObjectId. Following this function you will find two functions that were linked with &lt;span style="FONT-WEIGHT: bold"&gt;CENTS &lt;/span&gt;and &lt;span style="FONT-WEIGHT: bold"&gt;CHENTS &lt;/span&gt;commands.&lt;br /&gt;&lt;br /&gt;All 3 funtions are placed into your application class. Pay attention to the code flow and be careful to not forget any braces or close() methods.&lt;br /&gt;&lt;br /&gt;You may download this sample from here: &lt;a href="http://files.ofcdesk.com/ThirdParty/files/ObjectARX/Labs/ARXLAB1.zip"&gt;ARXLAB1.zip&lt;/a&gt;!&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10425945-111136815297374840?l=arxdummies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arxdummies.blogspot.com/feeds/111136815297374840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=10425945&amp;postID=111136815297374840' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111136815297374840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/10425945/posts/default/111136815297374840'/><link rel='alternate' type='text/html' href='http://arxdummies.blogspot.com/2005/03/lab-1-solved.html' title='Lab 1 - Solved'/><author><name>Fernando Malard</name><uri>http://www.blogger.com/profile/09852061806995998594</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://photos1.blogger.com/x/blogger/6284/765/1600/871999/Malard_MSN.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-10425945.post-111093038724891685</id><published>2005-03-15T20:07:00.001-03:00</published><updated>2008-03-25T00:02:35.519-03:00</updated><title type='text'>Lab 1 - Creating and Editing Entities</title><content type='html'>&lt;div style="TEXT-ALIGN: justify"&gt;Hello,&lt;br /&gt;&lt;br /&gt;Our first Lab will cover all presented contents since the course beginning. The main idea is to keep this lab simple to consolidate all knowledge present so far.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Requirements&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;* Class 1 to 6;&lt;br /&gt;* AutoCAD 2004/2005 or compatible vertical installed;&lt;br /&gt;* Visual Studio .NET 2002 installed;&lt;br /&gt;* ObjectARX Wizard installed.&lt;br /&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;Objectives&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;Create
