Author Topic: modify by group name  (Read 1969 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
modify by group name
« on: May 10, 2006, 03:35:51 PM »
at my office they don't use layers alot which isn't a huge deal for what i'm doing but when doing assemblies we use groups. when i am trying to modify part of an assembly i would like to be able to turn pickadd on then select the group i want to modify and when i do a stretch for instance it would filter out items not belonging to this group. does anyone have anything like this?

Joe Burke

  • Guest
Re: modify by group name
« Reply #1 on: May 11, 2006, 09:37:43 AM »
Dan,

Something like this might work for you. Select the group with pickstyle set to 1 or 3, IOW group selection on. Isolate the group (selection set) with the ISO function and stretch. Restore the invisible objects with the USO function.

Of course the ISO and USO functions could be sub-functions within a program specifically designed to isolate a group, for whatever purpose.

Also keep in mind, they will not be fast with a drawing containing many objects in model space. Every object is examined by both functions.



Code: [Select]
;; Isolate selected objects in model space.
(defun c:ISO ( / doc vislst)
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
  (and
    (or
      (= 1 (vlax-get doc 'ActiveSpace))
      (prompt "\nIsolate works in model space. ")
    )
    (setq vislst (SSVLAList (ssget)))
    (vlax-for x (vla-get-ModelSpace doc)
      (if (not (vl-position x vislst))
        (vla-put-visible x :vlax-false)
      )
    )
  )
  (princ)
) ;end

;; Unisolate objects in model space.
(defun c:USO ( )
  (vlax-for x
    (vla-get-ModelSpace
      (vla-get-ActiveDocument
        (vlax-get-acad-object)))
    (vla-put-visible x :vlax-true)
  )
  (princ)
) ;end


;Argument: a selection set.
;Returns: a list of VLA objects.
(defun SSVLAList (ss / obj lst i)
  (setq i 0)
  (if ss
    (repeat (sslength ss)
      (setq obj (vlax-ename->vla-object (ssname ss i))
            lst (cons obj lst)
            i (1+ i)
      )
    )
  )
  (reverse lst)
) ;end


Joe Burke




EDIT: Wrapped your code in [ code ] tags, Joe
« Last Edit: May 18, 2006, 11:43:31 AM by nivuahc »

ELOQUINTET

  • Guest
Re: modify by group name
« Reply #2 on: May 15, 2006, 04:32:58 PM »
hmmm not exactly what the doctor ordered joe but it helps. i wound up putting each group on its own layer then locked one or the other. the drawback of your method is i really need the other group visible as the two relate to one another. thanks for the attempt to help anyway. maybe this will still come in use i'll put it in my bag of tricks presh

Joe Burke

  • Guest
Re: modify by group name
« Reply #3 on: May 18, 2006, 07:09:19 AM »
Dan,

You're welcome, for what it's worth.

ADT has that isolate thing. Once you've used it there, it's nice to have in vanillla ACAD.