Author Topic: QLEADER to MLEADER  (Read 4187 times)

0 Members and 1 Guest are viewing this topic.

jmyrwen

  • Guest
Re: QLEADER to MLEADER
« Reply #15 on: October 23, 2016, 02:29:36 PM »
I give up so i ended up with the following routine and 'it's working fine except that i cannot change the angle to 45 degrees instead of 90. Please help :( Thank you.

PS: I tried changing "setq l_45" but did'nt work

Code - Auto/Visual Lisp: [Select]
  1. (setq l_ang 90)
  2. (defun c:mm (/ sty nm p1 p2 ateblk p3)
  3.   (command "cmdecho" "0")
  4.   (setq osm (getvar "osmode"))
  5.   (setq ort (getvar "orthomode"));
  6.   (command "osmode" "15359")
  7.   (setq p1 (getpoint "\nPick origin point:)"))
  8.   (command "osmode" "0")
  9.   (command "orthomode" "0")
  10.   (setq p2 (getpoint "\nPick target" p1))
  11.   (princ)
  12.   (if (< (car p1) (car p2))
  13.     (progn
  14.       (if (< (cadr p1) (cadr p2))
  15.         (setq p3d (- (cadr p1) (cadr p2)))
  16.       )
  17.       (if (< (cadr p2) (cadr p1))
  18.         (setq p3d (- (cadr p2) (cadr p1)))
  19.       )
  20.       (if (< (cadr p2) (cadr p1))
  21.         (progn
  22.           (setq p3 (polar p2 (+ 0.0 (dtr (- l_ang))) (* p3d 1.0)))
  23.         )
  24.       )
  25.       (if (< (cadr p1) (cadr p2))
  26.         (progn
  27.           (setq p3 (polar p2 (+ 0.0 (dtr l_ang)) (* p3d 1.0)))
  28.         )
  29.       )
  30.     )
  31.   )
  32.   (if (< (car p2) (car p1))
  33.     (progn
  34.       (if (< (cadr p1) (cadr p2))
  35.         (setq p3d (- (cadr p1) (cadr p2)))
  36.       )
  37.       (if (< (cadr p2) (cadr p1))
  38.         (setq p3d (- (cadr p2) (cadr p1)))
  39.       )
  40.       (if (< (cadr p2) (cadr p1))
  41.         (progn
  42.           (setq p3 (polar p2 (+ 0.0 (dtr (- l_ang))) (* p3d 1.0)))
  43.         )
  44.       )
  45.       (if (< (cadr p1) (cadr p2))
  46.         (progn
  47.           (setq p3 (polar p2 (+ 0.0 (dtr l_ang)) (* p3d 1.0)))
  48.         )
  49.       )
  50.     )
  51.   )
  52.   (command "_mleader" "L" "H" "o" "m" "3" "x" p2 p3 p1 "XX-XX")
  53.   (command "osmode" osm)
  54.   (COMMAND "DDEDIT" "L")
  55.   (command "orthomode" ort)
  56. )
  57. ;
  58. (defun dtr (a)
  59.   (* pi (/ a 180.0))
  60. );                             
  61.  

ifncdylan

  • Guest
Re: QLEADER to MLEADER
« Reply #16 on: October 23, 2016, 09:35:28 PM »
Considering that code draws a 90 degree angled mleader, perhaps you could try changing the text '90' to '45' in the code :)

jmyrwen

  • Guest
Re: QLEADER to MLEADER
« Reply #17 on: October 23, 2016, 10:13:36 PM »
Considering that code draws a 90 degree angled mleader, perhaps you could try changing the text '90' to '45' in the code :)

tried that but no luck :/

ifncdylan

  • Guest
Re: QLEADER to MLEADER
« Reply #18 on: October 24, 2016, 10:32:23 PM »
Well, something must be horribly wrong with your CAD setup because I ran that code which made a 90degree angled leader after asking for 2 points, then I simply changed that l_ang variable to 45 and it worked fine.

You mentioned you tried to do "setq l_45 90" and it didn't work. If that's what you're talking about, that's because you didn't change the l_ang variable, you created a new variable called l_45 with the value of 90.

(setq l_ang 90) in the original code should be replaced with (setq l_ang 45) if you want to change the l_ang variable.