apply measure command programaticaly

Discussion in 'AutoCAD' started by Nermeen Bakr, May 23, 2004.

  1. Nermeen Bakr

    Nermeen Bakr Guest

    Hi:
    How could i apply the measure command programaticaly that i can define a
    block and aligne it on a polyline at equal distances

    Thnks
    --
    Nermeen Bakr
    Project Manager
    Modern Computing Services
    web site : www.mcsoil.com
    Tel: : + 202 4036520
    Fax : + 202 4040503
     
    Nermeen Bakr, May 23, 2004
    #1
  2. You would need to control it using SendCommand().

    An alternative is AcadX, which has a Curve class
    that exposes Measure and Divide methods, and other
    related methods.

    http://www.caddzone.com/acadx
     
    Tony Tanzillo, May 23, 2004
    #2
  3. Nermeen Bakr

    Nermeen Bakr Guest

    but i don't want the user to feel it whick means i want to give the measure
    command a block i have already defined and use the blocks which the measure
    command will insert aligned in other functions
    --
    Nermeen Bakr
    Project Manager
    Modern Computing Services
    web site : www.mcsoil.com
    Tel: : + 202 4036520
    Fax : + 202 4040503
     
    Nermeen Bakr, May 24, 2004
    #3
  4. Hi,

    The "sendcommand" process enables you to do this. You simply have to work
    out the string required to send, by doing the command at the command prompt.

    If you are experienced in doing this you will probably get it right by the
    10th try.


    --

    Regards


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, May 24, 2004
    #4
  5. Nermeen Bakr

    Nermeen Bakr Guest

    First of all thanks for help.
    but i still don't know how to access the blocks which had been drawn
    programatically for an example loop on them and draw a grid inside each one.


    --
    Nermeen Bakr
    Project Manager
    Modern Computing Services
    web site : www.mcsoil.com
    Tel: : + 202 4036520
    Fax : + 202 4040503
     
    Nermeen Bakr, May 25, 2004
    #5
  6. Unfortunately, the MEASURE has some requirements
    that make it difficult to script from VBA, using
    SendCommand().

    The reason is because the MEASURE command requires a
    selection point, which is used to determine which end
    of the object it measures from. You can pass a point
    to the command line, but that does not guarantee the
    desired object will be selected. You would need to
    pass a fairly complex LISP expression, like this:

    (list (handent "xxxxx") '(xxxx.xx yyyy.yy zzzz.zz))

    This is the only way to pass a selection point and an
    entity to AutoCAD from VBA.

    The objects created by MEASURE can be found in the
    Previous selection set.

    The Measure and Divide methods in AcadX do not insert
    blocks, that is something you need to do yourself, and
    it's not that difficult.

    You can use the MeasureEx() method, which returns an
    array of the first and second derivatives for each
    resulting point, along with the points. You can use the
    first derivative to compute the required rotation angle
    of each insertion, and just do the insertion manually
    using the InsertBlock() method.
     
    Tony Tanzillo, May 25, 2004
    #6
  7. Nermeen Bakr

    Nermeen Bakr Guest

    This is the way to pass the measure command parameters to the send command
    Dim str1 As String
    Dim strclose As String
    str1 = "(handent """ + tmpObj.Handle + """" + ")"
    Dim str As String
    str = "_measure "
    str = str & str1 & vbCr & "block" & vbCr & "myblock" & vbCr & "Yes" & vbCr &
    "500" & vbCr
    app.ActiveDocument.SendCommand(str)

    --
    Nermeen Bakr
    Project Manager
    Modern Computing Services
    web site : www.mcsoil.com
    Tel: : + 202 4036520
    Fax : + 202 4040503
     
    Nermeen Bakr, May 27, 2004
    #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.