Author Topic: Routine requires an enter between picks.  (Read 4314 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Routine requires an enter between picks.
« Reply #15 on: January 18, 2021, 06:53:45 PM »
I have read about ssget and ssnamex functions and nothing was written in regard of such a return or so.

The ssnamex function returns information describing the method used to acquire the selection; for graphical selection methods, this will include the coordinates of selection windows etc. however, since the X mode string is not a graphical selection method and will iterate directly over the drawing database, only the entity names are returned as there isn't any other relevant selection information.

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: Routine requires an enter between picks.
« Reply #16 on: January 19, 2021, 04:26:20 AM »
Thanks Lee, that explained it beautifully.

jlogan02

  • Bull Frog
  • Posts: 327
Re: Routine requires an enter between picks.
« Reply #17 on: January 19, 2021, 01:57:57 PM »
Your mods should work without any issue I believe.

But the objects that didn't change to the new color 56 may were on Red color by layer and if so, then you need to go with different selection set by iterating the layer table and get the layer names that set with red color then add the list into the filter of the selection set.

Difficult?  :no:

I wasn't reading what you said here, all the way through. I got the other color routines to work, but had to make sure that any dimension that was selected had it's layer color set to RED. Then the remainder of the routines would just look at the properties of the layer color for selected objects and change them.

added this...
Code - Auto/Visual Lisp: [Select]
  1.   (if (setq col (ssget "_X" '((62 . 1)(0 . "MultiLeader,Hatch,*Line,*Text,Arc,Circle,dimension"))))
  2.     (foreach x (mapcar 'cadr (ssnamex col)))
  3.       (if (= (strcase (cdr (assoc 0 (setq lst (entget x))))) "DIMENSION")
  4.         (command "_.dimoverride" "dimclrd" 56 "dimclre" 56 "dimclrt" 56 "" (ssadd x) "")
  5.         (entmod (append lst '((62 . 56))))
  6.        )
  7.      )
  8.    )

added

Code - Auto/Visual Lisp: [Select]
  1.   (setq col2 (ssget "_X" '((62 . 1)(0 . "dimension"))))
  2.   (command "chprop" col2 "" "color" "56" "")

Then I'll set color back to bylayer at Record Issue.

Cheers. Thanks for the help guys.
 
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 327
Re: Routine requires an enter between picks.
« Reply #18 on: January 21, 2021, 01:29:20 PM »

Full code

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test1 (/ *error* col fm1 osm col2)
  2.  (defun *error* (msg)
  3.    
  4.     (if osm
  5.       (setvar 'osmode osm)
  6.     )
  7.     (if (not (member msg '("Function cancelled" "quit / exit abort")))
  8.      
  9.       (princ (strcat "\nError: " msg))
  10.     )
  11.     (princ)
  12.   )
  13.   (setq osm (getvar 'osmode))
  14.   (setvar 'osmode 0)
  15.   (setvar 'cmdecho 0)
  16.  
  17.   (if (setq col (ssget "X" '((0 . "MultiLeader,Hatch,*Line,*Text,Arc,Circle,dimension"))))
  18.     (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex col)))
  19.       (if (= (strcase (cdr (assoc 0 (setq lst (entget x))))) "DIMENSION")
  20.         (command "_.dimoverride" "dimclrd" 2 "dimclre" 2 "dimclrt" 3 "" (ssadd x) "")
  21.         (entmod (append lst '((62 . 256))))
  22.         )
  23.       )
  24.     )
  25.  
  26.   (if (tblsearch "LAYER" "FiberMgt_001") ;Check if the layer exists
  27.     (progn
  28.         (setq fm1 (ssget "x" '((8 . "FiberMgt_001"))))
  29.         (foreach x (mapcar 'cadr (ssnamex fm1)) (entmod (append (entget x) '((8 . "FiberMgt"))))
  30.           (command "-layer" "Make" "FiberMgt" "Color" "Yellow" "" "")
  31.           (command "-color" "ByLayer")
  32.          
  33.     );;End foreach
  34.    );;end progn
  35.   );;end if
  36.  
  37.   (setq col2 (ssget "_X" '((62 . 1)(0 . "dimension")(8 . "DIMEN")))
  38.   (command "chprop" col2 "" "color" "256" "layer" "DIMEN" "" "")
  39.  
  40. (if (tblsearch "LAYER" "FiberMgt_001")
  41.  (command "-laydel" "_n" "FiberMgt_001" "" "_y")
  42. )
  43.  
  44.  
  45.   (setvar 'osmode osm)
  46.   (setvar 'cmdecho 1)
  47.  
  48.  (princ)
  49. )
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 327
Re: Routine requires an enter between picks.
« Reply #19 on: January 21, 2021, 01:37:28 PM »
Logan,
Please upload the same drawing that you tested your codes out on to take a close look if possible.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10