Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/09/2019 in all areas

  1. Its in the download section as well as a radio buttons and toggle buttons. Working on a "image multi getvals" as well as a Vector version as image is a slide which quality and image creation can be a problem. There are example calling code in the lisp. Basically the screen size is the limitation I add a double space when only a few lines. Multi GETVALS Img.lsp
    2 points
  2. Can do this add more items, Dlanorh then use your list of power items to work out load. (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq ans (AH:getvalsm (list "Enter Qty" "Lamp " 5 4 "0" "Heater" 5 4 "0" "Socket"5 4 "0" "TV" 5 4 "0" "Oven"5 4 "0" "Aircon" 5 4 "0" ))) (setq pload 0.0) (setq pload (+ (* (atof (nth 0 ans)) 8.3) pload)) (setq pload (+ (* (atof (nth 1 ans)) 5.11) pload)) (setq pload (+ (* (atof (nth 2 ans)) 3.2) pload)) (setq pload (+ (* (atof (nth 3 ans)) 8.0) pload)) (setq pload (+ (* (atof (nth 4 ans)) 8.0) pload)) (alert (strcat "Power load is " (rtos pload 2 1)))
    1 point
  3. As a start try this. It will accept LWPolylines 2dPolylines and Lines. The lisp checks the "insunits" system variable and converts polyline lengths to metres. You are then asked to supply the number of items for each of "HEATER" "LAMP" "MOTOR" "SOCKET" & "TV" to calculate the total load. The default for each is 0 (zero) so a return will automatically default to this. If no polyline/Line is selected the lisp ends. (defun c:vdrop ( / *error* sv_lst sv_vals a_lst RL I iu cu sv itxt load ipart sel obj p_len ld vd len) (defun *error* ( msg ) (mapcar 'setvar sv_lst sv_vals) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : ( " msg " ) occurred."))) (princ) );end_*error*_defun (setq sv_lst (list 'osmode 'cmdecho 'dimzin) sv_vals (mapcar 'getvar sv_lst) a_lst '(("HEATER" . 8.3) ("LAMP" . 4.5) ("MOTOR" . 10.06) ("SOCKET" . 5.11) ("TV" . 3.2)) sv 24.0 RL 0.015 I 0.0 iu (getvar 'insunits) );end_setq (mapcar 'setvar sv_lst (list 0 0 8)) (cond ( (= iu 4) (setq cu 1000.0)) ( (= iu 5) (setq cu 100.0)) ( (= iu 6) (setq cu 1.0)) );end_cond (foreach itm a_lst (initget 4) (setq itxt (car itm) load (cdr itm) ipart (cond ( (getint (strcat "\nEnter Number of " itxt " <0> : "))) (0)) );end_setq (if (> ipart 0.0) (setq I (+ I (* ipart load)))) );end_foreach (while (setq sel (entsel "\nSelect Polyline : ")) (setq obj (vlax-ename->vla-object (car sel))) (if (vl-position (vlax-get obj 'objectname) (list "AcDbPolyline" "AcDb2dPolyline" "AcDbLine")) (setq p_len (vlax-get obj 'length)) (alert "NOT a Polyline/Line") );end_if );end_while (cond (p_len (setq ld (- sv (setq vd (* RL I (setq len (/ p_len cu)))))) (alert (strcat "Constant Voltage : " (rtos sv 2 0) "\n\n" "Polyline Length (m) : " (rtos len 2 3) "\n\n" "Total Voltage Drop : " (rtos vd 2 6) "\n\n" "Voltage @ Last Device : " (rtos ld 2 6) );end_strcat );end_alert ) );end_cond (mapcar 'setvar sv_lst sv_vals) (princ) );end_defun
    1 point
  4. You can obtain the coordinates of the center of the drawing window using the VIEWCTR system variable; using these coordinates, you can then obtain the block reference with insertion point coordinates such that (distance <insertion-point> <viewctr>) is minimised.
    1 point
×
×
  • Create New...