TAGGED: scripting, spaceclaim
-
-
October 9, 2018 at 10:05 am
LKoorneef
SubscriberI want to use a 'local coordinate system' to define parts in my Python script:
origin = Point.Create(1, 1, 1) x_Direction = Direction.DirX y_Direction = Direction.DirY result = DatumOriginCreator.Create(origin, x_Direction, y_Direction) LCS = result.CreatedOrigin LCS.SetName('Bar1')
This works, I get an origin in my Structure called 'Bar1'
Â
But if I want to define a new part relative to origin 'Bar1' the part is still generated in the WCS or base origin:
result = CylinderBody.Create(Point.Create(0, 0, 0), Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Point.Create(0, 0, 10), Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Point.Create(0, 1, 10 ), ExtrudeType.None) RenameObject.Execute(Selection.Create(result.CreatedBodies[0]), 'Drill')
How can I activate the LCS ?
-
October 9, 2018 at 1:56 pm
Brian Bueno
Ansys EmployeeLKoorneef
It's not possible to designate a user defined coordinate system as the new origin for the solid model.
However, selecting the origin as the basis for a sketch plane will define that location as (0, 0) for the sketch. My advice would be to alter your approach slightly and create a sketched circle, then use the Pull command to create the cylinder.
A simple example is below:
# Set Sketch Plane
selection = Selection.Create(CoordinateSystem1)
result = ViewHelper.SetSketchPlane(selection, Info1)# Sketch Circle
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(10))# Solidify Sketch
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info2)# Extrude 1 Face
selection = Selection.Create(Face1)
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, MM(25), options, Info3)-
October 9, 2018 at 2:22 pm
LKoorneef
SubscriberBrian Bueno thanks for your quick reply.
I think it limits the use of LCS'es when you are modelling in 3D. But ok, I'll use the sketch method then.Â
-
-
- The topic ‘Use of SpaceClaim origins in scripting’ is closed to new replies.
-
3597
-
1208
-
1092
-
1068
-
952
© 2025 Copyright ANSYS, Inc. All rights reserved.