How to get exact length of line in LISP?

How to get exact length of line in LISP?

matthew_neesley
Collaborator Collaborator
1,930 Views
2 Replies
Message 1 of 3

How to get exact length of line in LISP?

matthew_neesley
Collaborator
Collaborator

Hello to all:

 

I'm trying to filter line lengths and selections using LISP...I can't remember how to filter for the exact length of a line.

My code snippet:

 

((and (eq (vla-get-objectname b) "AcDbline")
(horiz-p b)
(equal (vla-get-length b) 6)
)
;; if the object is horizontal LINE and it is 6 inches long then do this
(addprop b "HILMOT-CONV-BLK-6 INCH HORIZONTAL LINES")
)

 

How is that line in red supposed to be formatted?  Thanks in advance!

0 Likes
Accepted solutions (1)
1,931 Views
2 Replies
Replies (2)
Message 2 of 3

dlanorh
Advisor
Advisor
Accepted solution

@matthew_neesley wrote:

Hello to all:

 

I'm trying to filter line lengths and selections using LISP...I can't remember how to filter for the exact length of a line.

My code snippet:

 

((and (eq (vla-get-objectname b) "AcDbline")
(horiz-p b)
(equal (vla-get-length b) 6)
)
;; if the object is horizontal LINE and it is 6 inches long then do this
(addprop b "HILMOT-CONV-BLK-6 INCH HORIZONTAL LINES")
)

 

How is that line in red supposed to be formatted?  Thanks in advance!


 

(equal (vla-get-length b) 6.0 1.0e-4);to the nearest 10,000th of an inch

(= (vla-get-length b) 6.0); exactly = to 6.0 to 20 decimal places

 

 

I am not one of the robots you're looking for

Message 3 of 3

Kent1Cooper
Consultant
Consultant

@dlanorh wrote:

 

....
(equal (vla-get-length b) 6.0 1.0e-4);to the nearest 10,000th of an inch

(= (vla-get-length b) 6.0); exactly = to 6.0 to 20 decimal places

A picky point or two....

 

You don't need any of those decimal places.  These will do:

  (equal (vla-get-length b) 6 1e-4)

  (= (vla-get-length b) 6)

 

And it's not to 20 decimal places, but to 16 significant figures.  That's all AutoCAD can keep track of.  Ask for 20 decimal places of pi, and you get only 15 [the 3 at the beginning being the 16th sig-fig]:

 

Command: (rtos pi 2 20)
"3.141592653589793"

 

And if the part before the decimal uses up more of the sig-figs, you get fewer decimal places:

Command: (rtos (* pi 100000) 2 20)
"314159.2653589793"

Kent Cooper, AIA
0 Likes