Jump to content

How to build hundred of points more quickly?


---
 Share

Recommended Posts

 I want to build a point matix based on the center point. x direction length 2mm, y direction lenth 8mm, the Interval equals to 0.2mm.

Now I used is the for-loop method. But it is time consuming,about 3minutes. 

The question is how to creat the point matix more quickly?

 

t1=0.2
t2=0.2
for i in range(1,12):
   for j in range(1,42):
      MCAD_ELEMENT = gom.script.primitive.create_surface_point(
         name=str(i-6) + ' ' + str(j),
         point={'interpolated': True, 'normal': gom.Vec3d(0.00000000e+00, 0.00000000e+00, 1.00000000e+00),
                     'point': gom.Vec3d(x - (i -6)* t2, y - (j - 21) * t1, z),
                     'target': gom.app.project.actual_elements['曲面成分 1']})
Link to comment
Share on other sites

Hello, Gom team,

   Recent days, i test the gom function( "MCAD_ELEMENT = gom.script.primitive.create_surface_point' )'s efficiency. The result shows it is time consuming and not suitable to creat lots of points. Also, i  test another gom funtion(MCAD_ELEMENT=gom.script.primitive.create_equidistant_surface_points_evenly). This funtion can creat 300 points in seconds. It is quite fast. However, it need to select the region on the surface which cannot be precisely define the length and width. Moveover, it is equal distance in x and y direciton. The amount of point and the sequence cannot be decided. Does anyone has better solution?

left in pic use equidistant method.

right in pic use for loop method with creat surface point.

 

2021-08-26_144158.png

Link to comment
Share on other sites

My guess is that the thing that is slow is the scripting dialog. Do you have the script dialog open? Can you try to run the script from the menu without opening the script dialog?

Link to comment
Share on other sites

 Share

×
×
  • Create New...