Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/15/2021 in all areas

  1. I don't like modifying others' codes but this is just an example of avoiding error from the use of While with true statement although adding an error function is recommended in this case to reset the system variable used in the routine and to exit calmly / safely. (defun C:XY (/ # x y pt1 pt2) (setq oldsnap (getvar 'osmode) ;saves osmode # 1 ) (if (/= (setq str (getstring "\nEnter the Word: ")) "") (progn (setvar 'osmode 1) (while (setq pt1 (getpoint "\nSelect the Point")) (setq pt2 (polar pt1 (DtR 270) 3.5) x (rtos (car pt1) 2 3) y (rtos (cadr pt1) 2 3) ) (command "_.Text" "_non" pt1 2.5 "0" (strcat str (itoa #))) ;use non infront of points to prevent snaping (command "_.Text" "_non" pt2 2.5 "0" x) (command "_.Text" "_non" (polar pt2 (DtR 270) 3.5) 2.5 "0" y) (setq # (+ # 1)) ) (setvar 'osmode oldsnap) ;restores old snaps (princ) ) ) (princ) ) (defun DtR (d) (* pi (/ d 180.0))) ;degree to radian (defun RtD (r) (* 180.0 (/ r pi))) ;radian to degree
    2 points
  2. Made your changes except the getpoint one. I (setq pt1 t) so it will enter into the while function. As long as you keep selecting points the loop will continue, stop and it will exit. or am i miss understanding what your saying?
    1 point
  3. @mhupp if you relocate getpoint function in place of pt1 in front of while function specifically then this would be the best way to exit the program with enter to avoid the fore-said error you already demonstrated. Also you don't need to set the system variable OSMODE every time a user specify a point so you can move it above while function since you need it set only once. I don't know what's the use of regen in this routine !
    1 point
  4. Yes the line with strcat isn't working. This might be better: (setq ntxx (strcat str1 (itoa yazi))) (no bracket needed after strcat, a bracket means it looks at the next word to be a command which str1 isn't. Then strcat wants to combine strings and doesn't like combining strings and numbers... so change the number, yazi to a string with itoa or rtos )
    1 point
  5. You might see if CadTools has what you need.
    1 point
  6. Maybe it's a graphics card issue. I've always been impressed with how logically Object Snaps work. When snapping to an Endpoint which may have other possible snaps close by remember you can pick anywhere on that half of the segment so there should never be a reason to accidentally snap to the wrong point. I have coworkers that still feel the need to hover near the endpoint for snapping to them though, drives me nuts. With your settings it logically only snaps to Perpendicular or Center if you're not near one of the more specifically defined ones like Endpoint, Midpoint or Intersection. You don't need to check Intersection mode as it's logically included with Apparent intersection checked. The visual cue for Intersection will display if it's not just an Apparent intersection.
    1 point
  7. Frequently, after a topographic survey, I have to prove the obtained area of a Lot of Land. This lisp creates a table with the analytical method of the Gauss's area formula. I do not need absolute precision, but logically (owing to rounding) by increasing decimal units you can get a result as close to the real one. It is still to be completed, but I never have time to finish it. You can change the nonsense I wrote in English AreaG.LSP
    1 point
×
×
  • Create New...