Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/16/2020 in all areas

  1. I don't understand this one. In a simple way, it's not possible. In more advanced ways by using LM:GrSnap, it links to the third question you asked. This utilises a function in AutoLISP known as grread. It basically reads any input AutoCAD receives. Combining grread with the while loop, you can enhance this feature. I think it might be too hard for you to understand this, but you can have a look at some examples. Below is my example of a circle that will move alongside your circle, while pressing + and - will modify its radius. (defun c:tc ( / cir gr grp grv inc rad) (setq cir (entmakex '((0 . "CIRCLE") (10 0.0 0.0 0.0) (40 . 10))) rad 10 inc 1 ; I'll use this as example to indicate the amount of radius it will increase and decrease with every press ) (while (progn (setq gr (grread t 15 0) ; returns any input received by AutoCAD (at that instant moment [I think?]) grp (cadr gr) ; the value associated with the input (can vary) grv (car gr) ; the type of input AutoCAD received ) (cond ((= grv 5) ; a value of 5 indicates mouse movement (and 'grp' would then be the coordinates of the cursor in UCS) (entmod ; so everytime your mouse moves, you modify its center point to the mouse cursor. (subst (cons 10 grp) (assoc 10 (entget cir)) (entget cir) ) ) ) ((= grv 2) ; a value of 2 indicates keyboard input (and 'grp' will be an integer representing the code returned by (ascii)... (ascii "+") --> 43 (cond ((= grp 45) ; <-- This is if the "-" key is pressed (if (or ; if the user presses "-" when the radius is 1, that's invalid, so include this check (minusp (- rad inc)) (zerop (- rad inc)) ) (princ "\nRadius cannot be set smaller") (entmod ; otherwise, modify the radius to decrease by 1 (subst (cons 40 (setq rad (- rad inc))) (assoc 40 (entget cir)) (entget cir) ) ) ) ) ((member grp '(43 61)) ; This is if the "+" key is pressed... In your keyboard, you may see it as "+", but what you're really pressing is "=", thus 61. (entmod ; modify the radius to increase by 1 (subst (cons 40 (setq rad (+ rad inc))) (assoc 40 (entget cir)) (entget cir) ) ) ) ) ) ((= grv 3) ; a value of 3 indicates a mouse click. You'd want to end the command when this happens nil ; so include 'nil' to escape the while loop ) (t) ; Anything else, return T to stay within the loop and repeat. ) ) ) (princ) ) If you can use it, you can utilise it to do all sorts of cool things. Some examples are Limited Length Polyline, Align Text to Curve, TracePoly Plus, what's wrong with vl? You can't do many things that vl offers... like extracting block attributes, getting dynamic block properties...
    1 point
×
×
  • Create New...