Leaderboard
Popular Content
Showing content with the highest reputation on 02/12/2026 in all areas
-
3 points
-
We talk a lot about speed but does it matter, if it take seconds or a minute, a task I worked on could take up to 3 hours manually it takes 2 minutes now. I improved the speed 3 times by recoding. Yes if have thousands of lines go get a coffee. still faster than having a go manually. I guess what I am saying are we talking seconds, minutes or hours ? 13 seconds for 5000, I would call that fantastic. If worried about time add a progress bar it's a Acet function. The task above started at like 25 minutes to do, so 2 minutes as final version is considered acceptable by me. Yes talking thousands of changes.2 points
-
2 points
-
A small modification of the DZ code for convenience. The Break lines can be lengthen by the specified distance (Fixed) or proportionally (by 1/3) or None. [Fixed/Proportional/None] ;;; Lisp to draw Single or Double "Z" Break Lines ;;; © A.Henderson 2002 ;;; Modified By Charles Alan Butler 10/06/2004 ;;; To allow any angle and to trim lines that ;;; do not run through both break symbols ;;; Modified 12/02/26 ;;; The Break lines can be lengthen by the specified distance (Fixed) ;;; or proportionally (by 1/3) or None (defun c:dz-mod (/ oldlay oldotho oldosmode ztype dist ang extOpt extLen dist0 segLen e1 e2 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10) ;; return vertex list by MP (defun cdrs (key lst / pair rtn) (while (setq pair (assoc key lst)) (setq rtn (cons (cdr pair) rtn) lst (cdr (member pair lst)) ) ) (reverse rtn) ) ; defun ;; set osnaps ON/OFF (defun setosnaps (value) ; value = "ON" or default to "OFF" (if value (setq value (strcase value)) ) (cond ((or (and (= value "ON") (>= (getvar "osmode") 16383)) (and (/= value "ON") (<= (getvar "osmode") 16383)) ) (setvar "osmode" (boole 6 (getvar "osmode") 16384)) ) ) ); defun ;; Start of routine ================================== ;; Save settings (setq oldlay (getvar "clayer") oldortho (getvar "orthomode") oldosmode (getvar "osmode") ) ;_ end of setq ;; I use current layer - CAB ;;(command "_.layer" "_make" "Z-Line" "_Colour" "41" "" "") (initget "S D") ;(setq ztype (getkword "\n Single or Double -^v-^v- ? (S or D) <S>")) (setq ztype (getkword "\n Single or Double -^v-^v- ? [S/D] <S>")) (setosnaps "ON") ; force on ;;=========================================== (if (and (setq p1 (getpoint "Starting point of break line : ")) (setq p6 (getpoint p1 "End point of break line : ")) ) (progn;=========================================== ;;; --- EXT --- calculate the base length/angle based on the selected points (setq dist0 (distance p1 p6)) ;;; --- EXT --- elongation mode (Fixed = 50 by default) (initget "F P N") (setq extOpt (getkword "\nExtend beyond picked points? [Fixed/Proportional/None] <Fixed>: ")) (cond ((or (not extOpt) (= extOpt "F")) (setq extLen (getdist "\nExtension length <50>: ")) (if (null extLen) (setq extLen 50.0)) ) ((= extOpt "P") ;; 1/3 of the straight section (straight section = 0.4167*dist for S, and 0.4167*(dist/2) for D) (setq segLen (* 0.4167 (if (= ztype "D") (/ dist0 2.0) dist0))) (setq extLen (/ segLen 3.0)) ) (T (setq extLen 0.0)) ) (setvar "plinewid" 0) (command "._undo" "_begin") (cond ((/= ztype "D") ; default to single (setq dist (distance p1 p6) ang (angle p1 p6) p2 (polar p1 ang (* 0.4167 dist)) p5 (polar p1 ang (* 0.5833 dist)) p3 (polar p2 (+ 1.25664 ang) (* 0.1667 dist)) p4 (polar p5 (+ 4.39824 ang) (* 0.1667 dist)) ) ;_ end of setq ;;; --- EXT --- we only lengthen the ends (the symbol remains at the base points) (setq p1 (polar p1 (+ ang pi) extLen) p6 (polar p6 ang extLen) ) (setosnaps "OFF") ; force off (command "_.pline" p1 p2 p3 p4 p5 p6 "") ; Draw the Z-Line ) ;_ end cond "S" ;;=========================================== ((= ztype "D") (setq p10 p6 dist (/ (distance p1 p6) 2.0) ang (angle p1 p6) p2 (polar p1 ang (* 0.4167 dist)) p5 (polar p1 ang (* 0.5833 dist)) p3 (polar p2 (+ 1.25664 ang) (* 0.1667 dist)) p4 (polar p5 (+ 4.39824 ang) (* 0.1667 dist)) p6 (polar p5 ang (* 0.8334 dist)) p9 (polar p6 ang (* 0.1661 dist)) p7 (polar p6 (+ 1.25664 ang) (* 0.1667 dist)) p8 (polar p9 (+ 4.39824 ang) (* 0.1667 dist)) ) ;_ end of setq ;;; --- EXT --- we extend the start and the very end (p10), we do not touch the inside (setq p1 (polar p1 (+ ang pi) extLen) p10 (polar p10 ang extLen) ) (setosnaps "OFF") ; force off (command "_.pline" p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 "") ; Draw the Z-Line ) ;_ end cond ) ; end cond stmt ;; Position the second break line (setq e1 (entlast)) (command "_.pedit" e1 "_L" "_ON" "") (command "_.copy" e1 "" (getvar "lastpoint") pause) (setq e2 (entlast)) (setq plast (getvar "lastpoint")) ;; trim function (initget "Y N") (setq ans (getkword " Do you wish to trim the lines now ? [Y/N] <Y>")) (if (or (= ans "Y") (not ans)) (progn (setq lst '() dist (/ dist 140.0) ; trim distance ) ;; create trim lines (command "._offset" dist e1 plast "") (setq evl1 (cdrs 10 (entget (entlast)))) ; ent vertex list (entdel (entlast)) (command "._offset" dist e2 p1 "") (setq evl2 (cdrs 10 (entget (entlast)))) (entdel (entlast)) (setq lst (append evl1 (reverse evl2))) (setosnaps "OFF") ; force off (command "_.trim" e1 e2 "" "_F") (apply 'command lst) (command "" "") (command "_.trim" e1 e2 "" "_F") (apply 'command lst) (command "" "") ) ; progn ) ;_ endif (command "._undo" "_end") ) ; progn ) ; endif ;;================ ;; Exit sequence ;;================\ ;; Restore settings ;; I use current layer - CAB ;;(command "_.layer" "set" oldlay "") (setvar "orthomode" oldortho) (setvar "osmode" oldosmode) (princ) ) ;_ end of defun (prompt "\nDouble Break Symbol Creator loaded. Type DZ to run it." ) (princ) (setfunhelp "c:dz" "acadtools.chm" "dz")1 point
-
Hi @BIGAL I have tried the getpropertyvalue and it works in LT! Which is good news as that means the lisp can be reduced. @Saxlle that could be a solution, but the whole point is to automate it as much as possible. I had a think about it before and the most effective way for out team is to just type print me and then the drawing name gets generated and saved on the clipboard and then when they setup the plot settings they can paste the name in the dialogbox. So pausing to copy the name, will add extra steps which I am trying to reduce. @Steven P that would be the final step making sure that it is completely automated. But fearing some might not be comfortable with it yet, I just want to slowly introduce these little automations. With your suggestion, how does it work in terms of where to save the pdf file?1 point
-
@bigal, Reminds me of the days of HP9830, used to work on preliminay studies in the James Bay area. I would start calculating a long polygon in geodetic coordinates then go in the tent where we had a pool table and shoot two racks. Go back to the office tent still had to wait some. The hp9830 had but 8k core memory and a cassette tape. So the need for speed depends on the situation. For the basic A* it's all about it and the hack proposed by @GLAVCVS is totally worth it. The polygon making not so much, but I tend to be biased in favor of vanilla autolisp.1 point
-
Like @Steven P my Autoload.lsp has around 35 defuns in it plus some setvar's and uses the Appload add to Startup suite, Acad or Bricscad works.1 point
-
Generally if I am plotting it is much quicker to get a LISP to do all the 'hard' work going through the dialogue box - more so with PDFs where it wants you to select folders to plot to. If these are all standard 90% of the time like BigAl says, go straight to plot. Might be that the most efficient way would be 4 functions to plot to PDF: 'PlotPdf' 'PlotPdfTr' - Transparency 'PlotPdfLW' - Lineweight 'PlotPdfTrLw' - Transparency and lineweight, (or 5th one PlotPDFLwTr to cover it going the options entered in reverse) All call the same basic function passing the required data for example: (defun c:plotpdf ( / )(plotPDF (list 0 0))) ;; List: TR, LW (defun c:plotpdfTr ( / )(plotPDF (list 1 0))) ;; List: TR, LW (defun c:plotpdfLw ( / )(plotPDF (list 0 1))) ;; List: TR, LW (defun c:plotpdfTrLW ( / )(plotPDF (list 1 1))) ;; List: TR, LW (defun c:plotpdfLWTr ( / )(plotPDF (list 1 1))) ;; List: TR, LW (defun PlotPDF ( MyControls / .....) .... ... (if (= (nth 0 MyControls) 1) (setq DoTransparency "Yes")) ... (if (= (nth 1 MyControls) 1) (setq DoLineWeight "Yes")) .... ) I use a similar thing: PlotA0, PlotA1.... for different papersizes, plotpdfmsc (plot PDF Mono Save Close) as examples, easy to remember (can do the 'code' part of the functions backwards too, eg, PLotPDFCS - Close Shave) I tend to pass the controls as a list so that if you want to add more functions later you only need to change the main function and anything new afterwards, for example c:plotpdfPr where Pr might be 'show preview' and that list might be (plotPDF (list 0 0 1)) noting that shorter lists will just return a 'nil' in the if statements / conds so have no effect1 point
-
Why not just use princ to write the text in command line, then select it, ctrl+c and ctrl+v? For e.g. (setq a "213" b "abs" c "ddd") (princ (strcat a " " b " " c)) (princ) ------------------------------- result: 213 abs ddd (select then in command line and paste it)1 point
-
"OEM environment." If you are using a OEM version then a possible way to run other lisp programs is to go back to the developer who could add your lisps to their package then they should work.1 point
