3 matic scripting to call out a sub_tree under an object tree

i’m using 3 matic scripting to get contour from an imported STEP file. Is there a way to get a list of contours from the object tree?

Hi Dennis,

Thank you for reaching out to us!

If you want to get a list of contours of a surface in a part, you will need to first find the border of the surface. From this border, you can then get the contours.
Example of API that you can use are as below:

surface = part.find_surface(surface_name)
border = surface.get_border()
contours_list = border.get_contours()

This will return a list of the contours of a surface in type of tuple.


Hope this helps. Please don’t hesitate to reach out if you have further concerns :)

Happy weekend!

Kind regards,

Hi Imanina,

Thank you for your kind assistance.

It is useful.

I’ve few more questions.

  1. How can we use listening mode in scripting?

It seems that there was no recording of the functions like measure, and create when we employed the listening mode.

  1. Is there a way to script in a manner that we can identify the orientation of a selected face?

  2. i’m also trying to perform creat_circle_arc_fit on any circle. However, it also creates a circle on a rectangular border. Is there a way to determine the border whether is a circle or a rectangle?

  3. How do I determine whether 2 faces are parallel or perpendicular to each other?

Pls kindly advise us.



Hi Dennis,

I’m glad to be of help :)

Regarding your questions,

  1. Listening mode can be used as a tool if you have an external IDE installed, and you want run or debug your script by using this external IDE. if you want to see the recording of functions used, you can refer to the logger window in the 3matic file.

  2. Currently we have no script that can detect the orientation of a selected face, but we do have an API where you can set the 3D view to certain direction. For example, API below will set the 3D view to be from Front view:

  • trimatic.view_default(view=trimatic.DefaultViews.Front)
  1. Unfortunately as of now we don’t have any way to determine the border whether it’s a circle or a rectangle. A workaround that I can suggest is to first define the name of the said round/rectangular surface. This way, you can do any specific operation on the border of the surface you need.

  2. You can determine this by checking on the direction of the surface. To do this, one of the methods I could suggest is as below:

  • Fit a datum plane to each surface (create_plane_fit)
  • For each datum plane, create a line by using the z-axis of the datum plane (create_line_direction_and_length)
  • Create an angle measurement between both lines. If the script manages to create the angle measurement, this will indicate that the surface is perpendicular to each other. You can also check the value of the angle measurement to be sure (create_angle_measurement_line_to_line)

Hope this somehow helps! If you need further assist, please do not hesitate to reach out to your local Application Engineer and we can definitely set up a session to go through this together :)

Happy weekend!

Kind regards,