[Je...] Posted 9 hours ago Share Posted 9 hours ago (edited) Attached you will find a script that automatically creates equidistant points on the selected sections. The naming of the created points consists of the name of the selected section followed by “_Point” and a sequential number. Is it possible to have the numbering start with a leading zero, so that the first point is named “_Point_01” instead of “_Point_1”? # -*- coding: utf-8 -*- import gom elements = gom.ElementSelection({ 'category': [ 'key', 'elements', 'part', gom.app.project.parts['Part'], 'explorer_category', 'actual' ] }) selected = [elem for elem in elements if elem.is_selected] for elem in selected: gom.script.selection3d.deselect_all () gom.script.selection3d.select_all_points_of_element(elements=[elem]) MCAD_ELEMENT=gom.script.primitive.create_equidistant_vector_points_on_section ( name=f'{elem.name}_Point', point_distance=106.5, properties=gom.Binary ('eAHEmEtsXNUZx3+GAE4gpAb6EKrakeMW8xh77DgmmYQmDTFK2iRExAQUlY7mce0ZmFdmJnFMlXLTTakUCXXRgti0Eo9NpKAsKh5CIiyQEELJAvEQqIuqlbooFYgNFYKk+n/nHs+d8dhOKkW9lu1z7/3O/3s/zp2uVZIHN44cY9fUT3dOPcB0I1tqNdPpqXJQCaqt/Y1aPWi0SkETd/WxmrVrWMNa1qwF3lxdLRaBQ1O7DxxI7N53YP/UvdOJ8dT4xmhDdJ071c8G239ZVwLITZ471cf3gDUQlsmSI6BMhiZFasxxYf7cqau4AVgFYY4aNcr88rT2GcOwX8s7gJu7IFoEVKgjWK0zHOEIJQp8uFeg3wFWQzhNjQpp0jzIg+ymQPpVYR4CDpp+fewBhiCcIMskATNs4m6yJNnIOGNMkGSCFJvYTJIcBfJssLdZNjNJ3nbk2MiYUf1i/+kTwt0E3Nold54aVaoE5GlRo0GGMiV7kmHONGhR5PFrpYXMeCOE9y7a9dAC5ftfitf3wUyt9Y3ANRA2qZClTJm3H/lsQm9+DAx0SSSzNygQmCwVarZ+Ypv4e+ftiNHsjSjWGa9bwWyttXdk1aQNyHzxa7O11yIeAt3+OzMqft8CrjXJWzTMKrMMfxTH3keWirA/1tMfAGu7kI+aJk1KJkV+UrheMkVIlRYPn9H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Hn+6GWQzjnezZrndwjucoPt+kef3Xvyk5Nn35wb+bp49smzkaK8NHTeThEpN2F3uMO7oR6194wNYD65C3zxxvKK9YUWxz8D1q8I3eQxStStIyjX/CToeoU/vDQ5/EGc6eJRW0pt7xPfXgZ1edypxj+tyqzon16nGgdXp2buVnuXhz758n/xkPPH4suXA5WOdV1mdPzjY+BT31wJ3r1KkeOtcqGGrnOB0/4f1SshwdLObEYjlYvR2jvi7k94BYtfF6/PTMuK7ST/fNuWUE+WTmidk3VKFrIKoYZiBeErvxWPFQNGnWlwmYqqY7CgS9EEn6HETNR9VcMktMyqfBh+4pJY+gOZjieCjbeIv23u5Zd2QezdIm5+r3lx08C/ro5bSq0+y6OReGovahQFe6rxQYVQh4cmOz+/JLF973E6e7ErdrZTl35hu2C8U9XRpV772B71shDLe18a22h+svn708uLExWsraAm1gGgocafxTWQ+rVKkhOnnQEPmbP89yQ/DtxPbsFmi0/me6x1SkV9K4h/Bxuwdj0OfLdDJsWlymM8bJzZ6hyJwubs1uUVjj59LQZ3CaXTifeBU/awff7SqkD2+CWB+7rVdkev+Hn3L8uDEfb/FwAA//8DALwt7oQBJuM='), start_point={'point': gom.Vec3d (0.0, 0.0, 0.0)}, start_point_offset=0.0) print(f"--> geselecteerd: {elem.name} (type={elem.type})") CreatePoints.py Edited 9 hours ago Link to comment Share on other sites More sharing options...
[Mi...] Posted 4 hours ago Share Posted 4 hours ago Hi Jens, I am not sure whether this is supported as part of the mentioned command, but in the mean time you could achieve the desired effect by renaming the new points after they have been created: elem = gom.app.project.actual_elements['Section_1'] gom.script.selection3d.select_all_points_of_element (elements=[elem]) points=gom.script.primitive.create_equidistant_vector_points_on_section ( name=f'{elem.name}_Point', point_distance=3.0) for i in range(len(points)): gom.script.sys.edit_properties (data=[points[i]], elem_name=f'{elem.name}_Point_{i+1:02}') Maybe this works for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in