meanoldman Posted October 12, 2010 Share Posted October 12, 2010 Sorry in advance for the clueless nature of this post. Here is the deal: A former co-worker put together a custom toolbar to simplify insertion of blocks into drawing, number them and inventory them in Excel. Specifically we use the tool to insert conveyor sections into drawings as we design distribution centers and keep a piece count. The toolbar was created for 2006, and modified to wirk in 2008. Now it's time to upgrade to 2010. Anyway, all features of the toolbar work as intended in AutoCAD 2008. However if I either import the customization into AutoCAD 2010, or upgrade and migrate an instance of 2008 to 2010 some of the functions break. Specifically what does not work any longer is the function that inserts a block from another drawing into the currect drawing. When you click the menu button you are prompted, as expected, to select an insertion point, but once you do nothing happens. Yes the VBA enabler is installed and loaded. I guess before I just post chunks of code, does this make sense. Has verbage changed so that the insertion of blocks would break? Thanks, and again sorry for my obvious ignorance Quote Link to comment Share on other sites More sharing options...
BlackBox Posted October 13, 2010 Share Posted October 13, 2010 Congrats on your first post, and welcome to the forums! My first thought is that the code breaks down, because pathing has changed. For example, you could be missing a support search path that was available to your 2008 deployment, or an explicit path (for the block) in the code may no longer exist. I know this is not a programming forum, but IMO that is where you should start. I'm not sure why someone would go through the effort of writing out VBA when a simple Macro/AutoLISP function would do the trick... but that is neither here, nor there. I say this because if you cannot get your toolbar to work, a simple Macro, or LISP function could replace the problem toolbar button's code. Hope this helps! Quote Link to comment Share on other sites More sharing options...
meanoldman Posted October 13, 2010 Author Share Posted October 13, 2010 Thanks for the reply RenderMan. I'm not sure why the user created the toolbar the way he did, other than to make it easier to deploy, and to keep everything in one place. It works well for it's intended purpose in 2008, but without changing anything (network paths, install paths, etc.) as soon as you upgrade to 2010 it breaks the insert existing block feature. I kind of figured initially it had to do with a path, and looked at all the code to see if I could find anything out of sorts. Nothing jumped out at me though, so I tried copying the reference drawing to a local folder and editing the paths to point there, but still no go. One thing I did find interesting is that if I go into the VB editor and run the userform for one of the button, it sort of works, but the block is no longer dynamic. I'm stumped right now. A handful of users really like it, but they aren't going to cry if they can't use it for a while. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted October 13, 2010 Share Posted October 13, 2010 In the VBAIDE, try stepping through the code line by line (for said function) to see where the error is... giving it (the code) a proper 'debug' and whatnot. Quote Link to comment Share on other sites More sharing options...
meanoldman Posted October 22, 2010 Author Share Posted October 22, 2010 OK, So I tried stepping through and could get it to actually reveal an error. As you can imagine, this was incredibly confusing and frustrating. So I gave in and contacted my vendor and they got me in contact with a programmer at Rand. He took a look and found the problem was an entry in the code for the macro that was calling out the wrong AutoCAD version when the macro tried to pull in the dynamic block from the other drawing. Simply changing one character on several lines of the code fixed it. The correct line looks like this Set dbxDoc = AcadApplication.GetInterfaceObject("ObjectDBX.AxDbDocument.18") It won't work when the version is set to .16 in AutoCAD 2010. Version .16 works in 2006 thru 2008. .18 works in versions 2009 thru 2011. Quote Link to comment Share on other sites More sharing options...
ReMark Posted October 22, 2010 Share Posted October 22, 2010 Glad you got it sorted out and thanks for sharing that vital piece of information with us. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted October 22, 2010 Share Posted October 22, 2010 Glad you got it sorted out and thanks for sharing that vital piece of information with us. Likewise, Meanoldman. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 25, 2010 Share Posted October 25, 2010 (edited) I could be wrong its sounds like a version number problem as autocad adds a new version say 2012 the last couple of digits are a new version number its like 2010R18.0 you need to add a check for version No and set the ObjectDBX.AxDb Document.xx to match had this as an example ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11 will acad 2012 be 19 ? or 18.2 Others may know how to get the Document.xx automatically Edited October 25, 2010 by BIGAL .xx 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.