Need help creating a button

Discussion in 'AutoCAD' started by lsaapedd, Apr 1, 2004.

  1. lsaapedd

    lsaapedd Guest

    I want to make a button that allows me to do the following:

    L<enter>click start point, drag mouse cursor to button, click button, move cursor back to drawing and drag line in the direction I want it to go, at prompt on command line enter a metric dimension in millimeters<enter>.

    Line should then be completed, length in "inches" corresponding to the length in "mm> I entered.

    In other words, I want a transparent, on-the-fly, metric to inch conversion that returns the length in inches.

    I know nothing about lisp, vba, etc...

    Can any one help me, please?

    Jerry
     
    lsaapedd, Apr 1, 2004
    #1
  2. lsaapedd

    Mark Propst Guest

    this isn't exactly what you asked but maybe you get the idea
    (defun c:L ( / p1 dist1 ang1)
    (princ"\nSo Ya wanna Metric line eh? ")
    (setq p1(getpoint"\nOkay so Pick a start point"))
    (setq dist1(/(Getdist "\nNow Enter the distance in mm") 2.54 ))
    (setq ang1(angle p1 (getpoint p1"\nAlrighty then, now Pick a point in
    the direction of line")))
    (command"._line" p1(polar p1 ang1 dist1) "" )
    (princ"\nIs that what you had in mind? ")
    (princ)
    )

    paste into notepad, save as metricline.lsp or whatever name you want
    save it to a location on your search path
    type (load"metricline") at command line - including parenthesis
    then type "L" and respond to prompts
    pick a starting point
    at the prompt"Enter distance in mm" type in mm length of line desired
    at the prompt"Pick point in direction of line" pick a point in the direction
    you want the line to be drawn.

    I forget if 2.54 is the correct conversion factor, if not, change that
    number in the text above.
    change my stupid prompt wording to whatever you want to see.
    put a semicolon (;) in front of any princ line you don't want to see (or
    erase it)
    voila now you know lisp!
    :)
    hth
    Mark
    cursor back to drawing and drag line in the direction I want it to go, at
    conversion that returns the length in inches.
     
    Mark Propst, Apr 2, 2004
    #2
  3. lsaapedd

    bob.at Guest

    Hallo Jerry

    Make a toolbox button with the following macro:

    ^P(/ (getreal "mm: ") 25.4)
     
    bob.at, Apr 2, 2004
    #3
  4. That should be 25.4 (mm in an inch), rather than 2.54 (cm in an inch).

    Kent Cooper, AIA

    ...
     
    Kent Cooper, AIA, Apr 2, 2004
    #4
  5. lsaapedd

    lsaapedd Guest

    Thanks. It wasn't what I was expecting, but it does exactly what I wanted.
    Thanks again,
    Jerry
     
    lsaapedd, Apr 5, 2004
    #5
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.