[TI...] Posted February 10 Share Posted February 10 gom.app.project.actual_elements['DIST_253']: gom.script.sys.edit_creation_parameters ( element=gom.app.project.actual_elements['DIST_253'], point=gom.app.project.inspection['PNT_253-INT']) Is there any python code where I can print out the name of the point in the DIST_253 above? The value I want to print out would be 'PNT_253-INT'. I need to go thru several programs and make sure all the points are a nominal point from the Part and not a white static point in space. Thanks Link to comment Share on other sites More sharing options...
[TI...] Posted February 11 Author Share Posted February 11 (edited) I ran this code: print(gom.app.project.actual_elements['DIST_253'].__doc__) and the printout was this, I don't see what I am looking for, which are the feature names that make up the distance: Object "DIST_138" of type "distance" Keywords: Name | Description | Type ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- abs_distance | Distance (vector), absolute value | Tom::Vec3d abs_distance_view_csys | Distance (vector), absolute value, in viewing coordinate system | Tom::Vec3d active_actual_mesh | Active actual mesh | String active_height | active height | Double active_width | active width | Double actual_master | Actual master | String actual_type_text | actual | String alignment | Alignment | Tom::Traits::CADAlignmentResult alignment | Alignment | Tom::Traits::CADAlignmentResult alignment_at_calculation | Required alignment for calculation | Tom::Reference alignment_for_visualized_report_elements | alignment for visualized report elements | Tom::Traits::CADAlignmentResult allowed_temperature_difference | Allowed temperature difference | Double application_build_information | Application build information | Tom::Traits::ApplicationInformation application_licenses | Application licenses | String application_name | Application name | String application_version | Application version | String are_measurements_aligned | State: Are measurements aligned? | Boolean assembly_tree | CAD assembly tree node | Tom::Reference automatic_exposure_time_mode | Automatic exposure time (mode) | String automatic_exposure_time_photogrammetry_mode | Automatic exposure time photogrammetry (mode) | String automation_move_to_endposition_on_abort | State: Move to end position on abort? | Boolean available_gpu_memory | available gpu memory kb | Double avoid_points_at_strong_brightness_differences | State: Avoid points at strong brightness differences? | Boolean avoid_points_in_shadow_areas | State: Avoid points in shadow areas? | Boolean avoid_points_on_borders_in_scan_area | State: Avoid points on borders in scan area? | Boolean avoid_points_on_groove_edges | State: Avoid points on groove edges? | Boolean avoid_points_on_shiny_surfaces | State: Avoid points on shiny surfaces? | Boolean avoid_triple_scan_points | State: Avoid Triple Scan points? | String avoid_triple_scan_points_at_strong_brightness_differences | State: Avoid Triple Scan points at strong brightness differences? | Boolean cad_conversion_parameter | CAD conversion parameter | Tom::CAD::CadConvertParameter cad_group | CAD group | String cad_import_information | CAD Import information | Tom::Traits::CADImportInformationTrait center_coordinate | Center coordinate | Tom::Vec3d check_decalibrated_sensor | State: Check "Decalibrated sensor"? | Boolean check_lighting_change | State: Check "Lighting change"? | Boolean check_measurement_temperature | State: Check "Measurement temperature"? | Boolean check_missing_reference_points | State: Check missing reference points? | Boolean check_sensor_movement | State: Check "Sensor movement"? | Boolean check_text | check | String check_transformation | State: Check "Transformation"? | Boolean comment | Comment | String computation_error_code | Computation error code | String computation_information | Computation information | String computation_status | Computation status | String connected_project_draft | connected project | Tom::Prj::ConnectedProjectInfo coordinate1 | First coordinate | Tom::Vec3d coordinate2 | Second coordinate | Tom::Vec3d creation_command_is_active | element creation command is active | Boolean creation_sequence | command which was used for creation | String creation_sequence_args | parameters which was used for creation | QVariantMap current_date | Current date | String current_report_page | Current report page | Tom::Reference current_stage_range | Current stage range | String current_user | Current user | String currently_used_gpu_memory | currently used gpu memory kb | Double date_format | Date format | Tom::MSystem::Traits::DateFormatTrait default_directory | Default directory | String default_templates_info_draft | default templates | String dependency_children | Direct dependend children of requesting element | depends_directly_on_elements | Depends directly on elements | depends_on_part_objects_draft | object depends on which assembly groups | QVariantList depth_limitation_mode | Depth limitation mode | String deviation_text | deviation | String dimension_is_shape_related | Dimension is shape-related? | String dimensioning_handle | Dimensioning handle | Tom::CAD::Traits::PullOutTrait direction | Direction | Tom::Vec3d distance | Length | Length element_could_represent_actual_part | is the element able to represent the actual part? | Boolean element_keywords | Element keywords (list of element keywords) | exception_decalibrated_sensor_abort | Exception "Decalibrated": abort? | Boolean exception_decalibrated_sensor_delay | Exception "Decalibrated": delay | Time exception_decalibrated_sensor_number_of_repetitions | Exception "Decalibrated": number of repetitions | Double exception_lighting_change_abort | Exception "Lighting change": abort? | Boolean exception_lighting_change_delay | Exception "Lighting change": delay | Time exception_lighting_change_number_of_repetitions | Exception "Lighting change": number of repetitions | Double exception_measurement_temperature_abort | Exception "Measurement temperature": abort? | Boolean exception_measurement_temperature_delay | Exception "Measurement temperature": delay | Time exception_measurement_temperature_number_of_repetitions | Exception "Measurement temperature": number of repetitions | Double exception_sensor_movement_abort | Exception "Sensor movement": abort? | Boolean exception_sensor_movement_delay | Exception "Sensor movement": delay | Time exception_sensor_movement_number_of_repetitions | Exception "Sensor movement": number of repetitions | Double exception_transformation_abort | Exception "Transformation": abort? | Boolean exception_transformation_delay | Exception "Transformation": delay | Time exception_transformation_number_of_repetitions | Exception "Transformation": number of repetitions | Double explorer_category | Explorer category | String explorer_tooltip | explorer tooltip | String explorer_type_and_lock | explorer type and lock | String explorer_type_and_state | explorer type and state | String first_measurement_date | Date of first measurement | String first_measurement_time | Time of first measurement | String gdat_tolerance_table | GD&T tolerance table | Tom::CAD::Traits::ToleranceTable general_tolerance_table | General tolerance table | Tom::CAD::Traits::ToleranceTable gom_collision_check_since_load_import_copy_draft | GOM: is a collision check computed since the last project load, import or element copy? (used in test scripts only) | Boolean group_elements | Group elements | Tom::Reference group_membership | to which groups does this object belong to | QVariantList groups_created_on_element | Groups based on this element | Tom::Reference home_directory | Home directory | String icon (explorer_type_and_state) | Object type and state icon | Tom::Expression::ScaledIcon icon (type) | Object type icon | Tom::Expression::ScaledIcon identify_reference_point_sizes_automatically | State: Identify reference point sizes automatically | Boolean import_file | Import file | String import_file_name | Import file name | String import_information | Import information | Tom::Traits::ImportInformationTrait imported_name | Name (imported) | String inspections_not_in_reports | Inspection elements (list) - not in reports | inspections_out_of_tolerance | Inspections out of tolerance on this element (element list) | is_auto_recalc_enabled | State: Is automatic recalculation for visible elements enabled? | Boolean is_auto_recalc_for_stages_enabled | State: is automatic recalculation for visible elements in all stages enabled? | Boolean is_element_in_clipboard | State: Is element in clipboard? | Boolean is_element_modified_since_import | State: is element modified since import? | Boolean is_global_csys_view_csys | State: Is global coordinate system used for viewing? | Boolean is_inspection_from_v7sr2 | is the inspection in this project from the old v7sr2 workflow? | Boolean is_label_visible | State: Is label visible? | Boolean is_modified | GOM: is_modified | Boolean is_modified_after_loading | GOM: is_modified_after_loading | Boolean is_name_generated | State: Is name generated? | Boolean is_part_project | State: Is this a "part project"? | Boolean is_quality_triple_scan_points_checked | State: Is quality Triple Scan points checked? | Boolean is_referenced_in_inspection | State: Is referenced in inspection element? | Boolean is_selected | State: Is element selected? | Boolean is_system_element | State: Is system element? | Boolean is_visibility_locked | State: Is visibility state locked? | Boolean is_visible | State: Is element visible? | Boolean kiosk_mode | Kiosk mode | Boolean label | Label information | Tom::CAD::Traits::LabelInfo label_offset_in_3d_view | Label offset in 3D view | Tom::Vec3d language | Software language | String last_measurement_date | Date of last measurement | String last_measurement_time | Time of last measurement | String legend | Legend | Tom::Legend2::LegendInfo local_all_directory | local config directory for all users | String max_reference_points_depth_limitation | Max. depth limitation reference points | Length max_residual | Max. residual | Double max_residual_edge_point_adjustment | Max. residual edge point adjustment for scanning | Double max_residual_edge_point_adjustment_for_photogrammetry | Max. residual edge point adjustment for photogrammetry | Double max_residual_gray_value_adjustment | Max. residual gray value adjustment for scanning | Double max_residual_gray_value_adjustment_for_photogrammetry | Max. residual gray value for photogrammetry | Double max_scan_surface_depth_limitation | Max. depth limitation scan surface | Length max_sensor_movement | Max. sensor movement | Double max_viewing_angle_sensor_surface | Max. viewing angle sensor/surface | Angle measurement_alignment_prior_sw2018 | Measurement alignment computed before sw2018 | Length measurement_alignment_residual | Alignment residual (measurements) | Length measurement_alignment_residual_diff_too_high | Alignment residual difference too high (measurements) | Boolean measurement_mesh_alignment_residual | Alignment residual (preview meshes) | Length measurement_reference_point_alignment_residual | Alignment residual (reference points) | Length measurement_resolution | Measurement resolution | String measurement_temperature | Measurement temperature | Temperature measurement_transformation_type | Measurement transformation type | String measuring_task_project_building_block_draft | Digitizing and inspection module | Tom::Prj::ProjectBBlockInfo memory_information | Memory information | Tom::MCADBase::MemoryInfo min_ellipse_contrast_for_photogrammetry | Min. ellipse contrast for photogrammetry | Double min_ellipse_contrast_for_scanning | Min. ellipse contrast for scanning | Double min_ellipse_radius | Min. ellipse size for scanning | Double min_ellipse_radius_for_photogrammetry | Min. ellipse size for photogrammetry | Double min_fringe_contrast | Min. fringe contrast | Double min_reference_points_depth_limitation | Min. depth limitation reference points | Length min_scan_surface_depth_limitation | Min. depth limitation scan surface | Length name | Name | String name | Name | String name_expression | name expression | String nominal_element_names | Name of nominal elements which referring this element as actual | String norm (direction) | Normalized direction | Tom::Vec3d number_of_date_formats | Number of date formats | Double number_of_exposure_times | Number of exposure times | Double object_family | Object family | String observe_gray_value_feature | State: Observe gray value feature? | String online_measurement_prognosis | online measurement prognosis | String overview_explorer_alignments | alignment name of element for the overview explorer | overview_explorer_alignments | alignment name of element for the overview explorer | overview_explorer_computation_alignment | computation alignment for the overview explorer | String overview_explorer_computation_information | computation information for the overview explorer | String overview_explorer_coordinate_system | elements using evaluation coordinate system for the overview explorer | overview_explorer_tacked_to_element | elements that are tacked to other elements for the overview explorer | package_database_info_draft | package database | String package_information | Package information | Tom::MPRJ::PackageInformation package_update_info_draft | package update information | String part | Part | String photogrametry_project_building_block_draft | Photogrammetry module | Tom::Prj::ProjectBBlockInfo project_building_block_type_draft | Automation module type | String project_building_block_uuid_draft | Automation module unique identifier | String project_contains_preliminary_data | State: Project contains preliminary data? | Boolean project_creation_time | Project creation time | String project_data_reduction | Project data reduction | String project_file | Project file | String project_file_size | Project file size | String project_history | GOM: Save Project History | String project_keywords | Project keywords (list of project keywords) | project_licenses | Project licenses | String project_modification_time | Project modification time | String project_name | Project name | String project_statistics | Project statistics | Tom::Prj::StatisticData project_template_directory | Project template directory | String public_directory | Public directory | String public_package_directory | Package directory (public) | String python_directory | Python directory | String quality_triple_scan_points_mode | Quality check Triple Scan points | String quality_triple_scan_points_threshold | Threshold for quality Triple Scan points | Double recent_reasons | recent reasons | Double reduce_influence_of_border_areas | State: Reduce influence of border areas for polygonization? | Boolean reference_point_identification_method | Method for reference point identification for scanning | String reference_point_identification_method_for_photogrammetry | Method for reference point identification for photogrammetry | String reference_point_identification_settings | Reference point identification settings for scanning | String reference_point_identification_settings_for_photogrammetry | Reference point identification settings for photogrammetry | String reference_point_size | Reference point size | Length reference_point_thickness | Reference point thickness | Length reference_point_type | Reference point type | String reference_points_collection_type | Type of reference point collection | String reference_stage | Reference stage | Tom::Traits::StageTimelineInfo reflection_detection | Reflection detection | String render_complete_draw_time | render complete draw time | Double render_driver_version | render driver version | String render_gpu_type | render gpu type | String render_scene_graph_update_time | render_scene_graph_update_time | Double render_use_gpu_memory | render use gpu memory | Boolean render_use_transparency | render use transparency | Boolean rendered_frames | rendered frames | Double rendered_overlay_2d_frames | rendered overlay 2d frames | Double rendered_overlay_3d_frames | rendered overlay 3d frames | Double rendered_scene_layer_frames | rendered scene layer frames | Double rendered_temp_layer_frames | rendered temp layer frames | Double rigid_body_motion_compensation_at_calculation | Required rigid body motion compensation for calculation | Tom::Reference robogrammetry | State: Robogrammetry? | Boolean scalar_registry_info | scalar registry | String scan_area_avoid_direct_reflections | State: Avoid direct reflections (scan area)? | Boolean scan_area_avoid_fixture | State: Avoid fixture (scan area)? | Boolean scan_area_direct_reflections_angle | Angle (Avoid direct reflections in scan area) | Double scan_area_offset | Offset (scan area) | Double scan_area_restricted_to_cad | State: Restricted to CAD (scan area)? | Boolean scan_area_usage | mask generation mode | String scan_data_avoid_direct_reflections_angle | Angle (Avoid direct reflection in scan data) | Angle scanning_template | Scanning template | Tom::Prj::ApplicationTemplateInfo selection_arg_base | base elements for selection argument | String selection_arg_target | target elements for selection argument | String skin | Skin | Tom::MPRJ::SkinInfo software_directory | Software directory | String stage | Stage | Tom::Traits::StageTimelineInfo system_package_directory | Package directory (system) | String table | Table | Tom::MPRJ::TableInfo tags | Tags (list of element tags) | temp_directory | Temporary directory | String template | Template information | Tom::Prj::TemplateInfo template_database_info_draft | template database | String template_info_draft | template info | String template_name | Template name | String template_package_draft | template package | Tom::PackageReference template_uuid | Template UUID | Tom::UUId tol_extrema_level | Extrema level | Double tol_neg_extrema_color | Color for 'Neg. extrema' | String tol_neg_extrema_text | Text for 'Neg. extrema' | String tol_neg_fail_color | Color for 'Neg. fail' | String tol_neg_fail_text | Text for 'Neg. fail' | String tol_neg_pass_color | Color for 'Neg. pass' | String tol_neg_pass_text | Text for 'Neg. pass' | String tol_neg_warn_color | Color for 'Neg. warn' | String tol_neg_warn_text | Text for 'Neg. warn' | String tol_novalue_color | Color for 'Missing values' | String tol_novalue_text | Text for 'Missing values' | String tol_pos_extrema_color | Color for 'Pos. extrema' | String tol_pos_extrema_text | Text for 'Pos. extrema' | String tol_pos_fail_color | Color for 'Pos. fail' | String tol_pos_fail_text | Text for 'Pos. fail' | String tol_pos_pass_color | Color for 'Pos. pass' | String tol_pos_pass_text | Text for 'Pos. pass' | String tol_pos_warn_color | Color for 'Pos. warn' | String tol_pos_warn_text | Text for 'Pos. warn' | String tol_unused_color | Color for 'Unused values' | String tol_unused_text | Text for 'Unused values' | String tol_warning_level | Warning level | Double transformation_category | Transformation category | String type | Object type | String undo_is_history_complete | undo is history complete | Boolean undo_num_redo_steps | undo num redo steps | Double undo_num_undo_steps | undo num undo steps | Double unit_acceleration | Acceleration unit | String unit_angle | Angle unit | String unit_angle_acceleration | Angular acceleration unit | String unit_angle_velocity | Angular velocity unit | String unit_area | Area unit | String unit_count | Amount | String unit_curvature | Curvature | String unit_density | Density | String unit_exposure_time | Exposure time unit | String unit_force | Force | String unit_fraction | Ratio | String unit_length | Length unit | String unit_mass | Mass | String unit_no_unit | Values without unit | String unit_no_unit_acceleration | 2nd derivative of values without unit | String unit_no_unit_velocity | 1st derivative of values without unit | String unit_power | Power | String unit_rate | Frame rate | String unit_report | Report unit | String unit_statistics_cp | Statistic values cp, pp, cpk, ppk | String unit_strain | Technical/Green's strain unit | String unit_strain_acceleration | Technical/Green's strain acceleration unit | String unit_strain_rate | Technical/Green's strain rate unit | String unit_temperature | Temperature unit | String unit_time | Time unit | String unit_true_strain | True strain unit | String unit_true_strain_acceleration | True strain acceleration unit | String unit_true_strain_rate | True strain rate unit | String unit_velocity | Velocity unit | String unit_voltage | Voltage | String unit_volume | Volume unit | String use_reference_point_size | State: Use reference point size? | Boolean use_user_defined_reference_point_size | State: Use user-defined reference point size? | Boolean used_gdat_tolerances | Used standard "GD&T tolerances" (tolerance table) | String used_general_tolerances | Used standard "General tolerances" (tolerance table) | String user_charge_nr | Charge no. | String user_company | Company | String user_ct | CT | String user_date | Date | String user_defined_reference_point_color | User-defined reference point color | String user_defined_reference_point_size | User-defined reference point size | Length user_defined_reference_point_thickness | User-defined reference point thickness | Length user_defined_reference_point_type | User-defined reference point type | String user_department | Department | String user_inspector | Inspector | String user_local_directory | local user config directory | String user_location | Location | String user_package_directory | Package directory (user) | String user_part | Part | String user_part_nr | Part no. | String user_pn | PN | String user_project | Project | String user_roaming_directory | roaming user config directory | String user_system | System | String user_version | Version | String uuid_draft | Object UUID | String vdi_base_name | base name for vdi test elements | String view_csys | Viewing coordinate system | Tom::Reference viewport_height | viewport height | Double viewport_width | viewport width | Double views | Views | Tom::GRTProxy::Traits::CamerasTrait visible_views | currently visible views | vmr_project_building_block_draft | VMR module | Tom::Prj::ProjectBBlockInfo workspace | Active workspace | String Edited February 11 Link to comment Share on other sites More sharing options...
[De...] Posted Tuesday at 06:01 PM Share Posted Tuesday at 06:01 PM Hey Please sign in to view this username. You working with an actual distance, but using a nominal point? you also mentioned you want to make sure the nominal pt is attached to the part? - you can use the function Operations--> element --> Adapt Element to CAD to snap a floating nominal pt to CAD. but, to your question: there's a 'creation_sequence_args' you 'might' be able to use.... you can also try to select the element in the explorer and get the 'related' elements. Unfortunately I don't think there's a way to grab those related elements without using the 'apply_selection' function first, but it should get you what you want. print('Related Elements to Actual Element:') gom.script.explorer.apply_selection(selection=gom.app.project.actual_elements['Distance 1']) for i in gom.ElementSelection ({'category': ['key', 'related']}): print("\t", i) nominal_distance = gom.app.project.inspection['Distance 1'] print(f"\nCreation Sequence for Nominal {nominal_distance.name}\n\t{nominal_distance.creation_sequence_args}\n") try: creation_pt = nominal_distance.creation_sequence_args.get('point') print(f"{creation_pt}\n\tType: {creation_pt.type}") except Exception as Err: print(Err) """ PRINTS: Related Elements to Actual Element: gom.app.project.parts['Xxxxx'].actual gom.app.project.actual_elements['Point 1'] gom.app.project.inspection['Point 1'] gom.app.project.inspection['Distance 1'] gom.app.project.parts['Xxxxx'].original_alignment Creation Sequence for Nominal Distance 1 {'point': gom.app.project.inspection['Point 1'], 'project_onto': <Trait: gom.Projection>} gom.app.project.inspection['Point 1'] Type: inspection_surface_point """ hope it helps. Link to comment Share on other sites More sharing options...
[TI...] Posted 15 hours ago Author Share Posted 15 hours ago Thanks...That is pretty much what I was looking for, but it isn't working as intended b/c it is not showing me that a static point in space was selected as seen in the white static point below: The outputs from your script are: Related Elements to Actual Element: gom.app.project.inspection['PLN_118-1'] gom.app.project.inspection['PLN_118-3'] gom.app.project.actual_elements['PLN_118-3'] gom.app.project.inspection['ITEM_118_DIST_1'] gom.app.project.inspection['DIST_118-1'] gom.app.project.reports['report 3'] gom.app.project.reports['report 1'] gom.app.project.alignments['AGE'] gom.app.project.parts['Part'].original_alignment gom.app.project.alignments['Prealignment'] So it is showing that PLN_118-1 is being used, but I was hoping it was going to show 'PLN_118-1 (-0.178575, 0.000, 0.000)', which is not the proper element to use for the point on a distance. It doesn't float, the person I'm training has made a few of these errors and I want a script to catch this. If you click the plane as your point of reference it creates a white static point in space, but fools a beginner into thinking you are doing the distance to a point on that plane, when in fact it is a static point in space and will never change. I don't like that the software allows for this. It was the first thing I teach anyone in GOM...do not have white stuff in your outputs. I do think that I can script something where if the first element has 'PLN' in the name it flags it as a possibly incorrectly constructed distance for review. We are diligent with our naming conventions so in my opinion the first element for us should start with 'PNT'. I'll construct something and let you know how it worked. Thanks for the help. Link to comment Share on other sites More sharing options...
[TI...] Posted 15 hours ago Author Share Posted 15 hours ago Yea...I think this is going to work for us with the following code, I'm breaking out of the for loop b/c the first related element is the point and that is all I care about: for i in gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts['Part'], 'explorer_category', 'nominal', 'object_family', 'dimension', 'type', 'inspection_dimension_3d']}): distance_name = i.get('name') if 'DIST' in distance_name: gom.script.explorer.apply_selection(selection=gom.app.project.actual_elements[distance_name]) for i in gom.ElementSelection ({'category': ['key', 'related']}): point_name = i.get('name') print(f'{distance_name} : {point_name}') if 'PLN' in point_name: print('-------------------------------------------------------------------------------') print(f'Warning there could be a Plane used as a point in a distance for: {distance_name}') print('-------------------------------------------------------------------------------') break And that output these results for me: DIST_118-1 : PLN_118-1 ------------------------------------------------------------------------------- Warning there could be a Plane used as a point in a distance for: DIST_118-1 ------------------------------------------------------------------------------- DIST_118-2 : PNT_118-FITTING-2 DIST_118-3 : PNT_118-FITTING-1 DIST_118-4 : PNT_118-FITTING-2 DIST_129-1 : PNT_129-TOUCH-1 DIST_129-2 : PNT_129-TOUCH-2 DIST_205-1 : PNT_205-END-1 DIST_205-2 : PNT_205-END-2 DIST_205-3 : PNT_205-END-3 DIST_205-4 : PNT_205-END-4 DIST_223-1 : PNT_222-INT-1 DIST_223-2 : PNT_222-INT-2 DIST_223-3 : PNT_222-INT-3 DIST_223-4 : PNT_222-INT-4 Thanks for the help. 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