very simple lisp question

Discussion in 'AutoCAD' started by brazious, Oct 4, 2003.

  1. brazious

    brazious Guest

    hey there,

    you'll have to forgive me ive only been doing autolisp for about a week so
    this is going to sound a bit stupid. but here we go.

    i have two points that are relative to a user defined point and i need to
    make a point that will always be at the mid point of those two points
    regardless of the distance between them as chosen by the person running the
    program.

    im not sure how clear i just made that as i am running on no sleep and am
    getting slightly frustrated.

    any help would be very kind

    Floyd
     
    brazious, Oct 4, 2003
    #1
  2. brazious

    P.C. Guest

    Hi

    You load and use the application I place here ;

    defun im (/ div dell a b)
    (setq div(getint " How many points between endpoints ? ")
    (setq dell(getint " on what number point do you want to Snap ?"))
    (setq a (getpoint "Point One : "))
    (setq b (getpoint "Point Two : "))
    (mapcar '- a
    (mapcar '* (mapcar '/ (mapcar '- a b) (cons div(list div div)))
    (cons dell(list dell dell)))
    ))

    This piece of code, work transparent when you point your way thru , point after
    point , and can place a point in 3D , one third out , or 2 fifth out , from one
    point to another.
    This is even a 3D Snap , as input points with juicy Lisp is defined as lists
    with x y an z values.
    This mean that somthing like as effevtive the spots is on the screen before you,
    a Lisp application can offer you the magic stick of 3D projecting free hand.
    Who ever need that. But the function work ; you subtract one point list from
    another, divide equaly x y and z with how many points between the two points you
    want your new point, in between, but use it carefully it is acturly a very nice
    design tool, when everything else don't work ;))

    P.C.
    http://www.designcommunity.com/scrapbook/2819.html
     
    P.C., Oct 4, 2003
    #2
  3. brazious

    brazious Guest

    You load and use the application I place here ;


    Hey again,

    thanks for the help (and I will definantly keep the app you posted handy for
    future reference) but I think that I may have made my task seem a little
    more complicated than it is. Basically it works like this. I have what
    essentially looks like a 2d box right now. The user picks a base point the
    sets height and width and it looks a bit like this

    Ftg4 ftg3



    Ftg1 ftg2

    Those are the points I have so far. The point I need to create needs to
    always be between ftg3 & 4 (regardless of height or width) because I need to
    put a slot there. So that it will look like this.

    Ftg4 kw1 kw2 ftg3

    kw4 kw3

    Ftg1 ftg2

    But first I need a midpoint between ftg3 & 4 to base the kw points off of.
    This is crucial because I need to do similar steps to create the rest of the
    image. (will eventually be a footing detail) so basically what I am trying
    to do is setq a point that will always be between ftg4 & 3.

    Sorry about the miscomunication there as I stated I was very tired at the
    time of my message and wasn't making much sense to myself. So just to clear
    up somethings. The detail is completely 2d. And im basicaly looking for a
    way to grab the distance between two setq'd points (not literal drawn points
    just setq'd reference points) and setq another point to automatically be
    there regardless of height or distance.

    Once again im sorry for the trouble and am gratefull for the help up to this
    point.

    Floyd
     
    brazious, Oct 4, 2003
    #3
  4. brazious

    Jeff Mishler Guest

    here's one way.....

    (setq midpt
    (polar Ftg4
    (angle Ftg4 Ftg3)
    (/ (distance Ftg4 Ftg3) 2)
    )
    )

    HTH,
    Jeff
     
    Jeff Mishler, Oct 4, 2003
    #4
  5. brazious

    bestafor Guest

    HiHo;
    The cal command will do that very well
    cal can be used transparently by preceeding
    the command with ' i.e. 'cal
    Then mee which is short for
    middle end end.
    cal can also be used to fine
    both slot points.
    by using plt or
    point line percentage of total length.
    cal can be used in a lisp program
    by prefixing i.e.
    (command 'cal mee(end,end))
     
    bestafor, Oct 5, 2003
    #5
  6. brazious

    brazious Guest

    hey,

    thanks a ton man that works great. really appreciate the help. time
    to go finish my little routine. thanks man.


    Floyd
     
    brazious, Oct 6, 2003
    #6
  7. brazious

    Huw Guest

    _non;'cal;(cur+cur)/2;

    works well
     
    Huw, Oct 6, 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.