Discovery Import

Discovery Import

Transforming to Master Space – scripting

    • Guillaume ANFOSSI
      Subscriber
      šŸ›ˆ This post originally contained file attachments which have been removed in compliance with the updated Ansys Learning Forum Terms & Conditions



      Hello,

      I have a part positioning problem when creating geometry with scripting in the context of assembly.

      If I create the geometry directly at the root, it's ok.
      But if the solid is created in the component, I get a positionning offset.

      Should i useĀ TransformToMaster command ? How it works ?

      Thanks,

    • Devendra Badgujar
      Ansys Employee

      HiĀ GUICAD

      Let me check and get back to you.

    • Devendra Badgujar
      Ansys Employee

      HiĀ GUICAD

      Here is what you need to add at the end.

      transform body

      Python

      newBody=DesignBody.Create(mypart,"circle",mycircle)
      mycomp=GetRootPart().Components[1]
      mycompFrame=mycomp.GetAllCoordinateSystems()[0].FramemycompMatrix=Matrix.CreateMapping(mycompFrame)
      newBody.Transform(mycompMatrix.Inverse)

      It looks at the component the new body is going into to get the local coordinate system, then it creates a matrix mapping and uses the inverse to transform the body.

      Please let me know if you need any further assistance on this.

      Regards.

    • Guillaume ANFOSSI
      Subscriber

      Great ! Thanks

Viewing 3 reply threads
  • You must be logged in to reply to this topic.