metaldan Posted July 19, 2011 Share Posted July 19, 2011 Hi I have a application for autocad 2008 in vba and now, we like to upgrade to autocad 2011 ( 643 bit ). I try with the vba patch ( with acad 2011 64 bit) , but I have with that line Set oblock = ThisDrawing.ModelSpace.InsertBlock(PT1, TYPE_BOM, 1#, 1#, 1#, 0#) It look like that autocad 2011 don't reconize to code for manipulate autocad object. There is a way to use my old code, or I have to re-code it in vb.net?? If my solution is VB.net, where i can foud a good tutoriel for manipulate acad odbjet ( insert block, change is atribute, copy block in a second drawing) . I allerady know i vb.net work, I just need a few help to start me with the acad object. Thank's for your help and excuse my english, I'am a french guy Quote Link to comment Share on other sites More sharing options...
BlackBox Posted July 19, 2011 Share Posted July 19, 2011 You need to use Autodesk's "Magic Macro" to port your VBA code to VB.NET for Visual Studio 2008, then you can open your Visual Studio 2008 project with Visual Studio 2010, and your code will automagically be converted to the current standard, syntax, etc.. Just be sure that you set your "compile" .NET Framework to 3.5 (or older) to suit the platforms for which you are writing code. You can still obtain the Express (Free) versions of Visual Studio 2008, and 2010... I personally use 2010. If you go the Express route, there are some tricks to getting it (VSE) to properly debug, and step through breakpoints, etc. Hope this helps! Quote Link to comment Share on other sites More sharing options...
CaveMan Posted July 19, 2011 Share Posted July 19, 2011 Hi A lot of the older VBA examples and code used "ThisDrawing" as above in you code A lot of times its easy to define "ThisDrawing" and code can? function (some tweaking may be needed) Define ThisDrawing: Dim ThisDrawing As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument May resolve some issues Quote Link to comment Share on other sites More sharing options...
Tyke Posted July 19, 2011 Share Posted July 19, 2011 You need to use Autodesk's "Magic Macro" to port your VBA code to VB.NET for Visual Studio 2008, then you can open your Visual Studio 2008 project with Visual Studio 2010, and your code will automagically be converted to the current standard, syntax, etc.. Just be sure that you set your "compile" .NET Framework to 3.5 (or older) to suit the platforms for which you are writing code. You can still obtain the Express (Free) versions of Visual Studio 2008, and 2010... I personally use 2010. If you go the Express route, there are some tricks to getting it (VSE) to properly debug, and step through breakpoints, etc. Hope this helps! @ metaldan: I have lots of old VBA code that was written for AutoCAD 2004 and it all runs fine on AuotCAD 2011/2012, 32 and 64 Bit. In your code try putting quotation marks around your block name: Set oblock = ThisDrawing.ModelSpace.InsertBlock(PT1, [b][color=red]"TYPE_BOM"[/color][/b], 1#, 1#, 1#, 0#) and then you need to iterate the attribute references to set them. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted July 19, 2011 Share Posted July 19, 2011 Prost! :stein: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.