# Is it possible to create a block from other blocks?

**URL:** <https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097>\
**Category:** GNU Radio\
**Created:** [May 26, 2015, 11:47pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097 "2015-05-26T23:47:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [May 26, 2015, 11:47pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/1 "2015-05-26T23:47:27Z")

</div>

Hi all,

I wonder if there is a similar feature in grc as in Simulink where one  
can  
create a block from other blocks? (Select the blocks, right click and  
merge  
into one) Or how do you do more complicated flow graphs containing many  
many blocks? I am a beginner and I already have a hard time fitting in  
all  
the blocks in the window of grc.

Best regards,

Carl

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 12:15am UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/2 "2015-05-27T00:15:30Z")

</div>

Yes.  
[https://gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion#Hierarchical-Blocks](https://gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion#Hierarchical-Blocks)

You can also increase the canvas size in the top block options.

On Tue, May 26, 2015 at 2:46 PM, Carl O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Carl
> 
> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

–  
GDB has a ‘break’ feature; why doesn’t it have ‘fix’ too?

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 12:35am UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/3 "2015-05-27T00:35:22Z")

</div>

GRC has had the ability to create a hierarchical blocks for a little  
while  
(I forget which release added that): if you select multiple blocks you  
can  
right-click, and select more to find the ‘Create Hier’ option. This is  
described on the wiki at:  
[http://gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion#Hierarchical-Blocks](http://gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion#Hierarchical-Blocks)

It is just creating another XML wrapper around the blocks to create the  
hier block (with pads to allow input/output). I think usability wise it  
is  
essentially equivalent to the Simulink ‘merge blocks’ function.

Doug

On Tue, May 26, 2015 at 6:20 PM, Richard B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 12:21am UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/4 "2015-05-27T00:21:21Z")

</div>

You can’t do it the way you asked specifically. The GUI functionality of  
GNU Radio compared to Simulink is very different. The hierarchical block  
mentioned by Chris above is a way of putting several blocks together  
using  
code to do the wrapping. You need to create a new block using gr\_modtool  
and wrap all the subblocks into this top block. It takes a lot more  
experience to do then the few simulink clicks. If you’re are not afraid  
of  
that and plan on using gnuradio long term, it’s worth learning how to  
do.

Rich

On Tue, May 26, 2015 at 3:14 PM, Chris K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 12:42am UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/5 "2015-05-27T00:42:58Z")

</div>

You don’t need to code to create hier blocks; they can be created and  
used purely within GRC.

On Tue, May 26, 2015 at 3:20 PM, Richard B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Tue, May 26, 2015 at 3:14 PM, Chris K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> > > Best regards,
> > 
> > –  
> > GDB has a ‘break’ feature; why doesn’t it have ‘fix’ too?
> > 
> > * * *
> > 
> > Discuss-gnuradio mailing list  
> > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

–  
GDB has a ‘break’ feature; why doesn’t it have ‘fix’ too?

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 12:44am UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/6 "2015-05-27T00:44:09Z")

</div>

Scrolling back I see I missed a little bit of the earlier discussion -  
so  
to elaborate a little:

Simple ‘merging of blocks’ (i.e. I have several blocks connected  
together  
in a particular way, and want to wrap that up to re-use in other places)  
is  
what GNURadio refers to as a hierarchical block. The blocks are being  
re-used (to avoid duplication of code, which all programmers learn to  
hate  
the second time they copy and paste code and then have to go back and  
fix  
bugs in both places), but not being modified: and their connections are  
static.

If you want to use the functionality of several blocks and not have a  
static flowgraph (e.g. I want to access particular functions of  
particular  
blocks, but in some dynamic fashion that is not easily rendered as a  
static  
flowgraph), then you would want to do as Richard suggests: create your  
own  
out-of-tree module with custom blocks. For what I would consider to be  
any  
advanced functionality (i.e. application-specific function that is more  
than just a custom flowgraph) this is going to be required. That said -  
there is a fairly large set of things that you can do within the static  
flowgraph framework - and you can certainly spend a long time developing  
applications entirely within GRC before you need to go down the path of  
creating custom blocks. Since the amount of things you will need to  
learn  
at that point greatly increases, I suggest holding off until you know  
for  
sure this is what you need.

Doug

On Tue, May 26, 2015 at 6:33 PM, Douglas G. \<

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 12:44am UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/7 "2015-05-27T00:44:44Z")

</div>

Oh I take it back then. I did not know about this functionality myself.  
Good to know!

Rich

On Tue, May 26, 2015 at 3:41 PM, Chris K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![calvin76](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/9de053/32.png) [@calvin76](https://www.ruby-forum.com/u/calvin76)\
**Post date:** [May 27, 2015, 11:44pm UTC](https://www.ruby-forum.com/t/is-it-possible-to-create-a-block-from-other-blocks/242097/8 "2015-05-27T23:44:36Z")

</div>

Thank you for all the answers!

I will try the different solutions.

Best regards,

Carl

On 27 May 2015 at 00:42, Douglas G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
