VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IAcadModelSpace2 not working

2 REPLIES 2
Reply
Message 1 of 3
rashlak
292 Views, 2 Replies

IAcadModelSpace2 not working

We are developed a VBA Program in 2008 enviroment, now we are try to use the same VBA Program in 2012. While using, a VBA command( IAcadModelSpace2) not functioning.

 

Dim oMSpace As IAcadModelSpace2
Set oMSpace = ThisDrawing.ModelSpace

 

Pls help as quick as possible.

 

Thanks 

Raju

2 REPLIES 2
Message 2 of 3
norman.yuan
in reply to: rashlak

You simply change the Declaration of the variable "oMSpace" to:

 

Dim oMSpace As AcadModelSpace

 

then the code should work again. Some explanation here:

 

IAcadModelSpace2 is just a new Interface added to certain version of AutoCAD to allow new property/method to be added to an existing class without breaking the class' backward compatibility. This is usually done with AutoCAD's minor version between major version changes (every 3 years, until Acad2015). The new property/method introduced with this kind of Interfaces in AutoCAD's minor version would be merged into the relevant classes in AutoCAD major version change and these interfaces would disaappear.

 

In this case, Acad2008 added something new to AcadModelSpace class. Since Acad2008 was not a major version (2007 was), so the new stuff to AcadModelSpace was added to IAcadModelSpace2 (you can imagine, there was IAcadModelSpace1 prior to Acad2007), so that all code previously worked with AcadModelSpace still see the same AcadModelSpace as Acad2007, and you only need to use IAcadModelSpace2 for new features that is not available in Acad2007. That is, IAcadModelSpace includes all AcadModelSpace from Acad2007 plus something new. IAcadModelSpace2 would be available also in Acad2009, until Acad2010, where the new feature added into AcadModelSpace (as IAcadModelSpace2) would be merged into AcadModelSpace. Thus, since Acad2010, IAcadModelSpace2 is no long needed and is no longer exposed in AutoCAD object model.

 

HTH.

Message 3 of 3
rashlak
in reply to: norman.yuan

Thanks a lot,

 

Your explanation is very much clear 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost