How to create a Beam in Spaceclaim?
Ayush Kumar
Member, Moderator, Employee Posts: 444
✭✭✭✭
Answers
-
# Python Script, API Version = V18 startPoint=Point.Create(1,0,0) endPoint=Point.Create(5,0,0) lineSegment = CurveSegment.Create(startPoint,endPoint) part = GetRootPart() designLine = DesignCurve.Create(part,lineSegment) profile=BeamProfile.CreateDisk(10,"MyProfile") beamProfile=part.Components[0].Template beamGen = SpaceClaim.Api.V18.Beam.Create(beamProfile,designLine) beamGen.SetName("My beam")
2 -
If you're using the V19 API, it works just as well:
# Python Script, API Version = V19 import SpaceClaim.Api.V19.Beam as Beam startPoint=Point.Create(1,0,0) endPoint=Point.Create(5,0,0) lineSegment = CurveSegment.Create(startPoint,endPoint) part = GetRootPart() designLine = DesignCurve.Create(part,lineSegment)
0 -
In V21 API:
def createcircularbeams(pointlist,outerdia,innerdia,name): ''' ************************************************************************** Create circular beams in spaceclaim using points way to use : createcircularbeams([(0,0,0),(100,0,0),(200,0,0)],20,10,'MyBeam') ************************************************************************** ''' curves = [] for previous, current in zip(pointlist, pointlist[1:]): point1 = Point.Create(previous[0], previous[1], previous[2]) point2 = Point.Create(current[0], current[1], current[2]) line1 = SketchLine.Create(point1,point2) profile1 = BeamProfile.CreateCircular(outerdia,innerdia,name) curves.append(line1.CreatedCurves[0]) selection_curve = Selection.Create(curves) selection_profile = Selection.CreateByNames(name+'_Circle') beams = Beam.Create(selection_curve,selection_profile) createdbeams = beams.CreatedBeams selection_beams = Selection.Create(createdbeams) component = ComponentHelper.CreateAtRoot(name) ComponentHelper.MoveBodiesToComponent(selection_beams, component, False, None) component.Content.ShareTopology = component.Content.ShareTopology.Share
2