BIGAL Posted November 5, 2021 Posted November 5, 2021 Mhupp why not just take the number multiply by 10 100 1000 etc does it have fraction yes or no, dont need convert to string. 1 Quote
mhupp Posted November 5, 2021 Posted November 5, 2021 11 hours ago, BIGAL said: Mhupp why not just take the number multiply by 10 100 1000 etc does it have fraction yes or no, dont need convert to string. ¯\_(ツ)_/¯ 1 Quote
Manila Wolf Posted November 6, 2021 Posted November 6, 2021 23 hours ago, mhupp said: Added another sub function to @ronjonp lisp count the decimal places of the length. mhupp, thank you for your reply. I did run a quick check of the revised code and found that it worked in some instances but not all. To illustrate I attach my check drawing, in which I tested some random lengths. Could it be something to do with the grouped zero's immediately after the decimal point? Anyway, I am certainly no expert and I thank you again for your keen interest. CheckLength.dwg Quote
mhupp Posted November 6, 2021 Posted November 6, 2021 (edited) 15 hours ago, Manila Wolf said: Could it be something to do with the grouped zero's immediately after the decimal point? the function counts anything after the decimal point. AutoCAD must be rounding or something. Works for me in BricsCAD. Even had my LUPREC set to 2. like the thumbs up block. Edited November 6, 2021 by mhupp Quote
ronjonp Posted November 7, 2021 Posted November 7, 2021 On 10/27/2021 at 8:44 AM, ronjonp said: It probably is, but it's not as robust as the curve function since it can handle many more object types [SPLINE, ELLIPSE, ETC...] Here are the benchmarks: (setq o (vlax-ename->vla-object (setq e (car (entsel))))) (defun _getlength (e / ep) (if (vl-catch-all-error-p (setq ep (vl-catch-all-apply 'vlax-curve-getendparam (list e)))) 0. (vlax-curve-getdistatparam e ep) ) ) (benchmark '((vla-get-length o) (vlax-get o 'length) (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) (_getlength e) ) ) ;;;_GETLENGTH Benchmarking ..................Elapsed milliseconds / relative speed for 32768 iteration(s): ;;; ;;; (vlax-curve-getDistAtParam E (vlax-c...).....1547 / 1.34 <fastest> ;;; (_GETLENGTH E)...............................1547 / 1.34 ;;; (vlax-get O (QUOTE LENGTH))..................1985 / 1.05 ;;; (vla-get-Length O)...........................2078 / 1.00 <slowest> ;;; ;;;---- Benchmark Utility: In memory of Michael Puckett ---- @BIGAL / seahaven / ? / did you get any value out of this post? Quote
BIGAL Posted November 7, 2021 Posted November 7, 2021 Hi Ronjonp I look further into VL type commands where speed is issue, 1 task I had dealing with 4500 objects took 6 minutes, went back had another go looking at using VL commands a couple of different ones went to 1 minute, current version is 6 seconds. Making objects entmake is generally best. I should use Vlax-curve more often just need to get into habit of using it and others for speed. Quote
Manila Wolf Posted November 7, 2021 Posted November 7, 2021 (edited) 17 hours ago, mhupp said: the function counts anything after the decimal point. AutoCAD must be rounding or something. Works for me in BricsCAD. Even had my LUPREC set to 2. I tried using both AutoCAD 2016 and AutoCAD 2013 with all differing LUPREC settings. I could not get it to work for all instances. I guess like you say there maybe some AutoCAD variable setting that is causing the problem. I will try and hunt it down. Thank you for all your help anyway. Edited November 7, 2021 by Manila Wolf 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.