Author Topic: SSGET and layernames with brackets  (Read 974 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 653
SSGET and layernames with brackets
« on: October 01, 2021, 12:09:42 PM »
Maybe it's an old think I have forgotten, but ...

I have layernames which are using brackets, like

Code - Auto/Visual Lisp: [Select]
  1. (setq layername "my [crazy] layer(name)"

Using a ssget like
Code - Auto/Visual Lisp: [Select]
  1. (ssget  (list (cons 8 layername)))
always returns 0 elements. Removing the brackets from layername solves the problem.

Is there another (better) solution than renaming?
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: SSGET and layernames with brackets
« Reply #1 on: October 01, 2021, 01:22:17 PM »
Since string-valued DXF groups within ssget filter lists accept wildcard operators, you'll need to escape those wildcard operators that you intend to be treated as literals, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. (ssget '((8 . "my `[crazy`] layer(name)")))

Peter2

  • Swamp Rat
  • Posts: 653
Re: SSGET and layernames with brackets
« Reply #2 on: October 04, 2021, 08:43:53 AM »
Thanks Lee

works fine now.

Peter
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23