htls69 Posted March 27, 2017 Posted March 27, 2017 looking for lisp that would allow me to select a cogo point for the layer the a point to then draw a right angle rectangle using three point for a utility box. Our surveyors don't know how to shoot 3 points on a utility box and have them be square. Quote
BIGAL Posted March 28, 2017 Posted March 28, 2017 There is all sorts of ways of doing this one of the better methods is in the coding of the point by adding to the description. eg PIT 3x2x30 is a pit that is 3' by 2' long swung 30 degrees. As an example we have trees that are doubled coded trunk diameter and spread, its a second pass where we look for certain point codes and modify the point. Let me know if you want code. I would just collect all PIT points and step through them L & W & Angle. Again angle of points is a lisp for setting the angle of individual CIV3d points. Thinking a bit more why not PIT32 for the code. Lastly our surveyors pick up 4 pts in the field so pits can be located for size a few extra minutes but huge saving back in the office. ; draw pits with 100mm walls aligned to line ; By Alan H 2011 (defun simplepit ( / pitl pitw pt1 pt2 pt3 pt4 pt5 pt6 ang ang2 ang3 ang4 ) (SETQ PI2 (/ PI 2.0) (setq oldsnap (getvar "osmode")) (setq oldlayer (getvar "clayer")) (setvar 'plinewid 0.0) (command "_layer" "n" "Design-Drainage-Pits" "c" 4 "Design-Drainage-Pits" "") (setvar "clayer" "Design-Drainage-Pits") (if (not AH:getval2) (load "getvals")) (ah:getval2 "Please enter Pit L m: " 6 5 "0.9" "Please enter Pit W " 6 5 "0.6") (setq pitl (Atof val1)) (setq pitw (Atof val2)) (setq pt1 (getpoint "\npick 1st point to place pit : ")) (setq pt2 (getpoint "\nPick 2nd point for orientation")) (setvar "osmode" 0) (setq pt7 (getpoint "\Pick pt on pit side : ")) (setq ang (angle pt1 pt2)) (setq ang5 (angle pt2 pt7)) (setq diffang (- ang ang5)) (if (> diffang PI2) (setq ang2 (- ang PI2)) (setq ang2 (+ ang PI2)) ) (setq ang3 (+ ang PI)) (setq ang4 (- ang PI2)) (setq pt3 (polar pt1 ang PitL)) (setq pt4 (polar pt3 ang2 PitW)) (setq pt5 (polar pt4 ang3 PitL)) (command "pline" pt1 pt3 pt4 pt5 "c") (setq pt6 (polar pt1 ang 50.0)) (command "offset" 0.1 pt4 pt6 "") (setvar "osmode" oldsnap) (setvar "clayer" oldlayer) (princ) ) (simplepit) ; Input Dialog box with variable title ; multiple lines of dcl input supported ; add extra lines if required by copying code defun ; By Alan H 2015 (vl-load-com) ; 1 line dcl ; sample code (ah:getval1 "Line 1" 5 4) (defun AH:getval1 (title width limit / fo fname) ; you can hard code a directory if you like for dcl file (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line "ddgetval : dialog {" fo) (write-line " : row {" fo) (write-line ": edit_box {" fo) (write-line (strcat " key = " (chr 34) "key1" (chr 34) ";") fo) (write-line (strcat " label = " (chr 34) title (chr 34) ";" ) fo) ; these can be replaced with shorter value etc (write-line (strcat " edit_width = " (rtos width 2 0) ";" ) fo) (write-line (strcat " edit_limit = " (rtos limit 2 0) ";" ) fo) (write-line " is_enabled = true;" fo) (write-line " }" fo) (write-line " }" fo) (write-line "ok_only;}" fo) (close fo) (setq dcl_id (load_dialog fname)) ; pt is a list 2 numbs -1 -1 centre ('(20 20)) ;(not (new_dialog "test" dch "" *screenpoint*)) (if (not (new_dialog "ddgetval" dcl_id)) (exit)) (action_tile "key1" "(setq val1 $value)") (mode_tile "key1" 3) (start_dialog) (done_dialog) (unload_dialog dcl_id) ; returns the value of val1 as a string (vl-file-delete fname) ) ; defungetval1 ; 2 line dcl ; sample code (ah:getval2 "Line 1" 5 4 "Line2" 8 7) (defun AH:getval2 (title1 width1 limit1 title2 width2 limit2 / fo fname) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) ;(setq fname (strcat (getvar "SAVEFILEPATH") "[url="file://\\getval2.dcl"]\\getval2.dcl[/url]")) ;(setq fo (open fname "w")) (write-line "ddgetval2 : dialog {" fo) (write-line " : column {" fo) (write-line ": edit_box {" fo) (write-line (strcat " key = " (chr 34) "key1" (chr 34) ";") fo) (write-line (strcat " label = " (chr 34) title1 (chr 34) ";" ) fo) (write-line (strcat " edit_width = " (rtos width1 2 0) ";" ) fo) (write-line (strcat " edit_limit = " (rtos limit1 2 0) ";" ) fo) (write-line " is_enabled = true ;" fo) (write-line " }" fo) (write-line "spacer_1 ;" fo) (write-line ": edit_box {" fo) (write-line (strcat " key = " (chr 34) "key2" (chr 34) ";") fo) (write-line (strcat " label = " (chr 34) title2 (chr 34) ";" ) fo) (write-line (strcat " edit_width = " (rtos width2 2 0) ";" ) fo) (write-line (strcat " edit_limit = " (rtos limit2 2 0) ";" ) fo) (write-line " is_enabled = true ;" fo) (write-line " }" fo) (write-line " }" fo) (write-line "spacer_1 ;" fo) (write-line "ok_only;}" fo) (close fo) ; code part (setq dcl_id (load_dialog fname)) (if (not (new_dialog "ddgetval2" dcl_id)) (exit)) (mode_tile "key1" 3) (action_tile "key1" "(setq val1 $value)") (mode_tile "key2" 3) (action_tile "key2" "(setq val2 $value)") (start_dialog) (done_dialog) (unload_dialog dcl_id) ; returns the value of val1 and val2 as strings (vl-file-delete fname) ) ; defungetval2 ; 3 line dcl ; sample code (ah:getval3 "Line 1" 5 4 "Line 2" 8 7 "Line 3" 6 4) (defun AH:getval3 (title1 width1 limit1 title2 width2 limit2 title3 width3 limit3 / fo fname) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) ;(setq fname (strcat (getvar "SAVEFILEPATH") "[url="file://\\getval3.dcl"]\\getval3.dcl[/url]")) ;(setq fo (open fname "w")) (write-line "ddgetval3 : dialog {" fo) (write-line " : column {" fo) (write-line ": edit_box {" fo) (write-line (strcat " key = " (chr 34) "key1" (chr 34) ";") fo) (write-line (strcat " label = " (chr 34) title1 (chr 34) ";" ) fo) (write-line (strcat " edit_width = " (rtos width1 2 0) ";" ) fo) (write-line (strcat " edit_limit = " (rtos limit1 2 0) ";" ) fo) (write-line " is_enabled = true ;" fo) (write-line " }" fo) (write-line "spacer_1 ;" fo) (write-line ": edit_box {" fo) (write-line (strcat " key = " (chr 34) "key2" (chr 34) ";") fo) (write-line (strcat " label = " (chr 34) title2 (chr 34) ";" ) fo) (write-line (strcat " edit_width = " (rtos width2 2 0) ";" ) fo) (write-line (strcat " edit_limit = " (rtos limit2 2 0) ";" ) fo) (write-line " is_enabled = true ;" fo) (write-line " }" fo) (write-line "spacer_1 ;" fo) (write-line ": edit_box {" fo) (write-line (strcat " key = " (chr 34) "key3" (chr 34) ";") fo) (write-line (strcat " label = " (chr 34) title3 (chr 34) ";" ) fo) (write-line (strcat " edit_width = " (rtos width3 2 0) ";" ) fo) (write-line (strcat " edit_limit = " (rtos limit3 2 0) ";" ) fo) (write-line " is_enabled = true ;" fo) (write-line " }" fo) (write-line " }" fo) (write-line "spacer_1 ;" fo) (write-line "ok_only;}" fo) (close fo) ; code part (setq dcl_id (load_dialog fname)) (if (not (new_dialog "ddgetval3" dcl_id)) (exit)) (mode_tile "key1" 3) (action_tile "key1" "(setq val1 $value)") (mode_tile "key2" 3) (action_tile "key2" "(setq val2 $value)") (mode_tile "key3" 3) (action_tile "key3" "(setq val3 $value)") (start_dialog) (done_dialog) (unload_dialog dcl_id) ; returns the value of val1 val2 and val3 as strings (vl-file-delete fname) ) ; defungetval3 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.