|
[Sponsors] |
July 7, 2016, 05:38 |
Script Connection Friction
|
#1 |
New Member
Join Date: Jul 2016
Posts: 3
Rep Power: 10 |
Hello all,
I'm scripting an epicycloid gear in 2D. I am able to create the required mesh and I'd like to set a frictional connection between the pins and the gear by using script. What are the functions or the syntaxes for that? Should I make named selections for each pin? What is the easiest solution for it? Can anybody help me in these problems? Best regards! Arpad |
|
July 7, 2016, 19:51 |
|
#2 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
Hi Arpad,
Are you using design modeler? You have to do named selection for each pin in order to call them for connections. named selection of bodies can be done like this: Code:
var pin1 = ag.fm.Body(ag.fm.BodyCount-1); pin1.Name = "Apin1" Cheers KAPI |
|
July 8, 2016, 07:17 |
|
#3 |
New Member
Join Date: Jul 2016
Posts: 3
Rep Power: 10 |
Hey Kapi!
Thanks for the help. I didn't know this syntax. It's good for change the name of the geometry item in the part list. But I'd like to set Named Selections, as I mentioned in this thread. (NamedSel_DM_.PNG and NamedSel_DM_tree.PNG) I use them to make the mesh size and I have no idea how to creat them in the Design Modeler by script. I attached the pics what I want to do with the connections. All of the connections are named like this: Contact Region x. So I thought I'd use this name to change bonded to frictional; friction coefficient to 0,07 and the interface treatment Adjust to Touch. OR if I can make the NamedSlections for every part and edge, then I could use them for set the contact and the target, after I changed the scoping method. Thank you for helping me! Best regards! Arpad Code:
//Accesing Mesh Control Properties var Mesh_Mod = DS.Tree.FirstActiveBranch.MeshControlGroup; DS.Script.SelectItems(""+Mesh_Mod.ID); //Insert the edge sizing for Epicycloid DS.Script.doInsertMeshSize(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Epicycloid" ; ListView.ActivateItem("Type"); ListView.ItemValue = "Element Size" ; ListView.ActivateItem("Element Size"); ListView.ItemValue = "0.1" ListView.SelectedItem.IsChecked="false" //Insert the infaltion for Epicycloid DS.Script.doInsertInflation(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Epi_srf" ; ListView.ActivateItem("Boundary Scoping Method"); ListView.ItemValue = "Named Selections" ; ListView.ActivateItem("Boundary"); ListView.ItemValue = "Epicycloid" ; ListView.ActivateItem("Inflation Option"); ListView.ItemValue = "First Layer Thickness" ; ListView.ActivateItem("First Layer Height"); ListView.ItemValue = "0,1" ListView.SelectedItem.IsChecked="false" ListView.ActivateItem("Maximum Layers"); ListView.ItemValue = "6" ListView.SelectedItem.IsChecked="false" ListView.ActivateItem("Growth Rate"); ListView.ItemValue = "1,15" ListView.SelectedItem.IsChecked="false" //Insert the edge sizing for circle of the gear DS.Script.doInsertMeshSize(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Epi_crc" ; ListView.ActivateItem("Type"); ListView.ItemValue = "Element Size" ; ListView.ActivateItem("Element Size"); ListView.ItemValue = "1" ListView.SelectedItem.IsChecked="false" //Insert the face sizing for the gear DS.Script.doInsertMeshSize(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Epi_srf" ; ListView.ActivateItem("Type"); ListView.ItemValue = "Element Size" ; ListView.ActivateItem("Element Size"); ListView.ItemValue = "1" ListView.SelectedItem.IsChecked="false" //Insert the mesh method DS.Script.doInsertMeshElementShape(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Gear_Body" ; ListView.ActivateItem("Method"); ListView.ItemValue = "Triangles" ; //Insert the edge sizing for external circle of the excenter DS.Script.doInsertMeshSize(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Ex_ext_crc" ; ListView.ActivateItem("Type"); ListView.ItemValue = "Element Size" ; ListView.ActivateItem("Element Size"); ListView.ItemValue = "1" ListView.SelectedItem.IsChecked="false" //Insert the face sizing for the excenter DS.Script.doInsertMeshSize(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Ex_srf" ; ListView.ActivateItem("Type"); ListView.ItemValue = "Element Size" ; ListView.ActivateItem("Element Size"); ListView.ItemValue = "1" ListView.SelectedItem.IsChecked="false" //Insert the face sizing for the pin DS.Script.doInsertMeshSize(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Pin_srf" ; ListView.ActivateItem("Type"); ListView.ItemValue = "Element Size" ; ListView.ActivateItem("Element Size"); ListView.ItemValue = "0,5" ListView.SelectedItem.IsChecked="false" //Insert the mappesface for the pin DS.Script.doInsertMeshMappedMeshing(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Pin_srf" ; //Generate Mesh DS.Script.doModelPreviewMeshFromToolbar(1) //Accesing the boundary conditions properties var Env = DS.Tree.FirstActiveBranch.Environment; DS.Script.SelectItems(""+Env.ID); //Creating Moment at the gear circle DS.Script.doInsertEnvironmentFreeMoment(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Epi_crc" ; ListView.ActivateItem("Magnitude"); ListView.ItemValue = "248000" ; ListView.SelectedItem.IsChecked="false" //Insert the fixed support on pin DS.Script.doInsertEnvironmentFixedDisplacement(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Pin_int_crc" ; //Insert the fixed support on the excenter DS.Script.doInsertEnvironmentFixedDisplacement(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Ex_int_crc" ; DS.Script.doInsertEnvironmentFrictionlessDisplacement(1) ListView.ActivateItem("Scoping Method"); ListView.ItemValue = "Named Selection" ; ListView.ActivateItem("Named Selection"); ListView.ItemValue = "Ex_ext_crc" ; |
|
July 10, 2016, 23:02 |
|
#4 |
Senior Member
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 14 |
those are automatic connection made my mesh
personally I dont like those connections untill I am 100% sure about them. I prefer to make named selection of with side of connection and make interface.I use something like this: Code:
/create array for partID and TopoId for each body var partID = new Array (); var TopoId = new Array (); //Named section or interface #1 for (var i= 1; i<=count; i++) { partID[i] = ds.SelectionManager.SelectedPartID(i); TopoId[i] = ds.SelectionManager.SelectedEntityTopoID(i); } SM.Clear();//clear any existing selection for (var i= 1; i<=1; i++) { var part = ds.SelectionManager.PartMgr.PartById(partID[i]); var brep = part.BRep; var body = brep.Cell(TopoId[i]); var faces = body.faces;//get total faces of each body //loop the faces to get the face partID and topoID var faceCount = faces.Count; //SM.Clear(); //clear any existing selection for (j= 7;j<=faceCount-2; j++) { face = faces(j); var aTopoId = face.Id; SM.ForceSelect(partID[i], aTopoId); //force select face based on part id and topo id } } name = "Interf_" + NS + " 2"; ds.Script.addNamedSelection(false, name); //create named selection ds.Script.updateNamedSelectionsToolbar(); SM.Clear(); //clear any existing selection Hope this is what you are after. Cheers KAPI |
|
April 11, 2019, 09:17 |
|
#5 | |
New Member
shufangwang
Join Date: Mar 2019
Posts: 4
Rep Power: 7 |
Quote:
Do you know how to change to the frictional connection by script now? I met the same problem. Could you please give me a hint? Thanks! |
||
Tags |
connection, friction, mesh2d, script |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Workbench] Run ICEM Script in Workbench Script | MIZOR | ANSYS Meshing & Geometry | 9 | April 4, 2018 08:45 |
problem loading UDF library in parallel cluster | Veera Gutti | FLUENT | 8 | July 26, 2016 08:24 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
[OpenFOAM] Paraview 3.98 - errors when saving geometry file | pajot | ParaView | 1 | September 28, 2013 11:45 |
CentFOAM Python Script Installation: Error | socon009 | OpenFOAM Installation | 2 | May 26, 2012 10:36 |