'why fillet function is not work in this code?

i try to make a fillet in this code but not work in a while condition.

(defun c:fil ()

  (setq osm  "osmode" )

  (setvar "osmode" 0)

  (setq f1 nil)

  (setq f2 nil)

  (setq p1 (getpoint "\npic first point:"))
  

  (setq e 10)

  

  (while e

  

    
    (setq p2 (getpoint p1 "\npick second point: "))

   

    (setq a (angle p1 p2))


    (setq p3 (polar p1 (+ a (dtr 90.0)) 0.2))

    (setq p4 (polar p2 (+ a (dtr 90.0)) 0.2))

    
    

     

    (command "line" p1 p2 "" "")
    (command "line" p3 p4 "" "")

   

    (setq f1 (polar p1 a 0.2))

    (setq f2 (polar p2 a 0.2))

    (command "fillet"  f1 f2)

   (setq p1 p2)
    

    )

  )
  


(defun dtr (x)

  (* pi (/ x 180.0))
  )`


Solution 1:[1]

I'm not sure what this command is supposed to do, but I fixed the error when looping.
You need to use (command-s... and (vl-cmdf... instead of (command...

When you're using (command and noticing errors in your Lisp there are two alternatives to try:

1.) try (command-s

http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-5C9DC003-3DD2-4770-95E7-7E19A4EE19A1.htm,topicNumber=d30e608833

2.) try (vl-cmdf which validates arguments before running the command.
http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-6F1AAB6B-D5B1-426A-A463-0CBE93E4D956.htm,topicNumber=d30e650884

Both work for different scenarios when (command is throwing an error.

(defun c:fil ( / A E F1 F2 OSM P1 P2 P3 P4)
  (setq osm "osmode")
  (setvar "osmode" 0)
  (setq f1 nil)
  (setq f2 nil)
  (setq p1 (getpoint "\npick first point:"))
  (setq e 10)
  (while e
    (setq p2 (getpoint p1 "\npick second point: "))
    (setq a (angle p1 p2))
    (setq p3 (polar p1 (+ a (dtr 90.0)) 0.2))
    (setq p4 (polar p2 (+ a (dtr 90.0)) 0.2))
    (command-s "line" p1 p2 "" "")
    (command-s "line" p3 p4 "" "")
    (setq f1 (polar p1 a 0.2))
    (setq f2 (polar p2 a 0.2))
    (vl-cmdf "fillet" f1 f2)
    (setq p1 p2)
  )
)

(defun dtr (x)
  (* pi (/ x 180.0))
)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hovercraft Full Of Eels