3D Design

3D Design

SpaceClaim – Script

    • PiotrM


      I am very new to scripting. I want to sketch line from 1 point (I knew coordinates X,Y) to 2 point which is a start point of some curve. I am not intresting in calculate these corrdinates (recording script gave me XY coordinates) I want to defind this point by something like GetRootPart().Curves[4].GetStartPoint(). Picture below. However i am not able to do this.

      My sketch: XY plane.

      first line was created by recorded script:

      start = Point2D.Create(MM(1), MM(2))

      end= Point2D.Create(MM(3), MM(4))

      result = SketchLine.Create(start,end)

    • Keyur Kanade
      Ansys Employee
      What is end objective? Do you want to create any parameter?
      You can explore 'Block' function of SpaceClaim in 2021R1.
      Please go through help manual for more details
      Regards Keyur
      How to access Ansys Online Help Document
      How to show full resolution image
      Guidelines on the Student Community
      How to use Google to search within Ansys Student Community
    • Tauron21
      Hi PiotrM I┬┤m also new at scripting with Spaceclaim (and it┬┤s actually harder as expected due to the lack of proper documentation or tutorials).
      But maybe that could help you:
      Used it for a Named Selection and it works. Unfortunatly it doesn┬┤t work for the "SketchLine.Create" command, as it expects something like Point(X/Y) and not a Selection.
      Maybe you can find a workaround.
      Regards Stefan
    • PiotrM
      Hi Thanks for your anwsers.
      To be honest I didnot check solution with: "Selection.Create(GetRootPart().Curves[0].GetChildren[ICurvePoint]()[0])" . I would like to try this way also because as I understand it, this could be more accurate.
      However, I did it on my way, I extracted coordinates from an object.
      # Selection of point
      pointStart = GetRootPart().Curves[4].GetStartPoint().Point - returns a tuple with coordinates (X,Y,Z)
      # Extraction of point coortinates
      pointStart_X = pointStart[0]*1000
      pointStart_Y = pointStart[1]*1000
Viewing 3 reply threads
  • You must be logged in to reply to this topic.