Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/20/2023 in all areas

  1. Try setting LISPSYS=0, restarting AutoCAD and running the program.
    1 point
  2. Not Polar Tracking, related to Dynamic Input (DYNMODE) IIRC.
    1 point
  3. When comparing reals (aka doubles) in AutoLISP, you should use the equal function with a small tolerance (e.g. 1e-8 = 0.00000001) in order to account for infinitesimal inaccuracies that are inevitably introduced at the limits of the precision of this format - two doubles are rarely ever exactly equal on a bitwise level. As such, I would suggest changing: (= height 594.0) To: (equal height 594.0 1e-8)
    1 point
  4. Copied and pasted stuff, try this: (defun c:rectcoords ( / MyRect Coords MyCoords ) (princ "\nSelect Rectangle") (if (setq MyRect (ssget "_+.:E:S" (list '(0 . "*POLYLINE") '(90 . 4) '(70 . 1)) )) ; Select single closed 4 line polyline (progn (setq Coords (vlax-get (vlax-ename->vla-object (ssname MyRect 0)) 'Coordinates) ) ; Get all coordinates (setq acount 0) (setq MyCoords (list)) (while (< acount (length Coords)) ; split coords list into pairs (setq MyCoords (append MyCoords (list (list (nth acount Coords) (nth (+ acount 1) Coords))))) (setq acount (+ 2 acount)) ) ; end while (setq height (distance (car MyCoords) (nth 3 MyCoords))) (setq width (distance (car MyCoords) (nth 1 MyCoords))) (if (= height 594.0) T (princ height) ) ; end if ) ; end progn (progn (princ "No Rectangle (4 vertex closed polyline) Selected") ) ; end progn ) ; end if (princ) ) ; end defun
    1 point
  5. Ok little busy at moment will do just a 4 hole in a rectang for now. Found some time added dim all 4 sides you can remove or rem out the unwanted dims. ; https://www.cadtutor.net/forum/topic/77320-how-to-fix-this-code-for-dimension-adjustment-tool/ ; Rectang with 4 holes and dimensioned ; By Alan H April 2023 (defun C:4holebox ( / oldsnaplen loff roff toff boff pt1 pt2 pt3 pt4 pt5 h1 h2 h3 h4) (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setvar 'clayer "PS_PLATE") (command "._-dimstyle" "_restore" "dpq_linear") (setq ans (AH:getvalsm (list "Enter Values" "Length " 5 4 "300" "Height" 5 4 "200" "Left offset" 5 4 "25" "Right offset" 5 4 "25" "Top offset" 5 4 "25" "Bottom offset" 5 4 "25" "Radius" 5 4 "10")) ) (setq len (atof (nth 0 ans)) ht (atof (nth 1 ans)) Loff (atof (nth 2 ans)) roff (atof (nth 3 ans)) toff (atof (nth 4 ans)) Boff (atof (nth 5 ans)) rad (atof (nth 6 ans)) ) (setq pt1 (getpoint "\nSelect lower left point ")) (setq pt2 (mapcar '+ pt1 (list len 0.0 0.0))) (setq pt3 (mapcar '+ pt1 (list len ht 0.0))) (setq pt4 (mapcar '+ pt1 (list 0.0 ht 0.0))) (command "rectang" pt1 pt3) ; do holes (setq h1 (mapcar '+ pt1 (list loff boff 0.0))) (command "donut" 0.01 rad h1 "") (setq h2 (mapcar '+ pt1 (list loff (- ht toff) 0.0))) (command "donut" 0.01 rad h2 "") (setq h3 (mapcar '+ pt1 (list (- len roff) boff 0.0))) (command "donut" 0.01 rad h3 "") (setq h4 (mapcar '+ pt1 (list (- len roff) (- ht toff) 0.0))) (command "donut" 0.01 rad h4 "") ; dim 4 sides (setq pt5 (mapcar '+ pt1 (list 0.0 -265 0.0))) (command "dim" "hor" pt1 pt2 pt5 "" "exit") (setq pt5 (mapcar '+ pt4 (list 0.0 265 0.0))) (command "dim" "hor" pt3 pt4 pt5 "" "exit") (setq pt5 (mapcar '+ pt4 (list -265 0.0 0.0))) (command "dim" "ver" pt1 pt4 pt5 "" "exit") (setq pt5 (mapcar '+ pt2 (list 265 0.0 0.0))) (command "dim" "ver" pt2 pt3 pt5 "" "exit") ; do 4 sides hole dims ; bot (setq pt5 (mapcar '+ pt1 (list 0.0 -150 0.0))) (command "dim" "hor" pt1 h1 pt5 "" "exit") (command "dim" "hor" h1 h3 pt5 "" "exit") (command "dim" "hor" h3 pt2 pt5 "" "exit") ; right (setq pt5 (mapcar '+ pt2 (list 150 0.0 0.0))) (command "dim" "ver" pt2 h3 pt5 "" "exit") (command "dim" "ver" h3 h4 pt5 "" "exit") (command "dim" "ver" h4 pt3 pt5 "" "exit") ; top (setq pt5 (mapcar '+ pt3 (list 0.0 150 0.0))) (command "dim" "hor" pt4 h2 pt5 "" "exit") (command "dim" "hor" h2 h4 pt5 "" "exit") (command "dim" "hor" h4 pt3 pt5 "" "exit") ; left (setq pt5 (mapcar '+ pt1 (list -150 0.0 0.0))) (command "dim" "ver" pt1 h1 pt5 "" "exit") (command "dim" "ver" h1 h2 pt5 "" "exit") (command "dim" "ver" h2 pt4 pt5 "" "exit") (setvar 'osmode oldsnap) (princ) ) You need to save the attached to a support directory so it can be auto loaded or edit code adding file location. Multi GETVALS.lsp
    1 point
×
×
  • Create New...