Jump to content

custom menu from 2008 not working in 2010?


meanoldman

Recommended Posts

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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 by BIGAL
.xx
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...