Create CDF file in which the code is not included

As far as I know, the CDF can be used to distribute projects in which you can interactively evaluate the projects without need to have Mathematica.

Recently I notice that the files in the Demonstration Project contain CDF files in which the code is not at all included.
If you check this Radial Engine example and download the CDF file you will see that the code is not anywhere in the file and to get the code you have to download it separately.

How can that be done? Is it just simply delete the input cell and keep the output cell and then export the file as standalone CDF or something else has to be done.

Thank you

=================

  

 

Is the CDFDeploy function the answer? How closely is this topic related: How to create a “standard” CDF programmatically?. Also, when you click File/CDFExport you can pick the source to be the selection.
– Kuba
Apr 8 at 10:16

  

 

@Kuba it is related and thanks for mentioning it.
– Algohi
Apr 9 at 17:27

=================

1 Answer
1

=================

Completely define your demonstration in a Manipulate or DynamicModule by making use of the Initialization and/or SaveDefinitions options.
Copy and paste only the output cell into a new (or existing) notebook.
Export this notebook as CDF.

For example, the following Manipulate is completely defined by using Initialization. So by performing steps 2 and 3 a CDF without code can be created.

Manipulate[
Plot[a g[x] + c, {x, -10, 10}, PlotRange -> {-22, 22}],
{a, -2, 2}, {c, -5, 5},
Initialization :> {g[x_] := x Sin[x]}
]

Hope this helps.

  

 

The code certainly does not show when opening the CDF in Mathematica but if you select the cell and choose Convert To InputForm, everything shows. And while more than a bit cryptic, the commands are visible when the CDF is opened up in a text editor.
– Jim Baldwin
Apr 8 at 2:53

  

 

Let me clarify my previous comment: the Convert To InputForm shows the code when I follow the above instructions on my own CDF’s. However, the Radial Engine example won’t show the code when attempting to use Convert To InputForm. So I think there must be something that restricts the showing of the code during the process that converts a candidate CDF document which ends up on the Demonstration Project.
– Jim Baldwin
Apr 8 at 3:12

  

 

@JimBaldwin Could be using Enterprise CDF for the Demonstration Project.
– Edmund
Apr 8 at 9:52