変数スタジオ
Available in: Variable Studio
このトピックでは、Variable Studio を使用して変数を作成する機能とメカニズムについて説明します。この変数は、変数が作成されたドキュメントでも他のドキュメントでも使用できます。Variable Studio の作成ができるのは Onshape のブラウザプラットフォームのみですが、変数の表示と使用はすべてのモバイルプラットフォームで行えます。
Variable Studio がドキュメント内に作成され、その中の変数は、そのドキュメントワークスペース内のすべての Part Studio およびアセンブリですぐに使用できるようになります。
See also: Variable Studio Configurations.
-
ドキュメントで、左下の [新しいタブを挿入] アイコン (
) をクリックし、[Variable Studio を作成] を選択します。
-
Variable Studio が開き、入力可能な変数のテーブルが表示されます。
-
[名前] 列に最初の変数の名前を入力します (英数字のみ使用できます)。
-
次の行に移動するには Tab キーを押します。変数には [長さ] の既定タイプが入力されています。これを変更するには、ドロップダウン矢印を使用して新しいタイプを選択します。
To import a variable from a CSV file, select the From import option and follow these instructions: Importing a variable from a CSV table.
-
変数の既定値と、オプションの説明を入力します。
テーブル内の入力の順序を変更するには、右クリックして [上に移動] または [下に移動] を選択します。入力をドラッグして順序を変更することもできます。
Variable Studio のタイトルの左側にあるキャレットを使用して、セクションを折りたたんだり展開したりできます。すべてのテーブルを一度に折りたたむ (または展開する) には、タイトルブロックの右側にある 3 点メニューをクリックし、[すべてのテーブルを折りたたむ] (または展開) を選択します。
テーブルの前半で定義した変数を使用して、テーブルの後半で別の変数の値を定義できます。たとえば、次のようになります。
L1 変数 (テーブルトップの長さ) は、W1 変数 (テーブルトップの幅) を計算するために使用されます。
ワークスペース内のすべての Part Studio とアセンブリで変数を使用できるようにするには、[Variable Studio] タブの下端にあるチェックボックスをオンにします。
このチェックボックスをオフにすると、このドキュメントのワークスペースで Part Studios およびアセンブリの変数を使用できなくなります (変数がドラフト状態の場合はチェックボックスをオフのままにし、変数が使用可能になったらチェックボックスをオンにします)。
The From import variable type enables users to create a single variable that stores a subset of rows and columns from an imported CSV table. The Row options filter the rows and determine the Result type (Single value, Array, or Map) of the variable. The Column options then filter each row and determine the type of each entry in the final variable.
- In the table, click the Variable type arrow and select From import.

- In the Value cell, click the Edit pencil icon. The Variable dialog opens with the From import tab selected:

- In the dialog:
- Under CSV file, click the Select CSV file field to open the dialog:

Select the CSV file from either the Current document, Other documents, or click the Import button at the bottom of the dialog to select a CSV file from your device.
Once selected, click the file. It is loaded into the Select CSV file field.
- Fill out the Row and Column fields according to your requirements:
- Access type - Select By index, By index range, By label, or All values.
- Index - If By index is selected, enter a single Index value.
- Min/Max index - When By index range is selected, enter both the minimum and maximum index values.
- Value - If By label is selected, enter the label's string value.
- Regular expression - Check to pattern match a set of target strings.
- Result type - Select Single value, Array, or Map.
- Label column/row index - If the Result type is a Map, enter either a numerical index value or a variable.
- Access type - Select By index, By index range, By label, or All values.
- Check Conversion factor and enter a value with measurement units if you are converting from one measurement to another (for example, if the table uses inches, and you want these values converted to centimeters).

- Optionally, enter a Description to provide some details about the Variable or CSV file being used.
- Under CSV file, click the Select CSV file field to open the dialog:
- Click
.
See also: Variable: From Import Examples.
変数テーブル (およびその中で定義した変数) を、それが定義されたドキュメント以外のドキュメントで使用するには:
-
Variable Studio の別のドキュメントで定義した変数を使用するドキュメントを開きます。
-
左下の [新しいタブを挿入] アイコン (
) をクリックし、[Variable Studio を作成] を選択します。 -
新しい Variable Studio で、上部にある [Variable Studio を挿入] ボタンをクリックします。[Variable Studio を挿入] ダイアログが開きます。
-
ダイアログの上部にある [変数] テーブルを検索する 2 つのタブのいずれかを選択します。[現在のドキュメント] または [その他のドキュメント] です。
現在のドキュメントに Variable Studio がある場合は、[現在のドキュメント] の下にリストされます。Variable Studio を別のドキュメントで検索するには、[他のドキュメント] タブを選択します。
Variable Studio のテーブル全体 (上の Variable Studio 1 として表示) を選択するか、リストから 1 つまたは複数の異なる変数を選択できます。選択した内容は、現在のドキュメントですぐに利用可能になります。別のドキュメントから変数テーブルまたは変数を挿入する場合、ドキュメントには変数を含むバージョンが必要です。バージョンが存在しない場合は、次に進む前にバージョンを作成するように求められます。
変数または変数テーブルを正しく選択すると、現在のドキュメントの Variable Studio に選択したエンティティが表示されます。
テーブルを挿入した Variable Studio の名前とバージョンが、上記の Variable Studio 1 V1 としてテーブルの上部に表示されます。
構成済み Variable Studio では、挿入時にコンフィギュレーションを設定する必要があります。構成済み Variable Studio の参照を参照してください。
Variable Studio のリリース
[Variable Studio] タブを右クリックし、[リリース…] を選択します。
詳細は、リリース管理と一般的なリリースワークフローを参照してください。
構成された Variable Studio はリリースできません。
ラーニングセンターのその他のリソースについては、変数と式 (Onshape アカウントが必要です) コースに登録してください。