Jeff Hiller
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/10/17 14:17 GMT-4                            
                        
                        Updated:
                            
                                8 years ago                            
                            
                                2017/10/17 14:18 GMT-4                            
                        
                        
                                                    The simplest was to create a regular hexagon is to use the Polygon tool and to take advantage of the "range" operator and the "cos" and "sin" functions, as shown in the attached file, which also shows the corresponding model method. 
From there you just need to add the randomness (i.e. scaling, rotation, center location).
Best,
Jeff
    -------------------
    Jeff Hiller                                                
 
                                                
                            The simplest was to create a regular hexagon is to use the Polygon tool and to take advantage of the "range" operator and the "cos" and "sin" functions, as shown in the attached file, which also shows the corresponding model method. 
From there you just need to add the randomness (i.e. scaling, rotation, center location).
Best,
Jeff                        
                                                
                        
                                                
                                                                                                            
                                             
                                            
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/10/17 16:21 GMT-4                            
                        
                        
                                                    Dear Jeff,
Thanks a lot for your quick reply. I successfully created a polygon (pol1) and scaled it (sca1), But the code:
** model.component("comp1").geom("geom1").create("pol"+ind, "sca1")
** 
 leads to error.
 How can I add randomness in center location ?
                                                 
                                                
                            Dear Jeff,
Thanks a lot for your quick reply. I successfully created a polygon (pol1) and scaled it (sca1), But the code:
** model.component("comp1").geom("geom1").create("pol"+ind, "sca1")
** 
 leads to error.
 How can I add randomness in center location ?                        
                                                
                                                                                                            
                                             
                        
                        
                            
                                                                                        
                                Jeff Hiller
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                2017/10/17 17:27 GMT-4                            
                        
                        
                                                    You can change the location of the center of the polygon by modifying the expressions used for the x and y coordinates of its vertices.
It should be pretty straightforward but if you should need further assistance, please contact COMSOL's technical support team at support@comsol.com .
Best regards,
Jeff
    -------------------
    Jeff Hiller                                                
 
                                                
                            You can change the location of the center of the polygon by modifying the expressions used for the x and y coordinates of its vertices. 
It should be pretty straightforward but if you should need further assistance, please contact COMSOL's technical support team at support@comsol.com . 
Best regards,
Jeff