Jump to content

Autolisp to highlight/select lines with decimal in length for quality control


agproj

Recommended Posts

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.

 

¯\_(ツ)_/¯

  • Funny 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

image.png.8f28e69461a41f03b9f93ee1f34fbbd5.png

 

like the thumbs up block.

Edited by mhupp
Link to comment
Share on other sites

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? 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

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.

 

OffExact1x.png.81b1a489b64cec8ae5d3db6f6333ca59.png

Edited by Manila Wolf
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...