mhupp Posted February 8, 2021 Posted February 8, 2021 I cant figure out the if statement to test if my variable ent is a circle. defined by "(setq ent (car (nentselp pt)))" Quote
Tharwat Posted February 8, 2021 Posted February 8, 2021 Why are you using the nentselp function ? are you after selecting nested object ? if not, then use the entsel function instead. To check if the selected object is a Circle: (= (cdr (assoc 0 (entget ent))) "CIRCLE") The above code should return T ( true ) if the object is Circle otherwise nil. 1 Quote
mhupp Posted February 8, 2021 Author Posted February 8, 2021 (edited) Modifying a lisp Lee Mac made back in '09. it does what i need but doesn't work on circles. adding the if statement and using the trim command for when a circles is selected. (if (not (= (cdr (assoc 0 (entget ent))) "CIRCLE")) (command "_.break" (list ent pt) "_F" "_non" (polar pt ang (/ off 2.)) "_non" (polar pt (+ pi ang) (/ off 2.))) (progn (vl-cmdf "_circle" pt "0.0078") (setq obj (entlast)) (vl-cmdf "_view" "save" "s") (vl-cmdf "_Zoom" "OB" obj "") (vl-cmdf "_trim" obj "" pt "") (vl-cmdf "_erase" obj "") (vl-cmdf "_view" "restore" "s") ) ) And thank you for the help. Edited February 8, 2021 by mhupp Quote
Tharwat Posted February 8, 2021 Posted February 8, 2021 (edited) You're welcome anytime. A few mods if you are interested. (if (= (cdr (assoc 0 (entget ent))) "CIRCLE") (progn (vl-cmdf "_circle" "_non" pt "0.0078") (setq obj (entlast)) (vl-cmdf "_view" "save" "s") (vl-cmdf "_Zoom" "OB" obj "") (vl-cmdf "_trim" obj "" "_non" pt "") (vl-cmdf "_erase" obj "") (vl-cmdf "_view" "restore" "s") ) (command "_.break" (list ent pt) "_F" "_non" (polar pt ang (/ off 2.)) "_non" (polar pt (+ pi ang) (/ off 2.)) ) ) Edited February 8, 2021 by Tharwat 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.