Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/13/2021 in all areas

  1. Maybe this will give you some ideas: (defun c:foo (/ a b c d e i l mp o p p2 s) (setq d 0.075) (if (setq s (ssget "_X" '((0 . "LWPOLYLINE")))) (progn (setq s (mapcar 'cadr (ssnamex s))) (while (setq p (getpoint "\nPick a point:")) (setq a (mapcar '(lambda (e) (list (setq p2 (vlax-curve-getclosestpointto e p)) (distance p p2) e)) s ) ) (setq a (vl-sort a '(lambda (r j) (< (cadr r) (cadr j))))) (cond ((< (cadar a) d) (setq o (vlax-ename->vla-object (last (car a)))) (mapcar 'set '(b c) (mapcar 'car a)) (setq mp (mapcar '/ (mapcar '+ b c) '(2 2 2))) (setq l (entmakex (list '(0 . "LINE") (cons 10 (polar p (angle p b) d)) (cons 11 (polar p (angle b p) d)) '(8 . "templayer") ) ) ) (setq i (vlax-invoke o 'intersectwith (vlax-ename->vla-object l) 0)) (entdel l) (if (= 6 (length i)) (setq b (mapcar '+ i '(0 0 0)) c (mapcar '+ (cdddr i) '(0 0 0)) mp (mapcar '/ (mapcar '+ b c) '(2 2 2)) ) ) (entmakex (list '(0 . "CIRCLE") (cons 10 mp) (cons 40 (/ (distance b c) 2)) '(62 . 3))) ) ) ) ) ) ) (vl-load-com)
    1 point
  2. In my opinion, the author does not read all the messages, only the last one I previously gave lisp and solution for all files
    1 point
  3. You can set the mins and seconds to positive by adding abs function. ; Convert Decimal Degrees to dms. (defun convertDDdms (x1 / deg mins sec) (setq deg (rtos (fix X1) 2 0) ;- degrees mins (rtos (abs (fix (* (- X1 (fix X1)) 60))) 2 0) ; - minutes sec (rtos (abs (* (- (* X1 60) (fix (* x1 60))) 60)) 2 4) ;- seconds ) (strcat deg "° " mins "' " sec "\"")) ) So -16.1382675 is showing up as Latitude: -16° -8' -17.7630" with abs added it will look like this Latitude: -16° 8' 17.7630"
    1 point
  4. That can easily be controlled with the system variable HPSEPARATE: https://help.autodesk.com/view/ACD/2022/ENU/?guid=GUID-82537D46-06CD-4A2B-9148-1475A3599B12 Controls whether a single hatch object or separate hatch objects are created when operating on several closed boundaries. Type:Integer Saved in:Registry Initial value:0 Value = 0 A single hatch object is created Value = 1 Separate hatch objects are created I'd save current value, set it to 1 for the lisp, then reset it on exit.
    1 point
  5. Your while loop is checking for empty string "", thus never stopping. You could change that to (while (setq pt1 (getpoint)), and then use the variable pt1 inside the hatch command in place of pause. If you press enter instead of picking a point, pt1 will be nil, and the while loop will exit.
    1 point
×
×
  • Create New...