insertblock loop

Discussion in 'AutoCAD' started by sylv7320, Aug 4, 2004.

  1. sylv7320

    sylv7320 Guest

    I have an insertblock loop in VBA and a question about when it finishes. After it finishes the screen goes all white with an hourglass for about a minute and then the drawing reappears with the blocks placed. What is happen during the pause? Can I prevent it?

    Sample code:

    intCounter = 0

    Do

    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "test.dwg", intRadMult, intRadMult, intRadMult, 0)
    insertionPnt(1) = insertionPnt(1) + (0.25 * intRadMult)

    ThisDrawing.Application.Update

    intCounter = intCounter + 1

    Loop Until intCounter = 6

    Thanks for any help.
     
    sylv7320, Aug 4, 2004
    #1
  2. sylv7320

    dziadek Guest

    perhaps ^^^^ it's very long time process...?
     
    dziadek, Aug 4, 2004
    #2
  3. sylv7320

    Joe Sutphin Guest

    Three things actually. Mike mentioned the first.

    Second, why are you assigning the returned object to a variable that does
    not appear to be used.

    Third, move the Update outside of your do loop. You do not want it running
    everytime through the loop.

    Fourth, move this line outside of the loop as well. I don't

    insertionPnt(1) = insertionPnt(1) + (0.25 * intRadMult)

    Actually, I would change this whole loop around to look like the following:

    insertionPnt(1) = insertionPnt(1) + (0.25 * intRadMult)

    'load the block for the first time
    ThisDrawing.ModelSpace.InsertBlock insertionPnt, "test.dwg", intRadMult,
    intRadMult, intRadMult, 0

    For intCounter = 0 To 4
    'then insert it 5 more times
    ThisDrawing.ModelSpace.InsertBlock insertionPnt, "test", intRadMult,
    intRadMult, intRadMult, 0
    Next intCounter

    ThisDrawing.Application.Update

    JMHO

    Joe
    --

    After it finishes the screen goes all white with an hourglass for about a
    minute and then the drawing reappears with the blocks placed. What is happen
    during the pause? Can I prevent it?
    "test.dwg", intRadMult, intRadMult, intRadMult, 0)
     
    Joe Sutphin, Aug 5, 2004
    #3
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.