Lenth Calculations

Discussion in 'AutoCAD' started by Kumar, Feb 27, 2004.

  1. Kumar

    Kumar Guest

    Hi every body,
    I am using VBA for automation of drawing. In this I am drawing a line.To draw a line using VBA, you need to enter Strat Point & End Point. For general cases, I have length of line and its angle of full circle bearing. For example--I want to darw-
    @100'<156d24'45"

    But in VBA, i need to enter start point and end point. I tried it using Trigometric formula, to get the end point as i am provided with length and its angle. But could not generalize formula for all angles.
    Does any body have generalized method to find end point from start point for all angles?
    or
    It can be directly draw a line with length and angle in VBA?

    Second problem--
    How can set preferences like direction of angles(By default for my template is east, but i want to make it North, want to measure clockwise) using VBA.
     
    Kumar, Feb 27, 2004
    #1
  2. Kumar

    Ben Guest

    You just have to split your formula up depending on which direction the
    line is running. (NE,SE,NW,SW)
     
    Ben, Feb 27, 2004
    #2
  3. See the help for AngleToReal and DistanceToReal methods. I guess you'd have
    to split your strings at the "@" and "<".
    HTH,
    James
    ..
     
    James Belshan, Feb 27, 2004
    #3
  4. Kumar

    Jeff Mishler Guest

    In addition, calc the endpoint using "PolarPoint" method....

    Jeff
     
    Jeff Mishler, Feb 27, 2004
    #4
  5. Hi Kumar,

    Calculate the second end point with "Thisdrawing.Utility.PolarPoint". The
    help files describe it in detail.

    The posts about quadrants and string splitting are totally irrelevant to
    your question.

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au

    draw a line using VBA, you need to enter Strat Point & End Point. For
    general cases, I have length of line and its angle of full circle bearing.
    For example--I want to darw-
    Trigometric formula, to get the end point as i am provided with length and
    its angle. But could not generalize formula for all angles.
    template is east, but i want to make it North, want to measure clockwise)
    using VBA.
     
    Laurie Comerford, Feb 27, 2004
    #5
  6. Laurie,
    I read Kumar's post to mean that the input to his program would be similar
    to @100'<156d24'45" and his program would need to turn this into a length
    in inches and an angle in radians.

    Kumar,
    VBA coordinates are all based on the World Coord System, which as far as I
    know is always (0 deg to the right, 90 deg is upward when looking at the
    screen). Easiest way to work with a different compass is probably to just
    make a conversion function.

    HTH,
    James
     
    James Belshan, Feb 27, 2004
    #6
  7. James, Laurie es right.

    Actually Kumar says he has a "length and its angle of full circle bearing",
    so the PolarPoint function is the way to go.
    The example he shows, I believe, its to explain how he would draw manually
    in ACAD.

    The thing Kumar has be carefull about is what type of angle he is feeding
    the PolarPoint function.
    First he has to convert to radians (no sweat there)
    Secondly he has to make sure that his angles are measured using ACADs
    default ( 0° is East and angles grow counterclockwise.)
     
    Jorge Jimenez, Feb 27, 2004
    #7
  8. Kumar

    Ben Guest

    I'll have to remember that one, hadn't used PolarPoint before.

    Cheers!
     
    Ben, Feb 27, 2004
    #8
  9. Uhmm, just a quick look and seems to me that your Sub is wrong

    x2 and y2 are deltaX and deltaY
    not the actual coordinates of point 2

    It should be:
    PX2 = x1 + x2
    PY2 = y1 + y2


    --
    Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
    (sorry, phony e-mail, SPAM made me do it)

    solve you problem. see attached file.
     
    Jorge Jimenez, Feb 28, 2004
    #9
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.