Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/27/2020 in all areas

  1. Sorry for the delay .. got a bit busy and needed to rewrite most of that other code ... please double check the numbers! (defun c:ild (/ a flg p s) ;; RJP » 2020-08-17 (or *emspc* (setq *emspc* 18.)) (or *rowspc* (setq *rowspc* 12.)) (or *eflow* (setq *eflow* 0.77)) (setq *emspc* (cond ((getint (strcat "\nEnter emitter spacing in tubing (inches):<" (rtos *emspc* 2 1) ">") ) ) (*emspc*) ) ) (setq *rowspc* (cond ((getint (strcat "\nEnter spacing between rows (inches):<" (rtos *rowspc* 2 1) ">")) ) (*rowspc*) ) ) (setq *eflow* (cond ((getint (strcat "\nEnter emitter flow (gph):<" (rtos *eflow* 2 2) ">"))) (*eflow*) ) ) (setq flg (> (getvar 'lunits) 2)) (if (setq s (ssget '((0 . "*POLYLINE,CIRCLE,REGION,ELLIPSE,SPLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (redraw e 3) (setq a (vlax-curve-getarea e)) ;; This portion could be updated to insert the text in the center of the bounding box if you'd like ( no picking required ) (if (setq p (getpoint "\nPick a point to place text: ")) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "InlineDripNumbers") '(100 . "AcDbMText") (cons 10 p) ;; Adjust text height here (cons 40 (getvar 'textsize)) '(71 . 5) (cons 1 (strcat "AREA (SQ FT): " (rtos a (getvar 'lunits) 2) "\\PFLOW (GPM): " (rtos (* (/ (* a (if flg 1. 144. ) ) (* *emspc* *rowspc*) ) (/ *eflow* 60.) ) 2 2 ) ) ) '(11 1. 0. 0.) '(43 . 0.125) '(50 . 0.) ) ) ) (redraw e 4) ) ) (princ) ) (vl-load-com)
    1 point
  2. in my batch appie I can select single or multiple thread core console. When you use core console in a loop , each loop starts its own core console. This works as long as the timing is right because if your start a new thread before the previous is finished your system can run out of resources. So I have an option to include a delay or the option to create one big fat bat file. This means AutoCad is free as soon as the bat file is generated and started. Code below can't be run on its own but should show you how it works (i hope) ; method 1 : use in loop ; is a little bit messier, more parallel processes, more demanding on system but is faster ; did a saveas on 185 dawings : 5 minutes so thats less then 2 sec's a drawing ; increase wait to make sure each process has enough time to finish if system runs out of recources (defun Rlx_AcadCore_Multi_Thread ( / dwg) (if (and scr (vl-consp dwg-list)) (foreach dwg dwg-list (command "start" (strcat "accoreconsole.exe /i " "\"" dwg "\"" " /s " "\"" scr "\"" " /l en-us")) ; with large drawing list pc became unresponsive when wait was zero so delay must be 1 (sec) or higher (if (or (not #RlxBatch-CoreConsole-Delay)(not (distof #RlxBatch-CoreConsole-Delay)) (< (distof #RlxBatch-CoreConsole-Delay) 1)) (setq #RlxBatch-CoreConsole-Delay "1")) (wait (distof #RlxBatch-CoreConsole-Delay)) ) ) ) ; method 2 : use batch file ; same drawing set took 12 minutes , disable timeout could reduce this time by 185 seconds (3 minutes) ; advantage is that its less demanding of recources so it probably runs better as backgroud task. (defun Rlx_AcadCore_Single_Thread ( / bat dwg) (if (and scr (vl-consp dwg-list) (setq fp (open (setq bat "c:\\temp\\tmp.bat") "w"))) (progn (foreach dwg dwg-list (write-line (strcat "accoreconsole.exe /i " "\"" dwg "\"" " /s " "\"" scr "\"" " /l en-us") fp) (write-line "timeout /t 1 /nobreak" fp); skip or adjust to match system speed ) (if fp (progn (write-line "exit" fp)(close fp)(gc) (command "start" bat))) ) ) ) (defun wait (sec / stop) (setq stop (+ (getvar "DATE") (/ sec 86400.0))) (while (> stop (getvar "DATE")))) the multiple thread is most fun to use and can be fastest but single thread (bat) is best to be able to free up AutoCad. But (surprise) IT has blocked the use of all bat files ...
    1 point
  3. Here you go ... but whats more important is to read thru the discussion. so try and sign-up http://www.cadtutor.net/forum/showpost.php?p=258390&postcount=20 one more related article (great for reading) EntMaker_CAB_03-_MakeEntmake.lsp
    1 point
  4. http://www.cadapult-software.com/article_info.php/articles_id/28
    1 point
×
×
  • Create New...