Insertblock doesn't display attribute prompt

Discussion in 'AutoCAD' started by Dave F, Aug 25, 2003.

  1. Dave F

    Dave F Guest

    Hi
    A2k2

    Why doesn't this routine display a prompt for attributes, either on the
    command line or in a dialogue box?

    It inserts the block with the default value displayed. If I insert the same
    block again, via the insert block dialogue box, it works fine.

    Thanks in advance
    Davd F.

    Sub fxBubble()
    Dim blockObj As AcadBlock
    Dim RefPt(0 To 2) As Double
    Dim circleObj As AcadCircle
    Dim CenPt(0 To 2) As Double
    Dim radius As Double
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim tag As String
    Dim value As String
    Dim blockRefObj As AcadBlockReference
    Dim IPT As Variant
    Dim Dimsc As Integer

    Create_Layer "s030__b", "continuous", acCyan ' creates a layer
    Create_TxtStyle ' creates
    a Romans textstyle

    ' Define the block
    RefPt(0) = 0: RefPt(1) = 0: RefPt(2) = 0
    Set blockObj = ThisDrawing.Blocks.Add(RefPt, "grid_test")

    ' Add a circle to the block
    CenPt(0) = 0: CenPt(1) = 6: CenPt(2) = 0
    radius = 6
    Set circleObj = blockObj.AddCircle(CenPt, radius)
    ' circleObj.Layer = "s030__b"

    ' Add an attribute to the block
    height = 5
    mode = acAttributeModeNormal
    prompt = "Grid Ref:"
    tag = "?"
    value = "X"
    Set attributeObj = blockObj.AddAttribute(height, mode, prompt, CenPt, tag,
    value)
    attributeObj.StyleName = "Romans"
    attributeObj.Alignment = acAlignmentMiddleCenter
    attributeObj.TextAlignmentPoint = CenPt

    ' Insert the block
    Dimsc = ThisDrawing.GetVariable("Dimscale")
    ' Return a point using a prompt
    IPT = ThisDrawing.Utility.GetPoint(, "Insert Point: ")
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(IPT, "grid_test",
    Dimsc, Dimsc, Dimsc, 0)
    End Sub
     
    Dave F, Aug 25, 2003
    #1
  2. Dave F

    Ed Jobe Guest

    Is ATTREQ set to 0?
     
    Ed Jobe, Aug 25, 2003
    #2
  3. Dave F

    Eric Stewart Guest

    As far as I know, that is a standard behavior when inserting a block through
    VBA.
     
    Eric Stewart, Aug 25, 2003
    #3
  4. Dave F

    Mark Propst Guest

    after
    Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(IPT, "grid_test",
    Dimsc, Dimsc, Dimsc, 0)

    you could issue your own prompt to solicit attribute values

    Since you're using a Method (InsertBlock) as opposed to an autocad "command"
    you need to structure your 'command' the way you want it to work.
    apparently just having > mode = acAttributeModeNormal isn't enough to make
    acad prompt you for the att vals by itself.

    you could make a form that had a textbox for each tag in the block or prompt
    for command line values or ????
    hth
    Mark
     
    Mark Propst, Aug 25, 2003
    #4
  5. Dave F

    Mark Propst Guest

    are you creating the dialog on the fly, dependent on number of atts?
    are you doing this in vba or vb?
    I've been studying how to add controls at runtime but haven't got it working
    in vba. I have an example for adding textboxes in vb but I'm trying to
    convert to vba and of course many of the elements don't exist.
     
    Mark Propst, Aug 25, 2003
    #5
  6. Dave F

    Eric Stewart Guest

    Typically I do this for blocks with a set number of attributes. So I create
    5 textboxes for 5 attributes. I am not doing it 'on the fly'

    I am doing this in vba.
     
    Eric Stewart, Aug 25, 2003
    #6
  7. Dave F

    Ed Jobe Guest

    aarrrgh...Mondays...

    --
    Ed
    --

     
    Ed Jobe, Aug 25, 2003
    #7
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.