Author Topic: Frequency  (Read 1781 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
Frequency
« on: December 01, 2006, 04:22:24 AM »
Hi Alls,
This code still problem,especially in amplitude,I want result 3 but the fact only 0.8083,and this wave should be opposite to others,this code still monoton,sorry I got problem to post here with drawing
Code: [Select]
(defun c:freq (/ 1/2amp ad amp ang dis div freq p1 p2 p3 p4 px)
  (setq freq (getreal "\nEnter frequency for this line<3>: "))
  (if (= freq nil)(setq freq 3))
  (setq amp (getreal "\nEnter amplitude for this line<6>: "))
  (if (= amp nil)(setq amp 6))
  (setq p1 (getpoint "\nClick for first point<0,0,0>: "))
  (if (= p1 nil)(setq p1 '(0 0 0)))
  (setq p2 (getpoint "\nClick for first point<36,0,0>: "))
  (if (= p2 nil)(setq p2 '(36 0 0)))
  (setq dis (distance p1 p2))
  (setq div (/ dis amp))
  (setq ang (angle p1 p2))
  (setq 1/2amp (/ amp 2.0))
  (setq px p1)
  (repeat
    (fix div)
    (setq p3 (polar px ang 1/2amp))   
    (setq ad (getvar "angdir"))
    (if (= ad 0)(setvar "angdir" 1))   
    (command "arc" px "e" p3 "r" freq "")   
    (setq p4 (polar px ang 1/2amp))   
    (setq ad (getvar "angdir"))
    (if (= ad 1)(setvar "angdir" 0))   
    (command "arc" px "e" p3 "r" freq "")
    (setq px p4)
    )                                       ; repeat
  (princ)
  )


 

DEVITG

  • Bull Frog
  • Posts: 479
Re: Frequency
« Reply #1 on: December 02, 2006, 10:17:18 PM »
Hi Adesu , plese try this

Code: [Select]
(repeat
    (fix div)
    (setq p3 (polar px ang 1/2amp))   
;;;    (setq ad (getvar "angdir"))
;;;    (if (= ad 0)(setvar "angdir" 1))   
    (command "arc" px "e" p3 "r" freq "")   
    (setq p4 (polar p3 ang 1/2amp))   
;;;    (setq ad (getvar "angdir"))
;;;    (if (= ad 1)(setvar "angdir" 0))   
    (command "arc" p3 "e" p4 "r" freq "")
    (setq arc (entlast))
    (command "mirror" arc "" p3 p4 "y")
    (setq px p4)
    );_ repeat
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

DEVITG

  • Bull Frog
  • Posts: 479
Re: Frequency
« Reply #2 on: December 02, 2006, 10:21:24 PM »
This one also works
Code: [Select]
(repeat
    (fix div)
    (setq p3 (polar px ang 1/2amp))   
    (setq ad (getvar "angdir"))
    (if (= ad 0)(setvar "angdir" 1))   
    (command "arc" px "e" p3 "r" freq "")   
    (setq p4 (polar p3 ang 1/2amp))   
    (setq ad (getvar "angdir"))
    (if (= ad 1)(setvar "angdir" 0))   
    (command "arc" p4 "e" p3 "r" freq "")
    (setq arc (entlast))
    ;;(command "mirror" arc "" p3 p4 "y")
    (setq px p4)
    );_ repeat
  (princ)
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Adesu

  • Guest
Re: Frequency
« Reply #3 on: December 03, 2006, 07:22:39 PM »
Hi devitg,
many thanks for your help,your revised nice to look.