Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/15/2024 in all areas

  1. Consider taking the direct integer input rather than converting a string to a number. Here's a simple example: ;; List of values to use (setq l '(80 90 100 110 120 130 140 150)) (setq dbuitm1 (cond ;; If the user presses enter or the value does not exist in the list ((car (member (getint "\nDikte Buitenmuur [80/90/100/110/120/130/140/150]:<Enter for user input> " ) l ) ) ) ;; Then prompt for a user input value here ((getint "\nBreedte Buitenmuur in MM: ")) ) ) ;; Convert the numbers to strings and set your other variable to them ;; of course you have to make sure that 'dbuitm1 dspouw1 dbinm1' all exist (mapcar 'set '(dbuitm dspouw dbinm) (mapcar 'vl-princ-to-string (list dbuitm1 dspouw1 dbinm1)))
    1 point
  2. To get rid of that anoying message : "error: quit / exit abort" you colud build error handler, but to me I never excluded it - always used (if msg (prompt msg)) in handler... Take a look at Lee's error handlers - he escaped that message almost always...
    1 point
  3. Tsuky your code is doing what I suggested should have read it a bit closer, my bad, but it does not take into account Horizontal and Vertical scale. For example if we look at a cross section at 1:100 Hor 1:50 Ver for metric, if you look at the difference in the Y direction base line to new point the height needs to be; (setq dwgscale (/ 1000.0 (getreal "\n enter vertical scale "))) (setq dist (/ (- pt1 pt2) dwgscale)) (setq ht (+ dist datum)) Ps can use my Multi getvals.lsp for the Hor & Ver scale input.
    1 point
  4. This is what I use: (defun c:mdist (/ n p1 p2 d v) (setq d 0 n 0) (while (and (or p1 (setq p1 (getpoint "\nSpecify start point: "))) (setq p2 (getpoint p1 "\nSpecify next point: ")) ) (setq d (+ d (distance p1 p2)) v (append v (list (setq n (1+ n)) p1 p2)) p1 p2 ) (grvecs v) (princ (strcat "\nRunning total is " (rtos d))) ) )
    1 point
  5. With this modification? (defun c:cd ( / p1 p2 d1 prdist p3 d0 cumd) (setvar "cmdecho" 0) (graphscr) (setq p1 (getpoint "\nPick start point ") p2 (getpoint p1 "\nPick next point ") d1 (abs (- (car p2) (car p1))) prdist (strcat "\nDistance: " (rtos d1 2 0)) ) (princ prdist) (setq p3 (getpoint p2 "\nPick next point or RETURN if done ")) (while p3 (setq d0 (abs (- (car p3) (car p2))) d1 (+ (abs (- (car p3) (car p2))) d1) p2 p3 prdist (strcat "\nDistance: " (rtos d0 2 0) ", Cumulative distance: " (rtos d1 2 0)) ) (princ prdist) (setq p3 (getpoint p2 "\nPick Next Point ")) ) (setq cumd (strcat "Cumulative distance --> " (rtos d1 2 0))) (prompt cumd) (princ) )
    1 point
  6. Hi Luka, A start with this? (defun c:foo ( / ss dxf_line dxf_10 dxf_11 pt_ref z_ref pt) (princ "\nSelect axe line") (while (not (setq ss (ssget "_+.:E:S" '((0 . "LINE") (8 . "ENK_EKSEN")))))) (setq dxf_line (entget (ssname ss 0)) dxf_10 (cdr (assoc 10 dxf_line)) dxf_11 (cdr (assoc 11 dxf_line)) pt_ref (list (car dxf_10) (min (cadr dxf_10) (cadr dxf_11))) ) (princ "\nSelect comparaison plane text") (while (not (setq ss (ssget "_+.:E:S" '((0 . "TEXT") (8 . "ENK_KIYAS KOT")))))) (setq z_ref (atof (cdr (assoc 1 (entget (ssname ss 0))))) ) (setvar "CLAYER" "kot-mes") (while (setq pt (getpoint "\nGive a point: ")) (command "_.leader" pt "_none" pause "_annotation" (strcat (rtos (+ z_ref (- (cadr pt) (cadr pt_ref))) 2 3) "\\P" (rtos (- (car pt) (car pt_ref)) 2 3) ) "" ) ) (prin1) )
    1 point
  7. hi, i'm looking for lisp that could calculate the grade percentage of a polyline, or 2 points. i'm doing it manually now by measuring the polyline by DIST, and the dividing the delta Y by delta x. it doesn't need to necessarily calculate the percent itself, i'm fine with just the decimal fraction. also it doesn't matter if the result will be in the command line or in inserted text. i would be grateful for that, i'm looking everywhere and i cant even find some routine to modify with my limited knowledge of writing lisps.
    1 point
  8. @MARUEL B. BELAZA That's very similar to the code from pintseta. What more does yours add?
    1 point
  9. I hope this code will help you, it will get the percentage of the slope of two point, refer to the previous code that i get. have a great day (defun c:grade () (prompt "\nPick points for the grade") (setq ang1 (getangle)) (setq tanofang (/ (cos ang1) (sin ang1))) (setq grade1 (/ 100 tanofang)) (setq txt1 (strcat (rtos grade1 2 2) "%")) (setq pnt1 (getpoint "\nPick location for text")) (command "text" pnt1 "0.00" txt1) )
    1 point
  10. hi all, i wrote a program to calculate degree ,and now, i want a function to convert decimal degree to degree and minute, can anyone help me about this? (sorry for my poor english)
    1 point
  11. Its just maths 1 min = 60 secs 1 sec = 360 etc just keep taking the FIX of the decimal and moving it. 30d 30' 30" = 30.50833333 so fix = 30 rem = .508333 * 60 = 30.49999 fix = 30 mins rem = .499999 * 60 = 29.999999 secs
    1 point
  12. You could use a combination of angtof & angtos.
    1 point
  13. Your actually not measuring grade this would imply for me a vertical slope Z, rather your reflecting a plane angle as a 1 in or a percent. You can also do say cross section slopes which have been plotted as 2d but take into account the difference in scale factor again as 1 in or percent.
    1 point
  14. well thank you both for the quick reply. i tried all the options you linked and so far the closest routine for what i need is GRADE. but it needs some changes - lets say i have polyline with 2% grade, delta y=0.1m, delta x=5m. the lisp will results with the text 50:1. i want the routine to discard the ":1" (which i think i know how to do), and divide 100 with the "50" (or any other results) with one decimal place accuracy. so the result in this case will be "2.0". I would greatly appreciate your help p.s. for anyone who copying the routine, notice that your default text style height is greater then 0.00, otherwise it wont work. (defun c:grade () (prompt "\npick points for the grade") (setq ang1 (getangle)) (setq tanofang (/ (sin ang1) (cos ang1))) (setq grade1 (/ 1 tanofang)) (setq txt1 (strcat (rtos grade1 2 1) ":1")) ;;delete this? ;; (setq pnt1 (getpoint "\nPick location for text")) (command "text" pnt1 (rtd ang1) txt1) ) (defun rtd (a) (/ (* a 180.0) pi) )(defun c:grade () (prompt "\npick points for the grade") (setq ang1 (getangle)) (setq tanofang (/ (sin ang1) (cos ang1))) (setq grade1 (/ 1 tanofang)) (setq txt1 (strcat (rtos grade1 2 1) ":1")) (setq pnt1 (getpoint "\nPick location for text")) (command "text" pnt1 (rtd ang1) txt1) ) (defun rtd (a) (/ (* a 180.0) pi)
    1 point
  15. I think OP want this with LWPOLYLINE... Look here : http://www.cadtutor.net/forum/showthread.php?85501-Need-help-to-get-slope-polylines-2D&p=#5 HTH, M.R.
    1 point
  16. Take a look: http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/grade-or-slope-lisp-routine/td-p/2172103 https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/label-slope-between-two-points/td-p/2604319
    1 point
×
×
  • Create New...