Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/27/2023 in all areas

  1. Starting out I would create file and in that file I would list what I wanted the lisp to do. Then I would break down that list into steps Autocad would need to take to complete the task. having small tasks is easier to code (and debug). After everything is running without errors then I would go back and add in error checking or limitations to eliminate the code breaking. it might be if nothing was selected end code. or if the wrong thing was selected prompt the user to try again. adding QoL to lisp rather than waiting on an error code an trying again. Then after awhile this become second nature and you won't really need to do this anymore. unless your working on something taking multiple steps. Find the largest radius of selected entities User selects entities compair the radius of each entity display the largest one ;;----------------------------------------------------------------------------;; ;; Display largest raidus of selected arcs or circles (defun C:LRAD () (setq ss (ssget)) ;User selects entities (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) ;compair the radius of each entity ) ;Display the largest one ) if this code was run it would show "Largest Radius: 0.000" if nothing was selected. ;;----------------------------------------------------------------------------;; ;; Display largest raidus of selected arcs or circles (defun C:LRAD (/ ss r x) (setq ss (ssget '((0 . "ARC,CIRCLE")))) ;limit selection to Arc's and circles aka stuff with a raidus (setq r 0) ;set r at 0 to keep track of largest radius (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (if (> (setq x (cdr (assoc 40 (entget ent)))) r) ;compair the raidus to the variable r (setq r x) ;if r is smaller set r to the new value ) ) (prompt (strcat "\nLargest Radius: " (rtos r 2 3))) ;once all entities have been processed display the value of r (princ) ) this code would show "Nothing was Selected" ;;----------------------------------------------------------------------------;; ;; Display largest raidus of selected arcs or circles (defun C:LRAD (/ ss r x) (if (setq ss (ssget '((0 . "ARC,CIRCLE")))) ;limit selection to Arc's and circles aka stuff with a raidus (progn (setq r 0) ;set r at 0 to keep track of largest radius (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (if (> (setq x (cdr (assoc 40 (entget ent)))) r) ;compair the raidus to the variable r if its bigger set r to the new value (setq r x) ) (prompt (strcat "\nLargest Radius: " (rtos r 2 3))) ;once all entities have been processed display the value of r ) (prompt "\nNothing was Selected") ) (princ) )
    2 points
  2. Check the linetype assigned to the layer your leader is on. Check the settings for the leader style, especially the landing distance. Check the size of the arrowhead versus the length of the leader. There's an explanation somewhere, you just have to find it. There are a lot of moving parts in these parametric objects, such as dimensions and multileaders. You can't always predict what you'll get.
    1 point
  3. For some code where you are repeating the same code over and over then look at a defun for that task, reduces size of code. The other thing I do as hinted by mhupp I make a defun to complete 1 task this way I can test just that section of code adding more steps as I go. Often that defun gets used in other code. Lastly I tend to copy and paste to command line rather than trying to write 1 big bit of code, it may be like 1 line entsel, then 20 lines doing something with entity selected get each step working before throwing into a repeat 50 times.
    1 point
  4. For someone who want a software solution to this problem. I find a similar question on forums.autodesk.com (http://forums.autodesk.com/t5/AutoCAD-2000-2000i-2002-DWG/Disabling-Wheel-Button-Double-click/td-p/205130), But there is no answer either. copy the following code to a blank text file and save it as acadMbutton.ahk. MButton:: If (A_TimeSincePriorHotkey < 300) ;hyperclick Return Click Down Middle KeyWait, MButton Click Up Middle Return WheelDown:: If GetKeyState("MButton") Return Send {WheelDown} Return WheelUp:: If GetKeyState("MButton") Return Send {WheelUp} Return Download Autohotkey from http://l.autohotkey.net/, and run the script with Autohotkey This script do two things: 1. disable very quick middle button double click, if you set the time to large enough, for example 2000, it will disable double click complelely 2. disable mouse wheel while the middle button is pressed down
    1 point
  5. Hello everyone. Please help me with Lisp similar to in Video. Thank you all
    -1 points
×
×
  • Create New...