7 Replies Latest reply: Jun 8, 2011 11:07 PM by acs_alan RSS

    UNGROUP SELECTION

    acs_alan Bronze

      Hello everyone,

       

      Ok I have a little problem, if anyone has any suggestions I would be happy to hear them.

       

      Goal

       

      In a pre-existing illustration I wish to take current callouts (generated using the callout tool) and break them down into elements, remove the rectangle (with white fill), and shorten the line so it no longer intersects the number (the rectangle provides a shadow effect around the number).

       

       

      Progress

       

      So far I have selected all callouts and converted into elements. This puts each callout into a group, I Select All and using the FirstSelectedElement mixed with the 'UNGROUP SELECTION' (cannot get the optinoal parameter DEEP to work) function Isodraw 7.1 crashes. Can anyone provide a different solution/fix?

       

      I have tried to avoid using FirstSelectedElement and Select All and I am trying to find a way to select each group individually using a loop (I think when Ungroup Selection is executed whilst multiple groups are selected Iso crashes) but I cannot find a way of selecting group individually.

       

       

       

      MACRO Callout_to_Elements
      
      DEFINE el as Element
      
      SELECT IF type IS "callout" 
      CONVERT SELECTION INTO ELEMENTS
      SELECT ALL
      el = ActiveDoc.FirstSelectedElement 
      While (Exists(el) = True)
           If (el.Type = "Group") && (el.lastChild = "line") Then # lastChild ensure a group that previosuly was a callout is selected and not another group
                UNGROUP SELECTION
           End If 
           el = el.NextSelectedElement 
           el = el.NextSibling
      End While
      
      END MACRO
      

       

       

      Oh I am not expecting to shorten the line that intersects the number, I assume this will have to be done manually which I am happy with.

       

       

      Many thanks for the help.

       

      Alan

        • Re: UNGROUP SELECTION
          ptc-2092444 Gold

          If I am understanding correctly, you are attempting to cycle through each group and then ungroup. If this is correct, do this instead.

           

          1) Select your groups as you had originally.

          2) Group all these groups into one group.

          3) Ungroup deep.

           

          I learned the hard way in IsoDraw 7.0 that ungroup only works on a single group. I had to do the above mentioned to handle something I was working on as well.

            • Re: UNGROUP SELECTION
              acs_alan Bronze

              Thanks Trevor answering your a legend!

               

              Nice way of approaching the situation. It works like you said, although another problem is other groups may be on the same layer as the callouts so select all will select groups that are not meant to be ungrouped.

               

              Ideally I can think of 2 approaches:

               

              1. Select all callouts before breakign and move to a Temp layer, lock other layers, convert callouts to elements, select all groups, group, select all, ungroup deep.
              2. Select each callout group individually (via a logical filter - see IF in code above), then executing ungroup on each group in turn.

               

              My thoughts are 1 is the likely choise as I am pretty sure it can be done, although its a bit of work. Is number 2 possible?

               

              Thanks

               

              Alan

                • Re: UNGROUP SELECTION
                  ptc-2092444 Gold

                  Would this change to #1 work for you?

                   

                  • 1) Select all callouts before breaking, convert callouts to elements, group, ungroup deep.

                   

                   

                  In regards to #2, yes you could select if type is callout. Instead of cycling through, couldn't you just group them and then ungroup deep?

                    • Re: UNGROUP SELECTION
                      acs_alan Bronze

                      Hi trevor,

                       

                      The problem with Select All then grouping and ungroup deep is their may be other groups on the same layer as the callouts that should not be ungrouped or affected in anyway and I do not at this time know a way to select these groups seperately based on specific criteria (see logic in IF Statment above).

                       

                      As for #2 I can select all and cycle through each group, with the 'FirstSelectedElement' and 'NextSelectedElement' but when I execute the Ungroup (Deep or not) function on each selection this crashes isodraw every single time. I need a way to select each group individually with using Select all and First/Next SelectedElement, I dont think isodraw will crash then.

                       

                      But to avoid the crashing I could use your method but would require more work (temp layer) and a re-ordering to ensure only callouts where temporarily moved.

                       

                      Thoughts?

                       

                      Thanks

                       

                      Alan

                        • Re: UNGROUP SELECTION
                          ptc-2092444 Gold

                          My mistake. I was thinking that the selection would remain after doing the conversion to elements. I do see that it does break the groups.

                           

                          I've also tried seeing if there was a way to 'label' a callout and have it carry through the conversion, but no luck.

                           

                          My suggestion at this point is the one with a little more work. In the end however, it likely is simpler.

                           

                          1) Make a temp layer.

                          2) Select if type is callout.

                          3) Move the callouts to the temp layer.

                          4) Lock all other layers.

                          5) Convert callouts to elements.

                          6) Select all.

                          7) Group.

                          8) Ungroup delete.

                          9) Whatever else...

                          10) Select all.

                          11) Select source layer and unlock.

                          12) Move select to layer.

                          13) Delete temp layer.

                           

                          It might be a few more lines of code, but is actually safer as you have quaratined your changes from the rest of your art.

                  • Re: UNGROUP SELECTION
                    PTC Employee

                    Hi.

                     

                    Your macro is running into an endless loop, if there was more than one group.

                    You can stop it by holding the "End" key pressed for a while.

                    I modified your macro a bit, so that it starts over for all groups after it ungrouped

                    a former callout. This is going to be very slow with many callouts, but at least it's

                    not endless:

                     

                    MACRO Callouts_to_Elements
                    DEFINE el as Element
                     SELECT IF type IS "callout" 
                     CONVERT SELECTION INTO ELEMENTS
                     SELECT ALL
                     el = ActiveDoc.FirstSelectedElement 
                     WHILE (Exists(el) = True)
                      IF (el.Type = "Group") 
                       IF ((el.lastChild.Type = "Line") && (el.firstChild.Type ="Text"))  
                        UNGROUP SELECTION
                        SELECT ALL
                        el = ActiveDoc.FirstSelectedElement
                       ELSE
                        el = el.NextSelectedElement
                       END IF
                      ELSE
                       el = el.NextSelectedElement    
                      END IF
                     END WHILE
                    END MACRO
                    
                      • Re: UNGROUP SELECTION
                        acs_alan Bronze

                        Hi guys,

                         

                        Thanks for the assistance, bgraffman it worked perfectly, I am just trying to learn from your code - thanks. Trevor cheers for the assistance, the method you have described is similar to what I was going to do if no solution was resolved, and moving the callouts from other elements does have a distinct advantage although for this project I think the Logical filter on the IF statement is solid for this project but for others may not be so easy.

                         

                        Thanks

                         

                        Alan