Changing the X and Y Scales on a Block

Discussion in 'AutoCAD' started by Bught, Jan 24, 2005.

  1. Bught

    Bught Guest

    Here is my code:

    Private Sub cmdTest_Click()
    Dim xBlock As AcadBlock
    Set xBlock = ThisDrawing.ActiveLayout.Block
    xBlock.YScaleFactor = 2
    End Sub

    This is the way that the code examples shows how to modify them but it doesn't work any ideas would be very appreciated. This does succesfully refrence the block on my drawing. I am also using AutoCad 2002 if that makes any diffrence.
    Thanks
     
    Bught, Jan 24, 2005
    #1
  2. Bught

    TomD Guest

    I could be mistaken, but I think you're messing with the actual 'block' of
    the current layout (Modelspace/Paperspace).

    There something missing in that code, IMO. Where did you get that sample
    from?
     
    TomD, Jan 24, 2005
    #2
  3. Bught

    Oberer Guest

    hey Bught,
    which block are you trying to modify? Are you trying to modify a block in the dwg (a reference) or the block itself?

    This won't work :)

    If you're trying to change a particular block reference:
    Code:
    Private Sub RescaleBlock()
    Dim oBlkRef As AcadBlockReference
    Set oBlkRef = ThisDrawing.Utility.GetEntity("Select block to rescale:")
    With oBlkRef
    .XScaleFactor = 2
    .YScaleFactor = 2
    .ZScaleFactor = 2
    End With
    set oBlkRef = nothing
    End Sub
     
    Oberer, Jan 24, 2005
    #3
  4. Bught

    Oberer Guest

    hey Bught,
    which block are you trying to modify? Are you trying to modify a block in the dwg (a reference) or the block itself?

    This won't work :)

    If you're trying to change a particular block reference:
    Code:
    Private Sub RescaleBlock()
    Dim oBlkRef As AcadBlockReference
    Set oBlkRef = ThisDrawing.Utility.GetEntity("Select block to rescale:")
    With oBlkRef
    .XScaleFactor = 2
    .YScaleFactor = 2
    .ZScaleFactor = 2
    End With
    set oBlkRef = nothing
    End Sub
    
     
    Oberer, Jan 24, 2005
    #4
  5. Bught

    Jeff Mishler Guest

    Tom is correct.......you are not accessing what you think you are.

    Blocks do not have scale factors, BlockReferences do.
     
    Jeff Mishler, Jan 24, 2005
    #5
  6. Bught

    Bught Guest

    Thanks to everyone this is what i needed.
     
    Bught, Jan 24, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.