3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Use of SpaceClaim origins in scripting

    • LKoorneef
      Subscriber

      I 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 ?

    • Brian Bueno
      Ansys Employee

      LKoorneef

      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)

      • LKoorneef
        Subscriber

        Brian 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. 

Viewing 1 reply thread
  • The topic ‘Use of SpaceClaim origins in scripting’ is closed to new replies.