Polls

Within the context of its era, which version of AutoCAD was the BUGGIEST?
 

Subscribe

VBA can't explode non-uniformly scaled blocks PDF Print E-mail
Thursday, 14 September 2006

As of AutoCAD 2004, VBA can no longer be used to explode non-uniformly scaled blocks although this could easily be done with earlier releases.

Test with the following snippet:

Sub ExplodeNonUniform()
    Dim oLine As AcadLine
    Dim oBlock As AcadBlock
    Dim oBlockRef As AcadBlockReference
    Dim StartPoint(2) As Double, EndPoint(2) As Double
    StartPoint(0) = 0#: StartPoint(1) = 0#: StartPoint(2) = 0#
    EndPoint(0) = 1#: EndPoint(1) = 1#: EndPoint(2) = 1#
    Set oBlock = ThisDrawing.Blocks.Add(StartPoint, "widget")
    Set oLine = oBlock.AddLine(StartPoint, EndPoint)
    Set oBlockRef = _
    ThisDrawing.ModelSpace.InsertBlock(StartPoint, oBlock.Name, _
      1, 2, 1, 0)
    oBlockRef.Explode
    '*** above line works in AutoCAD 2002, but not in 2004,5,6,7
    oBlockRef.Delete
End Sub
 

Workarounds: Assuming oBlkRef is the reference that you want to explode (and keeping in mind sendcommands own limitations):

thisdrawing.sendcommand ("explode" & vbcr & "(handent " _
  & Chr(34) & oBlkRef.Handle & Chr(34) & ")" & vbcr & vbcr)

First Appeared: AutoCAD 2004
Status as of 2008: Still reproducible
Status as of 2009: (unknown - please email with any info)

 
< Prev   Next >

THIS INFORMATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright © 2008, http://www.texupport.net/