Hello,
I would like to see some sample code for creating submodels in smile.
I haven't been successful so far. Thanks.
			
			
									
						
										
						Submodels in smile
- 
				shooltz[BayesFusion]
 - Site Admin
 - Posts: 1477
 - Joined: Mon Nov 26, 2007 5:51 pm
 
Re: Submodels in smile
Try this:
			
			
									
						
										
						Code: Select all
int hSub = net.GetSubmodelHandler().CreateSubmodel(DSL_MAIN_SUBMODEL, "sub1");
int hNode = net.AddNode(DSL_CPT, "x1");
DSL_node *node = net.GetNode(hNode);
node->SetSubmodel(hSub);
- 
				jdtoellner
 - Posts: 71
 - Joined: Mon Aug 01, 2016 9:45 pm
 
Re: Submodels in smile
If I wanted to change the position of the submodel node would I do it this way?
(I tried this and it didn't appear to work.)
			
			
									
						
										
						Code: Select all
net.GetSubmodelHandler().GetSubmodel(hSub)->windowpos.center_X = 100;
net.GetSubmodelHandler().GetSubmodel(hSub)->windowpos.center_Y = 100;- 
				shooltz[BayesFusion]
 - Site Admin
 - Posts: 1477
 - Joined: Mon Nov 26, 2007 5:51 pm
 
Re: Submodels in smile
The windowpos member represents the location of the submodel window (the MDI child in GeNIe). To move the submodel icon within its parent sub model, use this:
			
			
									
						
										
						Code: Select all
net.GetSubmodelHandler().GetSubmodel(hSub)->info.position.center_X = 100;