Message 1 of 23
Draw Line under Angle - work bad (bad Angles)

Not applicable
01-22-2015
10:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I made such lisps to draw under angle specified by two points, or like in Otho mode:
Please, help me.
;Command: QNGPOI ;Specify First Point of Line: ;Specify First Point to define Angle: ;Specify Second Point to define Angle: ;Specify Length of the Line: 23 ;; error: bad argument type: numberp: (-298.858 0.0) ; QNGPOI = line aNGle POInts (defun c:QNGPOI (/ ptL1 ptANG1 ptANG2 Length Xpt1 Ypt1 Xpt2 Ypt2 DX DY TAN Angle Radians->Degrees ptL2 ) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq ptANG1 (getpoint "\nSpecify First Point to define Angle: ")) (setq ptANG2 (getpoint "\nSpecify Second Point to define Angle: ")) (setq Length (getreal "\nSpecify Length of the Line: ")) (setq XptANG1 (car ptANG1)) (setq XptANG1 (cdr ptANG1)) (setq XptANG2 (car ptANG2)) (setq YptANG2 (cdr ptANG2)) (setq DX (- XptANG2 XptANG1)) (setq DY (- YptANG2 YptANG1)) (setq TAN (/ DY DX)) ; If XptANG1 = XptANG2 --> DX = 0, the angle is equal to 90 degrees ; But in CommandLine probably will be error (dividing by 0 in TAN) (setq Angle (atan TAN)) (defun Radians->Degrees (numberOfRadians) (* 180.0 (/ numberOfRadians pi)) ) (setq ptL2 (polar ptL1 (Radians->Degrees (Angle)) Length)) (command "_LINE" ptL1 ptL2) ) ;---- ; Zawsze rysuje linie pod kątem 0 stopni (defun c:QNGD2R (/ ptL1 Length Angle Degrees->Radians ptL2) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (setq Angle (getangle "\nType the Angle value or Pick two Points to define Angle: ")) (defun Degrees->Radians (numberOfDegrees) (* pi (/ numberOfDegrees 180.0)) ) (setq ptL2 (polar ptL1 (Degrees->Radians Angle) Length)) (command "_LINE" ptL1 ptL2) ) ;--- (defun c:QNGR2D (/ ptL1 Length Angle Radians->Degrees ptL2) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (setq Angle (getangle "\nType the Angle value or Pick two Points to define Angle: ")) (defun Radians->Degrees (numberOfRadians) (* 180.0 (/ numberOfRadians pi)) ) (setq ptL2 (polar ptL1 (Radians->Degrees Angle) Length)) (command "_LINE" ptL1 ptL2) ) ;--- (defun c:QNG (/ ptL1 Length Angle ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (setq Angle (getangle "\nType the Angle value or Pick two Points to define Angle: ")) (princ "\nAngle is equal to: ") Angle (setq ptL2 (polar ptL1 Angle Length)) (command "_LINE" ptL1 ptL2) ) ;--- ;QQSEGNG = polyline SEGment aNGle (defun c:QQSEGSNG (/ ptL1 Length Angle ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Polyline Segment: ")) (setq Length (getdist "\nType Length of the Polyline Segment or Pick two Points to define Length: ")) (setq Angle (getangle "\nType the Angle value or Pick two Points to define Angle: ")) (princ "\nAngle is equal to: ") Angle (setq ptL2 (polar ptL1 Angle Length)) (command "_PLINE" ptL1 ptL2) ) ;---------- (defun c:QNGH (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 0 Length)) (command "_LINE" ptL1 ptL2) ) ;--- ;QQSEGNGH = polyline SEGment aNGle 0 (defun c:QQSEGSNGH (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Polyline Segment: ")) (setq Length (getdist "\nType Length of the Polyline Segment or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 0 Length)) (command "_PLINE" ptL1 ptL2) ) ;---------- ; Napraw ; Doesn't work properly ; Draws with Angle = 117, not 90 (defun c:QNGT (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 90 Length)) (command "_LINE" ptL1 ptL2) ) ;--- ;QQSEGNGT = polyline SEGment aNGle 90 (defun c:QQSEGSNGT (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Polyline Segment: ")) (setq Length (getdist "\nType Length of the Polyline Segment or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 90 Length)) (command "_PLINE" ptL1 ptL2) ) ;---------- ; Napraw ; Doesn't work properly ; Draws with Angle = 233, not 180 (defun c:QNGF (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (defun Radians->Degrees (numberOfRadians) (* 180.0 (/ numberOfRadians pi)) ) (setq ptL2 (polar ptL1 (Radians->Degrees 180) Length)) (command "_LINE" ptL1 ptL2) ) ;--- ;QQSEGNGF = polyline SEGment aNGle 180 (defun c:QQSEGSNGF (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Polyline Segment: ")) (setq Length (getdist "\nType Length of the Polyline Segment or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 180 Length)) (command "_PLINE" ptL1 ptL2) ) ;---------- ; Napraw ; Doesn't work properly ; Draws with Angle = 350, not 270 (defun c:QNGB (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Line: ")) (setq Length (getdist "\nType Length of the Line or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 270 Length)) (command "_LINE" ptL1 ptL2) ) ;--- ;QQSEGNGT = polyline SEGment aNGle 270 (defun c:QQSEGSNGB (/ ptL1 Length ptL2) (setvar "cmdecho" 0) (setq ptL1 (getpoint "\nSpecify First Point of Polyline Segment: ")) (setq Length (getdist "\nType Length of the Polyline Segment or Pick two Points to define Length: ")) (setq ptL2 (polar ptL1 270 Length)) (command "_PLINE" ptL1 ptL2) ) ;----------
Why the QNGPOI lisp doesn't work?
Why the other lisps draw Line under unproperly Angle?Please, help me.