|
|
|
|---|
Tutorial: choice and insertion of component in a TopSolid document
![]()
Introduction:
Before beginning any wizard, you have to clearly define the purpose as well as the principal steps to cross.
In this tutorial, you are going to create a "shear pin" wizard. It allows you to select a pin in the AFNOR standard according to specifics criteria (load, resistance to slipping, minimum and maximum length). The wizard allows you to insert the pin in a TopSolid document, use propagation and its drilling process.
Once the wizard finished, its model document will be similar to this
one :
.
New TopSolid/Wizard document:
Open a new TopSolid/Wizard document : File | New function or icon
.
Select the wizard tab and select the OK button. You have now an empty TopSolid/Wizard document
You have to save your work regularly.
You can save this document right now. Create a first folder in Missler\Config and name it My wizards. This one is the standard of your wizard. In this folder, create another one and name it Tutorial, it is the family of your wizard.
You have to declare the folder My wizards as a standard. For that, use the following keyword in your top.cfg file :
D_COMPO_WIZARD_STANDARD <tab> My wizards <tab> folder path.
This way, you will be able to execute your wizard thanks to the "Assembly | Execute standard wizard" function of a TopSolid/Design document
Then, in your TopSolid/Wizard document, use the "File | Save"
function or icon
et and save your file in the Tutorial
folder created before. Give the following name to your file : shear#V=pin#I=00#R=NR (shear
is the type name and pin
the variant name).
Simple click on this same icon will allow you to save your document regularly.
Variables creation:
When you create a wizard, variables are often created progressively. However, some of them can be created right now.
In this Wizard, you have to differentiate the shear type: simple shear or double shear. For that, create an enumeration variable and name it shear_type.
The search will be made on the unhardened parallel pin of type A, B and C of the AFNOR standard. To specify their place to the wizard, you have to create three variant descriptor variables relative to the three pin types : pin A, pin B, pin C. You have to allow the user to choose one of these pin types during the execution of the wizard, for that create an enumeration variable and name it pin_type.
Once the pin type chosen, you have to copy its catalog in a catalog variable in order to select some "lines-columns" according to criteria. Name it cat1.
The pin selection criteria will be as following : minimum and maximum length, the load and the resistance to slipping. The minimum and maximum lengths will be two reference to a parameter variables (name them lmin, lmax),and the load and resistance to slipping will be two real variables (name them T and Rpg).
Nodes creation:
Node
n°1 : Root node
Each wizard must begin by a root node. Place it at the top of your document.
Node
n°2 : Dialog page node
Behind this node, you are going to differentiate the shear type. For that, place a dialog page node in which you will use radio buttons corresponding to the "shear_type" enumeration variable.
It is your first dialog page, you must define it in the properties of the page (File | Properties in TopSolid/Dialog). This way, the < Previous button will be grey. The others dialog pages will have to be define as medium page or last page. In order to illustrate the shear type you can use some images in your node.
During the execution of the wizard, your page could be as following
Click on the image to get more details

Node
n°3 : Dialog page node
Create a second dialog page in order to keyboard forces and the pin type.
Click on the image to get more details

Node
n°4 : Check node
In order to check that previous data are coherent, create a check node. For example, you can check that the lmax value is greater than the lmin value and that values of T and Rpg are greater than 0.

Node
n°5 : Switch
node
You can load the catalog of the pin selected in the node n°3. Before that, you have to create a switch node which direct you to a catalog node according to the pin type.

Node
n°6, 7 and 8 : Catalog node
Connect three catalog nodes up with the node n°5. These three catalog nodes correspond to the pin A, pin B and pin C.
Node
n°9 : View node
You have now loaded the pin catalog. You are able to eliminate some code according to the length constraint you have specified into node 3. For that, you have to create a second catalog variable in order to save the result of this elimination. Name it cat2.
You are going to copy into the catalog 2 all the codes whose the length is contained between lmin and lmax. For that you have to know the name of the column driving the pin length into the catalog 1 (same name that the column of the component catalog). In this case, this column is named "l". Copy the condition to respect in the "condition" field of the node.
We want to retrieve the code column, diameter column and length column from the catalog 1 and copy them into the catalog 2 (in order to display them in the final results). These columns are named "$code", "d" et "l". You just have to copy these parameters names in the "Columns to visualize" field of the view node.

At this stage, your wizard can be similar to this one
:
.
Creation of the loop:
Now we are going to compute the resistance condition and check this condition with all the lines of the catalog 2. The lines checking it will be stored in a new catalogue, the others will not be taken into account.
In order to realize this loop, you have to create some new variables. You have to create a catalog variable to copy the lines checking the condition, name it cat3. You also have to create a cursor variable in which allows you to select one by one the lines of the catalog 2, name it i. And finally, in order to check that all the lines of the catalog 2 has been tested, create an Integer variable and name it t.
Node
n°10 : Computing
node
Variables created, you have to initialized the cursor. For that, create a computing node.

The first line of the "Expression" field place the cursor at the first line (line 0) of the catalog.
The second expression give the value 1 to the t variable if the i line contains data or 0 if not.
Node
n°11 : If
node
Before to make calculations, you have to check if there is data into the catalog 2. For that, create an "if node".
If the catalog 2 contains data, the t variable must have the value 1 (see previous node). This will be the expression to check.

Node
n°12 : Switch
node
Now you have checked that the catalog contains data, you can apply the resistance condition. According to the selected shear (simple or double) the resistance condition is not the same. You have to use a switch node to direct the wizard on the good condition.

Node
n°13 and 14 : Computing
node
You are able to write the resistance condition into a computing node. This condition will allow you to compute the minimum diameter supporting constraints specify in node 3 (load, resistance to slipping).
In order to compute this diameter and compare it to the diameters loaded into the catalog 2, you have to create two real variables: d_calc and dcat.
You also will create 3 additional real variables in order to compute the mass of each pin and display it into the final result. For that, create the lcat variable (retrieve the pin length), the m variable (retrieve the pin mass) and the p variable (steel voluminal mass).

The first line of the "Expression" field gives to the d_calc variable the calculation result.
The second line gives to the dcat variable the value of the d parameter of the i line of the catalog 2.
The third line gives to the lcat variable the value of the l parameter of the i line of the catalog 2.
The line four gives to the m variable the calculation result.
For the double shear, just the first line will be different : d_calc=sqrt((2*T)/(PI*Rpg)).
Node
n°15 : If node
Now you know the value of the minimum diameter to respect and the value of the diameter of the i line of the catalog 2.
You have to compare this two values in order to copy or not the i line of the catalog. For that you have to use an "If node" to check if the value of the catalog diameter is higher than that calculated (dcat>=d_calc).

Node
n°16 : Add line into a catalog
node
If the expression of the previous node is true, you have to copy the line in the new catalog cat3.
To copy the lines one by one and in increasing order (from a "0" line which will be incremented progressively) you have to create a new integer variable, name it a.
Once this variable created, you can place your "add line into a catalog" node:

In order to retrieve the $code, d and l columns, from the catalog 2 to the catalog 3, you have to write their name in the "Columns to visualize" field. To add the m column, write its name in the same field.
Node
n°17 : Computing node
Now that the first line of the catalog 2 has been tested, you have to increment the i cursor in order to test the next line and so on ...
For that, use a new computing node in which you will write the following expressions :

The first line of the "Expression" field increments the i cursor each time the wizard will pass in this node.
The second line gives to the t variable the value "1" if the i line contains data and "0" if not.
The last line gives to the a variable the value of the i variable.
You must attach to this node the node 15. Because if the condition of the node 15 is not true, it is not useful to go to the node 16, you can directly go to the next line.
And you have to link this node to the node 11 in order to complete the loop.
Node
n°18 : Computing node
At this stage, you have a catalog cat3 which contains pins supporting the constraints. Before to display all these pins, you have to check there are data in this catalog. For that, create a cursor variable, and name it y.

The first expression place the y cursor at the first line of the catalog.
The second expression gives to the t variable the value 1 if the y line contains data or 0 if not.
This node must be linked to the node 11 in case of the expression of the node 11 is not true.
Node n°19 : If node
Now you just have to use an "If node" to check the value of the t variable.

Your loop
can be as this one:
.
Display the result and insertion of the component:
First of all, admit the catalog 3 contains data. The other case will be explain later.
The expression of the previous is true.
Consider that the pin selected before is the pin A. For the others pin (B and C), you have to replace variables of the pin A by these of the corresponding pin.
Node
n°20 : Switch node
Before display the results, you have to differentiate the pin type which has been taken into account. For that, use a switch node retrieve the pin_type enumeration variable.

Node
n°21, 22 and 23 : Dialog page node
Now you are able to display the pins supporting constraints.
For that, use a dialog page node and create in it a "view control" in order to select one of the proposed pins. So that this selection is taken into account, you have to create a string variable which will contain your choice, name it code.
Click on the image to get more details

Node
n°24, 25 and 26 : Dialog page node
You have selected a pin code thanks to the previous node, you have to choose a positioning coordinate system in this one.
In the component file, there are three possible coordinate systems: middle coordinate system, top coordinate system and bottom coordinate system. You have to create a dialog page node in which you will use an enumeration variable which will refer these three coordinate systems, name it fr.
This page being your last dialog page node, you have to specify it in its properties (File | Properties function in TopSolid/Dialog). This way, the Next > button will be replace by the Terminate button.
Click on the image to get more details

Node
n°27, 28 and 29 : Switch node
According to the coordinate system selected before, you have to direct the wizard to the corresponding component node in order to insert the pin a TopSolid/Design document. For that, you just have to use a switch node with the "fr" enumeration variable.

Node n°30 to 38 : Component node
You are able to insert the component node according to the selected coordinate system.
In order to inform each fields as the creation of the node, you have to create a reference to coordinate system variable. This one will represent the destination coordinate system of your pin, name it frd. The purpose of the wizard is also to propagate the pin and to use its processes. For that, you have to name the component thanks to a string variable, name it pin.
Click on the image to get more details

Node
n°39 : Macro node
To propagate your pin, you have to use a macro node.
Select in this node the name you have given to your component. This name is the string variable used in the previous node ("pin" variable).

Noeud n°40 : Process node
To use processes of the pin (drilling processes), you have to use a process node.
Select in this node the name you have given to your component. This name is the string variable used in the previous node ("pin" variable).
Select the macro to use, in your case it is the "All processes" macro.

Node n°41 : Finish node
The wizard is finished, you can insert the finish node.

This last
part can be as this one:
.
No result ?
We have seen the case the catalog cat3 contains pins supporting constraints. Let's see the case where the catalog is empty.
If the catalog is empty, the expression of the node 19 will be not true. You will place a dialog page node behind this node to ask the user if he wants to change the constraints values (and so to go back to the node 3) or if he wants to stop here.
Node n°42 : Dialog page node
In order to give the possibility to the user to continue or stop the wizard, you have to create an enumeration variable, name it continue.
This node must be place behind the node 19 in case where its expression is not true.
Click on the image to get more details

Node n°43 : Switch node
You just have to create a switch node behind the previous one using the "continue" variable. Link one branch to the finish node (in case the user wants to stop) and the other branch to the node 3 (in case the user wants to change the constraints values).

Execute the wizard:
To execute the wizard, you have to possibilities:
You have create a My wizards folder as standard (see backup paragraph), you can execute your wizard thanks to the Assembly | Execute standard wizard function.
You also have the possibility to use the Assembly | Execute wizard function. Then, select the wizard to execute thanks to the EXPLORE button or select it directly if it is already opened.