Jeff Hiller
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/05/17 14:12 GMT-4                            
                        
                        
                                                    Hi Nicholas,
The Application Builder has a functionality called "Record Method" that allows you do perform operations in the COMSOL Desktop and have the software automatically write for you a method that performs those same operations.
Since you no doubt know how to assign the expression length_default to the parameter length in the GUI, just do the following:
In the App Builder, hit the "Record Method" button (A red frame will appear around the interface), go to the Model Builder and there set the Expression for length to length_default, then go back to the App Builder and hit "Stop Recording" (The red frame will disappear). 
And there you have it, a method that contains the instruction to set length to length_default!
It typically does not generate the most compact code possible, but it is a convenient tool and a great way to learn some of the syntax and commands.
Hope this helps,
Jeff                                                 
                                                
                            Hi Nicholas,
The Application Builder has a functionality called "Record Method" that allows you do perform operations in the COMSOL Desktop and have the software automatically write for you a method that performs those same operations.
Since you no doubt know how to assign the expression length_default to the parameter length in the GUI, just do the following:
In the App Builder, hit the "Record Method" button (A red frame will appear around the interface), go to the Model Builder and there set the Expression for length to length_default, then go back to the App Builder and hit "Stop Recording" (The red frame will disappear). 
And there you have it, a method that contains the instruction to set length to length_default!
It typically does not generate the most compact code possible, but it is a convenient tool and a great way to learn some of the syntax and commands.
Hope this helps,
Jeff                         
                                                
                                                                                                            
                                             
                                            
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/05/17 15:15 GMT-4                            
                        
                        Updated:
                            
                                8 years ago                            
                            
                                2017/05/17 15:23 GMT-4                            
                        
                        
                                                    Hi Jeff, thanks so much for your quick reply! I have actually done that and written a handful of my own methods to try and solve the problem. The method you described outputs code that looks like:
with(model.param());
      set("length", "length_default");
endwith();
This definitely works to set the value of "length" to the value of "length_default" behind the scenes. The problem that I'm having is that I have an input box with "length" as a source and when I run this method, "length_default" will show up in that input box instead of the numerical value that it represents. Furthermore, if I filter that input box to only accept doubles or integers, it will reject the "length_default" string value. 
I'm not sure if it's related, but when I update a parameter value in an input box it is updated and I can see that in the plots and solutions however, other parameters don't seem to acknowledge that update. What I mean is that if I update "length" and I have a filter on another input box that has a filter limiting it to a maximum value of "length", it will be limited by the original value and not the updated one. Sorry for rambling, I hope it's just something I'm missing on my end but I think I've been pretty thorough. 
--
Nick                                                
                                                
                            Hi Jeff, thanks so much for your quick reply! I have actually done that and written a handful of my own methods to try and solve the problem. The method you described outputs code that looks like:
with(model.param());
      set("length", "length_default");
endwith();
This definitely works to set the value of "length" to the value of "length_default" behind the scenes. The problem that I'm having is that I have an input box with "length" as a source and when I run this method, "length_default" will show up in that input box instead of the numerical value that it represents. Furthermore, if I filter that input box to only accept doubles or integers, it will reject the "length_default" string value. 
I'm not sure if it's related, but when I update a parameter value in an input box it is updated and I can see that in the plots and solutions however, other parameters don't seem to acknowledge that update. What I mean is that if I update "length" and I have a filter on another input box that has a filter limiting it to a maximum value of "length", it will be limited by the original value and not the updated one. Sorry for rambling, I hope it's just something I'm missing on my end but I think I've been pretty thorough. 
--
Nick                        
                                                
                                                                                                            
                                             
                                            
                            
                                                                                        
                                Jeff Hiller
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/05/17 16:15 GMT-4                            
                        
                        Updated:
                            
                                8 years ago                            
                            
                                2017/05/17 16:16 GMT-4                            
                        
                        
                                                    I think I now see what you mean.
How about this?
with(model.param());
  set("length", model.param().evaluate("length_default"));
endwith();
Jeff                                                
                                                
                            I think I now see what you mean.
How about this?
with(model.param());
  set("length", model.param().evaluate("length_default"));
endwith();
Jeff                        
                                                
                                                                                                            
                                             
                        
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/05/17 16:31 GMT-4                            
                        
                        Updated:
                            
                                8 years ago                            
                            
                                2017/05/17 16:42 GMT-4                            
                        
                        
                                                    Worked like a charm, I really appreciate it!
--
Nick                                                
                                                
                            Worked like a charm, I really appreciate it!
--
Nick