Alcapone001 Posted September 12, 2017 Share Posted September 12, 2017 Hellos I have several lisps and I have made several worthy observations 1. There is a lisp that is extremely slow in civil 3d but fast in vanilla autocad 2. Another lisp wont run in Civil 3D but runs okay in vanilla autocad Anyone experience this..... And why Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 12, 2017 Share Posted September 12, 2017 Without more info, we are just guessing. What version of Civil 3D? Has the performance degradation fix been applied? Can you share the lisp file? Try logging on to the PC, as a new Windows user (one that has not logged onto this PC before), and repeat your test. This will ensure that the Windows user profile and/or the ACAD profile are not to blame. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 13, 2017 Share Posted September 13, 2017 I run all my lisps inside CIV3d no problems, is the code looking for a registered app. Quote Link to comment Share on other sites More sharing options...
tombu Posted September 13, 2017 Share Posted September 13, 2017 Civil 3D has twice the command names as vanilla AutoCAD there may be conflicts with lisp command names. Civil 3D also uses a lot more resources than AutoCAD so it could be your PC isn't worthy. The 2016 version had a few performance issues as I remember and from posts I've seen, but they shouldn't affect lisp. The new Civil 3D 2018 platform seems to run a lot smoother and has some nice features. Had an issue with osnaps in both 2017 and 2018, but that was fixed with a graphics card driver update. Really the only way to solve your lisp issue is to see the code. There are discontinued AutoCAD commands and situations that may need command-s instead of command where code needs to be updated. Quote Link to comment Share on other sites More sharing options...
Alcapone001 Posted September 23, 2017 Author Share Posted September 23, 2017 ; To create grid (defun c:GJ (/ p1 p2 l w nx ny p3 p4 i k) (command "._undo" "_BE") (setq obm (getvar "blipmode")) (setq osmd (getvar "osmode")) (setq andr(getvar"angdir")) (setvar "angdir"1) (setq andb(getvar"angbase")) (setvar "angbase"(/ pi 2)) (setq aunt(getvar"aunits")) (setvar "aunits"2) (setvar "dimaunit"2) (setvar"dimadec"4) (setq clyr(getvar"clayer")) (setq d (getdist "\n enter grid length: ")) (setvar"snapmode"1) (setvar"snapbase"(list 0 0)) (setvar"snapunit"(list d d)) (setvar"osmode"0) (setq p1 (getpoint "\n pick upper left corner")) (setvar"snapbase"(list(car p1)(cadr p1))) (setvar"snapunit"(list d d)) (setq p2 (getcorner p1"\n pick other corner")) (setq lyr(strcat"net"(rtos d 2 0)"0")) (setq l (abs(-(car p2)(car p1)))) (setq w (abs(-(cadr p1)(cadr p2)))) (setq nx (/ l d)) (setq ny (/ w d)) (setq nx1 (fix nx)) (setq ny1 (fix ny)) (setq p3 (list (car p1)(cadr p2))) (setq p4 (list(car p2)(cadr p1))) (setq p5 (list(+(car p1)(* nx1 d))(cadr p1))) (setq p6 (list(car p1)(-(cadr p1)(* ny1 d)))) (setq sfa (* 0.025 d)) (command "layer" "m" lyr "c" "54" "" "L" "continuous" "" "LW" 0.15 "" "") (command "layer" "m" "nettxt" "c" "white" "" "L" "continuous" "" "LW" 0.20 "" "") (setq i 0) (while(<= i nx1) (setvar "osmode"0) (command"layer" "s" lyr "") (command"color" "bylayer") (command "line" (list(+(car p1)(* i d))(cadr p1))(list(+(car p1)(* i d))(cadr p6)) "") (setq pnx (list(+(car p1)(* i d))(cadr p1))) (setq pnx1 (list(+(car pnx)(* 0.01 d))(-(cadr pnx)(* 0.01 d)))) (command"layer" "s" "nettxt" "") (command"color" "bylayer") (command "text" pnx1 sfa 200 (strcat"X="(rtos(car pnx)2 0))) (setq i (+ 1 i)) ) (setq k 0) (while(<= k ny1) (command"layer" "s" lyr "") (command "line" (list(car p1)(-(cadr p1)(* k d)))(list(car p5)(-(cadr p5)(* k d)))"") (setq pny (list(car p1)(-(cadr p1)(* k d)))) (setq pny1 (list(+(car pny)(* 0.01 d))(+(cadr pny)(* 0.01 d)))) (command"layer" "s" "nettxt" "") (command "text" pny1 sfa 100 (strcat"Y="(rtos(cadr pny)2 0))) (setq k (+ 1 k)) ) (command "._undo" "_END") (setvar"clayer"clyr) (setvar"angbase"andb) (setvar "angdir"andr) (setvar"aunits"aunt) (setvar"snapmode"0) (setvar "osmode"osmd) ) I am running on Dell Precision Tower with Intel Xeon and 8Gb of Ram using this code to generate 100 square grids on a big area for example 17.5 by 15.2; Autocad vanilla 2015; 10.4 seconds Civil 3D 2015; 20.4 Civil 3D 2016; 19.5 Civil 3D 2017; 26.0 Why is it that fast in vanilla, and how to improve on it... Quote Link to comment Share on other sites More sharing options...
Alcapone001 Posted September 23, 2017 Author Share Posted September 23, 2017 Hello which are these discontinued autocad commands and what are the alternatives Quote Link to comment Share on other sites More sharing options...
Alcapone001 Posted September 23, 2017 Author Share Posted September 23, 2017 This is observed over several other i7/ Xeon machines all running the latest windows 10, not just mine... Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 24, 2017 Share Posted September 24, 2017 Ok wont run is possibly tied to the fact that you need to set your text style unfortunately with text you can use a style that has height set or not so you need to check for this 1st time ran and got lots of X=150 errors as it tried to put this as text height, for this reason I restrict our guys to Text style Standard must not be altered. A simple check in code. The grid appeared. Also command echo off maybe. (setvar "cmdecho" 0) may shave a few seconds. Its just me but I leave a gap between words where as your code has no spacing and lisp may read this as a defun etc. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 24, 2017 Share Posted September 24, 2017 ; To create grid (defun c:GJ (/ p1 p2 l w nx ny p3 p4 i k) < ... > ) I am running on Dell Precision Tower with Intel Xeon and 8Gb of Ram using this code to generate 100 square grids on a big area for example 17.5 by 15.2; Autocad vanilla 2015; 10.4 seconds Civil 3D 2015; 20.4 Civil 3D 2016; 19.5 Civil 3D 2017; 26.0 Why is it that fast in vanilla, and how to improve on it... Is this quicker for you? ([color=BLUE]defun[/color] c:gj ( [color=BLUE]/[/color] *error* ent len lla lpr lst ocs pt1 pt2 tla tmp tpr tvc uxa val var xco yco ) ([color=BLUE]defun[/color] *error* ( msg ) ([color=BLUE]mapcar[/color] '[color=BLUE]setvar[/color] var val) ([color=BLUE]if[/color] ([color=BLUE]and[/color] msg ([color=BLUE]not[/color] ([color=BLUE]wcmatch[/color] ([color=BLUE]strcase[/color] msg [color=BLUE]t[/color]) [color=MAROON]"*break,*cancel*,*exit*"[/color]))) ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\nError: "[/color] msg)) ) ([color=BLUE]princ[/color]) ) ([color=BLUE]setq[/color] var '(snapmode snapbase snapunit osmode) val ([color=BLUE]mapcar[/color] '[color=BLUE]getvar[/color] var) ) ([color=BLUE]cond[/color] ( ([color=BLUE]not[/color] ([color=BLUE]setq[/color] len ([color=BLUE]getdist[/color] [color=MAROON]"\nSpecify grid length: "[/color])))) ( ([color=BLUE]progn[/color] ([color=BLUE]setvar[/color] 'snapbase '(0.0 0.0)) ([color=BLUE]setvar[/color] 'snapunit ([color=BLUE]list[/color] len len)) ([color=BLUE]setvar[/color] 'snapmode 1) ([color=BLUE]setvar[/color] 'osmode ([color=BLUE]logand[/color] ([color=BLUE]getvar[/color] 'osmode) ([color=BLUE]~[/color] 16384))) ([color=BLUE]and[/color] ([color=BLUE]setq[/color] pt1 ([color=BLUE]getpoint[/color] [color=MAROON]"\nPick upper-left corner: "[/color])) ([color=BLUE]setvar[/color] 'snapbase ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] pt1 '(0 0))) ([color=BLUE]setq[/color] pt2 (([color=BLUE]if[/color] ([color=BLUE]zerop[/color] ([color=BLUE]getvar[/color] 'worlducs)) [color=BLUE]getpoint[/color] [color=BLUE]getcorner[/color]) pt1 [color=MAROON]"\nPick opposite corner: "[/color])) ) ) ([color=BLUE]setq[/color] lla ([color=BLUE]strcat[/color] [color=MAROON]"net"[/color] ([color=BLUE]rtos[/color] len 2 0) [color=MAROON]"0"[/color]) tla [color=MAROON]"nettxt"[/color] ) ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( lst ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] ent ([color=BLUE]tblobjname[/color] [color=MAROON]"layer"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 2 lst)))) ([color=BLUE]entmod[/color] ([color=BLUE]cons[/color] ([color=BLUE]cons[/color] -1 ent) lst)) ([color=BLUE]entmake[/color] lst) ) ) ([color=BLUE]list[/color] ([color=BLUE]list[/color] '(000 . [color=MAROON]"LAYER"[/color]) '(100 . [color=MAROON]"AcDbSymbolTableRecord"[/color]) '(100 . [color=MAROON]"AcDbLayerTableRecord"[/color]) '(070 . 0) ([color=BLUE]cons[/color] 2 lla) '(006 . [color=MAROON]"Continuous"[/color]) '(062 . 054) '(370 . 015) ) ([color=BLUE]list[/color] '(000 . [color=MAROON]"LAYER"[/color]) '(100 . [color=MAROON]"AcDbSymbolTableRecord"[/color]) '(100 . [color=MAROON]"AcDbLayerTableRecord"[/color]) '(070 . 0) ([color=BLUE]cons[/color] 2 tla) '(006 . [color=MAROON]"Continuous"[/color]) '(062 . 007) '(370 . 020) ) ) ) ([color=BLUE]setq[/color] tmp ([color=BLUE]mapcar[/color] '[color=BLUE]min[/color] pt1 pt2) pt2 ([color=BLUE]mapcar[/color] '[color=BLUE]max[/color] pt1 pt2) pt1 ([color=BLUE]list[/color] ([color=BLUE]car[/color] tmp) ([color=BLUE]cadr[/color] pt2)) pt2 ([color=BLUE]list[/color] ([color=BLUE]car[/color] pt2) ([color=BLUE]cadr[/color] tmp)) ocs ([color=BLUE]trans[/color] '(0 0 1) 1 0 [color=BLUE]t[/color]) uxa ([color=BLUE]angle[/color] '(0 0) ([color=BLUE]trans[/color] ([color=BLUE]getvar[/color] 'ucsxdir) 0 ocs [color=BLUE]t[/color])) xco ([color=BLUE]car[/color] pt1) tvc ([color=BLUE]list[/color] ([color=BLUE]*[/color] 0.01 len) ([color=BLUE]*[/color] -0.01 len)) lpr ([color=BLUE]list[/color] '(062 . 256) ([color=BLUE]cons[/color] 8 lla)) tpr ([color=BLUE]list[/color] '(062 . 256) ([color=BLUE]cons[/color] 8 tla) ([color=BLUE]cons[/color] 40 ([color=BLUE]*[/color] 0.025 len)) ([color=BLUE]cons[/color] 50 ([color=BLUE]+[/color] uxa ([color=BLUE]*[/color] 1.5 [color=BLUE]pi[/color]))) ([color=BLUE]cons[/color] 210 ocs)) ) ([color=BLUE]repeat[/color] ([color=BLUE]fix[/color] ([color=BLUE]+[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] ([color=BLUE]car[/color] pt2) ([color=BLUE]car[/color] pt1)) len) 1 1e-) ([color=BLUE]entmake[/color] ([color=BLUE]vl-list*[/color] '(000 . [color=MAROON]"LINE"[/color]) ([color=BLUE]cons[/color] 010 ([color=BLUE]trans[/color] ([color=BLUE]cons[/color] xco ([color=BLUE]cdr[/color] pt1)) 1 0)) ([color=BLUE]cons[/color] 011 ([color=BLUE]trans[/color] ([color=BLUE]cons[/color] xco ([color=BLUE]cdr[/color] pt2)) 1 0)) lpr ) ) ([color=BLUE]entmake[/color] ([color=BLUE]vl-list*[/color] '(000 . [color=MAROON]"TEXT"[/color]) ([color=BLUE]cons[/color] 010 ([color=BLUE]trans[/color] ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] ([color=BLUE]cons[/color] xco ([color=BLUE]cdr[/color] pt1)) tvc) 1 ocs)) ([color=BLUE]cons[/color] 001 ([color=BLUE]strcat[/color] [color=MAROON]"X="[/color] ([color=BLUE]rtos[/color] xco 2 0))) tpr ) ) ([color=BLUE]setq[/color] xco ([color=BLUE]+[/color] xco len)) ) ([color=BLUE]setq[/color] yco ([color=BLUE]cadr[/color] pt1) tvc ([color=BLUE]list[/color] ([color=BLUE]*[/color] 0.01 len) ([color=BLUE]*[/color] 0.01 len)) tpr ([color=BLUE]subst[/color] ([color=BLUE]cons[/color] 050 uxa) ([color=BLUE]assoc[/color] 050 tpr) tpr) ) ([color=BLUE]repeat[/color] ([color=BLUE]fix[/color] ([color=BLUE]+[/color] ([color=BLUE]/[/color] ([color=BLUE]-[/color] ([color=BLUE]cadr[/color] pt1) ([color=BLUE]cadr[/color] pt2)) len) 1 1e-) ([color=BLUE]entmake[/color] ([color=BLUE]vl-list*[/color] '(000 . [color=MAROON]"LINE"[/color]) ([color=BLUE]cons[/color] 010 ([color=BLUE]trans[/color] ([color=BLUE]list[/color] ([color=BLUE]car[/color] pt1) yco) 1 0)) ([color=BLUE]cons[/color] 011 ([color=BLUE]trans[/color] ([color=BLUE]list[/color] ([color=BLUE]car[/color] pt2) yco) 1 0)) lpr ) ) ([color=BLUE]entmake[/color] ([color=BLUE]vl-list*[/color] '(000 . [color=MAROON]"TEXT"[/color]) ([color=BLUE]cons[/color] 010 ([color=BLUE]trans[/color] ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] ([color=BLUE]list[/color] ([color=BLUE]car[/color] pt1) yco) tvc) 1 ocs)) ([color=BLUE]cons[/color] 001 ([color=BLUE]strcat[/color] [color=MAROON]"Y="[/color] ([color=BLUE]rtos[/color] yco 2 0))) tpr ) ) ([color=BLUE]setq[/color] yco ([color=BLUE]-[/color] yco len)) ) ) ) (*error* [color=BLUE]nil[/color]) ([color=BLUE]princ[/color]) ) Quote Link to comment Share on other sites More sharing options...
Alcapone001 Posted September 25, 2017 Author Share Posted September 25, 2017 Wow. Gracias Order a drink for yourself n pay on the way out....... Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 25, 2017 Share Posted September 25, 2017 Wow. Gracias Order a drink for yourself n pay on the way out....... You're welcome! Quote Link to comment Share on other sites More sharing options...
tombu Posted September 25, 2017 Share Posted September 25, 2017 You're welcome! Extra points for providing free code on a Sunday! Saw you set the localized variable *error* to nil at the end. Hadn't seen that before, do you recommend this or was this just from quick coding on a day off? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 25, 2017 Share Posted September 25, 2017 Extra points for providing free code on a Sunday! Cheers! Saw you set the localized variable *error* to nil at the end. Not quite - look closer. Quote Link to comment Share on other sites More sharing options...
tombu Posted September 25, 2017 Share Posted September 25, 2017 I see, msg options built into *error* function. Have to try that. Quote Link to comment Share on other sites More sharing options...
Grrr Posted September 25, 2017 Share Posted September 25, 2017 tombu, That *error* approach Lee used, guarantees that once you run the code - it will exit with running the *error* function in the end - no matter what. Thats normally used to restore system variables (like Lee's code here) or to delete a temporary created files (Lee uses it when the code runs a DCL file created on-the-fly, where you can see that he: [unloads the dialog/closes the file descriptor/erases the file] - everything is handled inside the *error* function. So if the code errors out: *error* function will be called if the code doesn't error out: manually call *error* funciton by providing some 'msg' argument - (*error* nil) / (*error* "I just wanted to call the error-handler funciton"). Makes me think that one could localise his code variables there like this: (defun C:test ( / *error* ) (defun *error* ( m ) (mapcar '(lambda (x) (set x nil)) '(hi this is a test)) (and m (princ m)) (princ) ); defun *error* (setq ; bound some variables to a symbols hi "a" this "b" is "c" a "d" test "e" ); setq (alert (apply 'strcat '(hi this is a test))) ; <- this will trigger an error ; (alert (apply 'strcat (list hi this is a test))) ; this won't trigger error (*error* "\nI just called the error-handler function") (princ) ); defun There are also vl-exit-with-error and vl-exit-with-value functions, but I was disappointed that they don't behave as I expected. Heres a brief explanation from Lee. Quote Link to comment Share on other sites More sharing options...
tombu Posted September 25, 2017 Share Posted September 25, 2017 tombu,That *error* approach Lee used, guarantees that once you run the code - it will exit with running the *error* function in the end - no matter what. Thats normally used to restore system variables (like Lee's code here) Makes sense now, I've been using duplicate code to restore system variables in *error* and at the end of the function. Quote Link to comment Share on other sites More sharing options...
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.