How to select all bolt holes on all bodies and create washers, using space claim scripting
How to select all bolt holes on all bodies and create washers around all selected holes, equal to 2 times dia of that hole. And later I want to create fixed joints in mechanical between opposite washer faces of bolt holes. Can anyone help me the script as we have 100s of bolt to be modeled with the fixed joints.
Answers
-
Hey SK, You may check this script and make necessary modifications.
myedges=Selection.Create(mybodies).ConvertToEdges().ConvertByShape(GeometryType.Circle)
for e in myedges:
if e.Items[0].Shape.Geometry.Radius > MM(5.39/2) and e.Items[0].Shape.Geometry.Radius < MM(5.4/2) : # you may edit here with your required Radius/Diameter Valuesselection = e direction = MoveImprintEdges.GetImprintDirection(e, e.ConvertToFaces().ConvertByShape(GeometryType.Plane), False) options = MoveImprintEdgeOptions() result = MoveImprintEdges.Execute(selection, direction, MM(-1.64), options) # this value changes the washer dia
myreqfaces=List IDesignFace
myfaces=Selection. Create(GetRootPart().GetAllBodies()).ConvertToFaces().ConvertByShape(GeometryType.Plane)
for f in myfaces:
myedges=f.ConvertToEdges()
if myedges.Count==2:
myreqfaces.Add(f.Items[0])Selection.Create(myreqfaces).CreateAGroup("MyReqFaces")
0 -
Check out this sample code for creating the washer splits. You may make the necessary changes by changing the Hole Diameter and Washer Diameter values. Note that this script would create the washer split in both side of the hole
myedges=Selection.Create(mybodies).ConvertToEdges().ConvertByShape(GeometryType.Circle)
for e in myedges:
if e.Items[0].Shape.Geometry.Radius > MM(5.39/2) and e.Items[0].Shape.Geometry.Radius < MM(5.4/2) :selection = e direction = MoveImprintEdges.GetImprintDirection(e, e.ConvertToFaces().ConvertByShape(GeometryType.Plane), False) options = MoveImprintEdgeOptions() result = MoveImprintEdges.Execute(selection, direction, MM(-1.64), options)
myreqfaces=List IDesignFace
myfaces=Selection. Create(GetRootPart().GetAllBodies()).ConvertToFaces().ConvertByShape(GeometryType.Plane)
for f in myfaces:
myedges=f.ConvertToEdges()
if myedges.Count==2:
myreqfaces.Add(f.Items[0])Selection.Create(myreqfaces).CreateAGroup("MyReqFaces")
0 -
Many thanks. Can you please tell me where to declare mybodies as I'm getting an error saying "name 'mybodies' is not defined"
0