Author Topic: Together, but apart....  (Read 9574 times)

0 Members and 1 Guest are viewing this topic.

Water Bear

  • Guest
Together, but apart....
« on: March 29, 2004, 07:31:27 PM »
Does anyone know how I might make a group such that I can move the components around, if required, but can be deleted by selecting any one part? :shock:

Serge J. Gianolla

  • Guest
Together, but apart....
« Reply #1 on: March 29, 2004, 09:47:11 PM »
Use the Group command, and toggle Selectable ON/OFF at will to realise what you're after.

Water Bear

  • Guest
Together, but apart....
« Reply #2 on: March 29, 2004, 10:45:12 PM »
Thanks for the input Serge, but I'm  trying to accomplish it in lisp. I've got a routine that creates unnamed groups and I'd like to be able to move the components around so I'm starting with something like this:
Code: [Select]
(defun bunches (/ grp pt1 pt2)
  (setq pt1 (getpoint "Select a point: ")
pt2 (getpoint "Select another point: ")
)
  (command "_.circle" pt1 12.0)
  (setq grp (ssget "L"))
  (command "_.circle" pt2 12.0)
  (setq grp (ssadd (entlast) grp))
  (command "-group" "c" "*" "" grp "")
  (princ)
  )
Now the two are one, but I can't move only one. :?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Together, but apart....
« Reply #3 on: March 30, 2004, 12:18:46 AM »
You could remove grp from the declared variables making it global.
Do not use the group at all unless you need it.

Code: [Select]
(defun bunches (/  pt1 pt2)
  (setq   pt1 (getpoint "Select a point: ")
   pt2 (getpoint "Select another point: ")
   )
  (command "_.circle" pt1 12.0)
  (setq grp (ssget "L"))
  (command "_.circle" pt2 12.0)
  (setq grp (ssadd (entlast) grp))
  ;(command "-group" "c" "*" "" grp "")
  (princ)
  )


Command: _move
Select objects: !grp   <======<<<  
<Selection set: 3d>
2 found

Select objects:
Specify base point or displacement: Specify second point of displacement or
<use first point as displacement>:

Just a though..

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Water Bear

  • Guest
Together, but apart....
« Reply #4 on: March 30, 2004, 08:35:01 AM »
Quote
Command: _move
Select objects: !grp <======<<<
<Selection set: 3d>
2 found
This will still move both objects in the set :?

Columbia

  • Guest
Together, but apart....
« Reply #5 on: March 30, 2004, 10:03:04 AM »
One way you could do it instead of using groups is to create a global list of the entity names.  And then what you could do is act on the list when you want to.

Does that make any sense?

SMadsen

  • Guest
Together, but apart....
« Reply #6 on: March 30, 2004, 10:24:53 AM »
Not sure I understand this question correctly but there's only PICKSTYLE that determines the behavior of commands when dealing with groups. If correctly understood, it seems you either need to grab the issued commands with a reactor and set PICKSTYLE accordingly, or you may want to try Columbia's excellent suggestion.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Together, but apart....
« Reply #7 on: March 30, 2004, 10:39:46 AM »
Quote from: Water Bear
Quote
Command: _move
Select objects: !grp <======<<<
<Selection set: 3d>
2 found
This will still move both objects in the set :?


That is the point. If you want to move the selections set named grp enter !grp.
If you want to move anything else just do it as you would normally.

Make sense? :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Columbia

  • Guest
Together, but apart....
« Reply #8 on: March 30, 2004, 10:57:11 AM »
Thanks, Stig!  I wasn't sure any one would understand my poorly written presentation of an obscure idea.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Together, but apart....
« Reply #9 on: March 30, 2004, 11:40:02 AM »
Quote from: Columbia
One way you could do it instead of using groups is to create a global list of the entity names.  And then what you could do is act on the list when you want to.

Does that make any sense?


Is this not a global selection set with all entities?
I don't understand what form this "global list" would take.

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Water Bear

  • Guest
Together, but apart....
« Reply #10 on: March 30, 2004, 12:15:24 PM »
@CAB I get it now.. :keb: the problem is that I was re-using that selection set name "grp" everytime I made a new section of duct. So the set wouldn't have the same name after I drew a few pieces. What if I had to move it later on? If this doesn't make sense , let me know and I'll add an image.

@Columbia could you elborate? how do I set that up to start?

Columbia

  • Guest
Together, but apart....
« Reply #11 on: March 30, 2004, 01:15:00 PM »
Okay... are we sitting down comfortably, because this could be a long one... (long sip of coffee)...here we go...

What I mean is this:  In your program you could compile together a LIST of entity names that you want to hold together and instead of using that LIST to form a GROUP, you could just keep that list separate.

Why would you want to do this???

Well, think of it this way.  If you have it in a GROUP you are stuck with some of GROUPs more limiting features.  For instance, if you want to change the layer of only one of the entities.  Using a selectable group, you end up changing all of them.

With using a stored LIST instead, you could conceivably do anything you wanted to the individual entities (move, trim, copy, extend, mirror, etc...) and then using a command that makes use of the LIST you could then manipulate all of those entities in anyway.  Of course, to do that you would have to build commands that would explicitly deal with that list.

Then again, on second thought what would probably be the most useful to you instead of a list is a global SELECTION SET.  It's used the same way, but then you wouldn't have to test to see if an entity from your list still exists before trying to perform an operation on it.

Does this clear anything up any??  Or is it still clear as mud?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Together, but apart....
« Reply #12 on: March 30, 2004, 01:16:46 PM »
I would think a global an array is needed or write the entity list to a text file?

Just speculating, cause safe arrays are not in my arsenal. :)

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

JohnK

  • Administrator
  • Seagull
  • Posts: 10605
Together, but apart....
« Reply #13 on: March 30, 2004, 01:31:34 PM »
Water Bear,
Here is a brief example I whiped up for you to help you with what Colombia is talking about.  

Code: [Select]
;;; A procedure for storing a variable in an association list form.
(defun var-store (var value)
  (cond ((and value) (cons var value))
        ((cons var (getvar var)))))

;;; another procedure for doing something on a whole list of stuff.
(defun Save-this-list (lst) ; <- give me a list to do stuff to.
  (mapcar                               ;;     Do this to this
                                        ;;          |      |
    '(lambda (x) (var-store (car x) (cadr x)));;<---+      |
    lst ;; <-----------------------------------------------+
    ))

;;; Fill a variable with some information to save.
(setq alist '((blipmode nil) (clayer nil) (pt1 '(6.6 2.6 0.0)))) ;; My list of info
;;; This list represents information on an entity. (location, points, etc. I just tossed some stuff
;;; in there so you can get a general idea.)
(save-this-list alist) ;; save the list of info


Now you have a nice tidy list of information saved on any given entity--or entities if you so wish.-- that you can retrieve at any given point.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Water Bear

  • Guest
Together, but apart....
« Reply #14 on: March 30, 2004, 02:15:50 PM »
@Columbia, I don't think that I can leave them as selection sets because I will be creating 300+ sets (alot of duct pieces, air outlets etc...) and as I recall, there is a limit in Autocad for selection sets.

@Seven, I see how that works well for a variable and a value...but how can I use that to associate: say, a line, an arc, a piece number (text) and a text box? I need to be able to move the piece number, if there is another duct below and it's piece number overwrites the first one; However, if I delete the piece number, I want everything associated with that number to be gone?
Also these associations must remain intact from one drawing session to the next.