GRREAD problem

Discussion in 'AutoCAD' started by Rabbit, Oct 13, 2004.

  1. Rabbit

    Rabbit Guest

    I want to display 3 different sets of entities using grdraw while grread is
    doing it's thing. Problem is, only one of the sets of entities is showing
    up.

    Here's the code:

    ;;;------------------------------------------------------------------------------------------------
    (defun MidPnt (TransPnt1 TransPnt2/ P1X P1Y P2X P2Y)
    ; Returns the point between two points - By Brian Forbes -
    http://www.autolisp.org/
    ; Thanks for the code Brian!
    (setq P1X (car TransPnt1))
    (setq P1Y (cadr TransPnt1))
    (setq P2X (car TransPnt2))
    (setq P2Y (cadr TransPnt2))
    (list (/ (+ P1X P2X) 2) (/ (+ P1Y P2Y) 2) 0.0)
    )

    ;;;------------------------------------------------------------------------------------------------
    ;;;Duct transitions
    (defun TransDraw ()
    (setq TrueTransAngle 0.0)
    (setq TransPnt1 (list 0.0 0.0 0.0))
    (setq TransPnt2 (list 0.0 -0.36 0.0))
    (setq TransStartMid (MidPnt TransPnt1 TransPnt2))
    (if (= TransWidth nil) (setq TransWidth (distance TransPnt1 TransPnt2)))
    (setvar "orthomode" 0)
    (setq OtherDist (- TransWidth 2.0))
    (while (not (setq OtherDist (xgetdist nil "\nEnter new duct width: "
    'OtherDist))))
    (setq TransStart TransStartMid)
    (prompt "\nPick side for transiton type: ")
    (while (/= (car (setq Transgrread (grread nil 1 0))) 3)
    (grdraw TransStartMid (cadr Transgrread) -1 1)
    (cond
    ((or;for stright transition
    (<= (angle TransStartMid (cadr Transgrread)) (+ TrueTransAngle (* pi
    0.25)))
    (>= (angle TransStartMid (cadr Transgrread)) (- TrueTransAngle (* pi
    0.25)))
    (= (angle TransStartMid (cadr Transgrread)) TrueTransAngle))
    (progn
    (setq OtherCen (polar TransStartMid TrueTransAngle 12))
    (setq TransPnt3 (polar OtherCen (+ TrueTransAngle (* pi 0.5)) (*
    OtherDist 0.5)))
    (setq TransPnt4 (polar OtherCen (- TrueTransAngle (* pi 0.5)) (*
    OtherDist 0.5)))
    (grdraw TransPnt1 TransPnt3 -1 1)
    (grdraw TransPnt3 TransPnt4 -1 1)
    (grdraw TransPnt4 TransPnt2 -1 1)
    );end progn
    );end test
    ((or
    (< (angle TransStartMid (cadr Transgrread)) (+ TrueTransAngle (* pi
    0.25)))
    (> (angle TransStartMid (cadr Transgrread)) (+ TrueTransAngle (* pi
    0.5))))
    (progn
    (setq TransPnt3 (polar TransPnt1 TrueTransAngle 12))
    (setq TransPnt4 (polar TransPnt3 (- TrueTransAngle (* pi 0.5))
    OtherDist))
    (grdraw TransPnt1 TransPnt3 -1 1)
    (grdraw TransPnt3 TransPnt4 -1 1)
    (grdraw TransPnt4 TransPnt2 -1 1)
    );end progn
    );end test
    ((or
    (> (angle TransStartMid (cadr Transgrread)) (- TrueTransAngle (* pi
    0.25)))
    (< (angle TransStartMid (cadr Transgrread)) (- TrueTransAngle (* pi
    0.5))))
    (progn
    (setq TransPnt4 (polar TransPnt2 TrueTransAngle 12))
    (setq TransPnt3 (polar TransPnt4 (+ TrueTransAngle (* pi 0.5))
    OtherDist))
    (grdraw TransPnt1 TransPnt3 -1 1)
    (grdraw TransPnt3 TransPnt4 -1 1)
    (grdraw TransPnt4 TransPnt2 -1 1)
    );end progn
    );end test
    (T nil)
    );cond
    );end while
    (command ".line" TransPnt1 TransPnt3 "")
    (command ".line" TransPnt3 TransPnt4 "")
    (command ".line" TransPnt4 TransPnt2 "")
    ) ;defun
     
    Rabbit, Oct 13, 2004
    #1
  2. Don't know much about grread or how it works
    but surprised it works for you at all with this typo.
    (defun MidPnt (TransPnt1 TransPnt2 <need a space here> / P1X P1Y P2X P2Y)

    --
    Autodesk Discussion Group Facilitator



    <snip>
     
    Jason Piercey, Oct 13, 2004
    #2
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.