Jump to content

I would like a "Shrink To Contents" for block diagram structures


Recommended Posts

I like my block diagrams small, but that means that I frequently have to expand a Case Structure or For Loop or Event Structure or whatever to add new functionality to it. I usually do this by making the structure bigger than it needs to be, and then re-sizing it back down when I clean the code up.

I wish there was an easier way to shrink the structures. For instance, if I could right-click on the structure and select Shrink to Contents from the context menu, that would be a time-saver. I don't need the structure to auto-shrink by itself -- I'd be happy if it was just something I could fire off as needed. Of course, there should be a buffer of a few pixels (configurable with an INI key? :P) around the contents for aesthetics.

As a side note, could this be accomplished with Scripting? How hard would it be to get the extents of the contents of the selected structure, and resize it accordingly?

Link to comment

QUOTE(Justin Goeres @ Oct 23 2007, 04:39 PM)

I like my block diagrams small, but that means that I frequently have to expand a Case Structure or For Loop or Event Structure or whatever to add new functionality to it. I usually do this by making the structure bigger than it needs to be, and then re-sizing it back down when I clean the code up.

I wish there was an easier way to shrink the structures. For instance, if I could right-click on the structure and select Shrink to Contents from the context menu, that would be a time-saver. I don't need the structure to auto-shrink by itself -- I'd be happy if it was just something I could fire off as needed. Of course, there should be a buffer of a few pixels (configurable with an INI key? :P ) around the contents for aesthetics.

As a side note, could this be accomplished with Scripting? How hard would it be to get the extents of the contents of the selected structure, and resize it accordingly?

I have done the same thing as you quite a bit. On the note of scripting, I don't think it would be too hard to resize the structure. Would you then continue to shrink each containing structure up to the top level? And it would get more difficult if the contents were not already in the top left corner of the structure. Resizing would only move the bottom and right edges of the structure.

Link to comment

QUOTE(Justin Goeres @ Oct 24 2007, 09:39 AM)

...could this be accomplished with Scripting?

Absolutely! All you'd need to do is step down into the deepest structure, get references to all the objects, get their footprints, move them to the top left (+ some arbitrary border), resize the structure, and then step up a level and continue. You'd of course need to look at parallel structures too, but I don't think it'd be that difficult. The only thing that might take a bit more thinking is the positioning of tunnels once you've resized their structures.

Link to comment

QUOTE(crelf @ Oct 24 2007, 02:44 AM)

Absolutely! All you'd need to do is step down into the deepest structure, get references to all the objects, get their footprints, move them to the top left (+ some arbitrary border), resize the structure, and then step up a level and continue. You'd of course need to look at parallel structures too, but I don't think it'd be that difficult. The only thing that might take a bit more thinking is the positioning of tunnels once you've resized their structures.

I wouldn't want any automatic function to mess with VI or tunnel positions that I have chosen carefully before. :thumbdown:

So I'd prefer a function that only changes the size of structures, i.e. the bottom left corner, but doesn't move anything.

In my opinion, it shouldn't touch any parent or child structures as well. I expect this would only lead to diagramms on which you can invest hours to bring them back to a decent coding style. :blink:

Link to comment

QUOTE(silmaril @ Oct 24 2007, 01:49 AM)

I wouldn't want any automatic function to mess with VI or tunnel positions that I have chosen carefully before. :thumbdown:

So I'd prefer a function that only changes the size of structures, i.e. the bottom left corner, but doesn't move anything.

In my opinion, it shouldn't touch any parent or child structures as well. I expect this would only lead to diagramms on which you can invest hours to bring them back to a decent coding style. :blink:

I agree. My sort of off-the-cuff brainstorming about it imagines that it would take into account

  • the positions of all the nodes inside the structure, and
  • the positions of all the tunnels on the strucure

and resize the frame so that none of those move relative to the main root of the diagram. If I'm not mistaken, I think that would (in principle) allow resizing from all 4 corners without disturbing the structure contents. (Actually, not quite -- it would still have to consider the extents of wires going from node to node to truly do a good job.)

As JDave & crelf pointed out, though, resizing from anything but the bottom-right might require some gymnastics. Specifically, it would mean moving the objects around on the diagram inside the structure. It's not clear to me (in my head, at least) if that part would be practical.

Link to comment

QUOTE(silmaril @ Oct 24 2007, 06:49 PM)

I wouldn't want any automatic function to mess with VI or tunnel positions that I have chosen carefully before. :thumbdown: So I'd prefer a function that only changes the size of structures, i.e. the bottom left corner, but doesn't move anything.

Sure, and with scripting I think you can find the position of tunnels too, so that's certainly possible.

Link to comment

QUOTE(Justin Goeres @ Oct 24 2007, 04:57 AM)

... If I'm not mistaken, I think that would (in principle) allow resizing from all 4 corners without disturbing the structure contents. (Actually, not quite -- it would still have to consider the extents of wires going from node to node to truly do a good job.)

As JDave & crelf pointed out, though, resizing from anything but the bottom-right might require some gymnastics. Specifically, it would mean moving the objects around on the diagram inside the structure. It's not clear to me (in my head, at least) if that part would be practical.

Any resizing on the top or left would cause you to move nodes (and thus tunnels) around. In my work, however, I usually need to shrink the bottom-right anyway. So even this ability would be helpful.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.