Automated slots

Discussion in 'AutoCAD' started by Dr Fleau, Apr 19, 2005.

  1. Dr Fleau

    Dr Fleau Guest

    Hi y'alls
    Here's a quick one I wrote last week. Sorry it's in french, adapt as needed.
    Hope someone could make use of it.

    Dr Fleau

    (defun slotq (/ dia pt1 pt2 pt3 pt4 pt5 pt6 ang angl rad)
    (setq dia (getreal "\n Diamètre de la rainure : ")
    angl (/ pi 2.0)
    rad (/ dia 2.0)
    pt1 (getpoint "\n Premier point (extrémité) : ")
    pt2 (getpoint pt1 "\n Deuxième point (extrémité) : ")
    )
    (setvar "osmode" 0)
    (setq ang (angle pt1 pt2)
    pt11 (polar pt1 ang rad)
    pt21 (polar pt2 (+ ang pi) rad)
    pt3 (polar pt11 (- ang angl) rad)
    pt4 (polar pt11 (+ ang angl) rad)
    pt5 (polar pt21 (- ang angl) rad)
    pt6 (polar pt21 (+ ang angl) rad)
    )
    ;;;(command "_.arc" "c" pt11 pt4 pt3)
    ;;;(command "_arc" "c" pt21 pt5 pt6)
    ;;;(command "_line" pt3 pt5 "")
    ;;;(command "_line" pt6 pt4 "")
    (command "_pline" pt3 pt5 "a" pt6 "l" pt4 "a" pt3 "")
    (setvar "osmode" 183)
    (princ)
    )
    (defun slotcentre (/ dia pt1 pt2 pt3 pt4 pt5 pt6 ang angl rad)
    (setq dia (getreal "\n Diamètre de la rainure : ")
    angl (/ pi 2.0)
    rad (/ dia 2.0)
    pt1 (getpoint "\n Premier point (centre) : ")
    pt2 (getpoint pt1 "\n Deuxième point (centre) : ")
    )
    (setq ang (angle pt1 pt2)
    pt3 (polar pt1 (- ang angl) rad)
    pt4 (polar pt1 (+ ang angl) rad)
    pt5 (polar pt2 (- ang angl) rad)
    pt6 (polar pt2 (+ ang angl) rad)
    )
    (setvar "osmode" 0)
    ;;;(command "_.arc" "c" pt1 pt4 pt3)
    ;;;(command "_arc" "c" pt2 pt5 pt6)
    ;;;(command "_line" pt3 pt5 "")
    ;;;(command "_line" pt6 pt4 "")
    (command "_pline" pt3 pt5 "a" pt6 "l" pt4 "a" pt3 "")
    (setvar "osmode" 183)
    (princ)
    )
     
    Dr Fleau, Apr 19, 2005
    #1
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.