Author Topic: AutoCAD Line length ssget issue.  (Read 665 times)

0 Members and 1 Guest are viewing this topic.

diarmuid

  • Bull Frog
  • Posts: 417
AutoCAD Line length ssget issue.
« on: June 07, 2023, 04:41:48 AM »
Hi,

I'm currently tidy up some drawings that had to be exported from Revit to AutoCAD.  I dont have the original Revit model to redo the export, so i need to tidy up the AutoCAD drawings to the client CAD standard.  So using lisp, i'm moving text at a particular height to a specific layer, hatch to hatch types to various hatching layers.  One issue im having is i'm trying to capture lines (they are sides of a hexagonal callout that was used.)  and there are hundreds of them per drawing and i wish to grab them using ssget and put them on a layer called callout.  for some reason im not having any luck. each of these lines are 56.2500mm in length.

This is my code, but it is not selecting any lines.  Am i missing something?

(defun c:SelectLinesByLength (/ SL1 ss)
  (setq SL1 56.250) ; Change the length value as needed
  (setq ss (ssget "_X" (list (cons 0 "LINE") (cons 40 SL1))))
  (command "_change" SL1 "" "Properties" "layer" "Detail" "ltype" "bylayer" "")
  (princ)
)

Any help on this would be greatly appreciated.
Regards
Diarmuid
If you want to win something run the 100m, if you want to experience something run a marathon

dwaschnia

  • Mosquito
  • Posts: 13
Re: AutoCAD Line length ssget issue.
« Reply #1 on: June 07, 2023, 06:32:02 AM »
typo:

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: AutoCAD Line length ssget issue.
« Reply #2 on: June 07, 2023, 07:56:32 PM »
I am pretty sure can not use (cons 40 rather you have to get all lines and then compare is line length = SL1

Use equal function (equal len 56.25 1e-06) this allows for rounding up to 6 decimal places.
A man who never made a mistake never made anything