GetPoint by distance

Discussion in 'AutoCAD' started by mgrigoriev, Jun 17, 2004.

  1. mgrigoriev

    mgrigoriev Guest

    Hi,
    I set the OSMODE to nearest. Then I pick a point on a line. Then I pick another point on the same line. With this method I can never pick a point exact distance away from the first point. What I would like to do is, pick the first point, then type in the distance. Ideally, it should go say 20' along the line and give me that point. Is that possible?

    That's the way AutoCAD command "Line" works. You give it the first point then the distance, and it draws a line towards the mouse pointer.

    Thanks,
    Mike
     
    mgrigoriev, Jun 17, 2004
    #1
  2. Mike,
    The GetPoint method lets me pick a point an exact distance along a line.
    The main thing I have to do is be sure that when I type in my distance, the
    cursor is close enough to the line that the OSNAP symbol is showing, just as
    if I were using the "Line" command manually. When I do this, the new point
    is the proper distance away from the first point, and instead of going
    toward the mouse pointer, it goes toward the OSNAP symbol, along the line
    (or whatever else your snapping to).

    HTH,
    James
     
    James Belshan, Jun 17, 2004
    #2
  3. mgrigoriev

    mgrigoriev Guest

    James, I just did what you suggested me to, and I get a point where the osnap symbol used to be instead of the exact distance. In addition to this it isn't exactly on the line if you zoom to it.
     
    mgrigoriev, Jun 17, 2004
    #3
  4. Questions / comments:
    - Are you moving your mouse close enough to get your OSNAP symbol, then
    typing your distance (while the OSNAP is still showing) and hitting ENTER?
    - it seems that if you have ORTHO on it will over-ride the snapping and
    give you horiz or vert lines. Is your ORTHO off?
    - Is your OSNAP point far enough away from your new point that you can tell
    them apart?
    - If you zoom in enough on curves, your point will appear to be off of the
    curve even if you REGEN, since curves only have a certain level of accuracy.


    Here's what I did, in gory detail...

    1) create line from (2,2,0) to (10,20,0)
    2) put this code in VBA and run it

    Code:
    Sub Example_GetPoint()
    
    Dim returnPnt As Variant
    Dim basePnt(0 To 2) As Double
    Dim lineObj As AcadLine
    
    basePnt(0) = 2#: basePnt(1) = 2#: basePnt(2) = 0#
    returnPnt = ThisDrawing.Utility.GetPoint(basePnt, "Enter a point: ")
    Set lineObj = ThisDrawing.ModelSpace.AddLine(basePnt, returnPnt)
    
    End Sub
    
    3) when you run the code, put your mouse close enough to get an osnap to the
    line, but far enough away that a line drawn straight to the cursor would
    obviously be different than the existing line.
    4) while osnap is showing, type 10 and hit ENTER
    5) a new, shorter line is created on top of the existing one with an
    endpoint at (6.0614, 11.1381, 0.0). This is the same result as if I do
    this manually with "line" command

    Let me know if we're doing two different things.

    James
     
    James Belshan, Jun 17, 2004
    #4
  5. mgrigoriev

    mgrigoriev Guest

    Thanks, James. Ortho was on, and I was getting a wrong point. Itworks great for me now!
    Again, thanks a lot!
     
    mgrigoriev, Jun 18, 2004
    #5
  6. Awesome... I'm glad I could help. I found the ORTHO thing by accident
    myself, and only because I was trying to answer your question...

    Thanks,
    James
     
    James Belshan, Jun 18, 2004
    #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.