Jump to content

Extracting Cluster Components Using a Script


---
 Share

Recommended Posts

Hello,

I'm developing a script that takes an existing cluster as input. However, I'm struggling to find a reliable way to retrieve the list of elements that belong to that cluster within the script. The only alternative I can think of is searching by name, since the cluster elements are automatically renamed with the cluster name as a prefix. Still, this approach doesn't seem robust enough. Do you know of any keyword or method that could help in this situation? I've tried keywords like dependency_children and dependency_elements, but without success.

Thanks in advance

Edited
Link to comment
Share on other sites

  • [Ir...] changed the title to Extracting Cluster Components Using a Script

Cluster? What i can imagine what it is, what it contains and how it's defined? Maybe we can find something 🙂

Link to comment
Share on other sites

When you create a cluster, you add a list of elements, see the image attached as an example:

image.png.fe2115d38175cd0038da861e5a3c47a6.png

The script I'm working on assumes that the cluster has already been created, and the only input it receives is the system associated with the cluster (the reference system that is generated when the cluster is created). Based on that information, is there any way to retrieve all the elements from the cluster's creation list?

Link to comment
Share on other sites

Hello,

see Tech Guide: How to Evaluate Clusters for an introduction.

Selecting elements in scripts — App Development Documentation also works for clusters:

import gom

# Print clusters
elements=gom.ElementSelection (
	{'category': ['key', 'elements', 'explorer_category', 'clusters']}
)

print("=== Clusters ===")
for element in elements:
	print(element)

Example:

=== Clusters ===
gom.app.project.inspection['Cluster 1']
gom.app.project.inspection['Coordinate system 1 (1) (2)']
gom.app.project.inspection['Coordinate system 1 (2) (1)']
gom.app.project.inspection['Coordinate system 1 (2) (2)']
gom.app.project.inspection['Coordinate system 1 (3) (1)']
gom.app.project.inspection['Coordinate system 1 (3) (2)']

 

To see elements related to a specific cluster:

# Print elements related to Cluster 1 
elements = gom.ElementSelection (
	{'category': ['key', 'related']},
	filter = {'param': 'Cluster 1', 'type': 'by_name' }
)

print("=== Cluster 1 - related ===")
for element in elements:
	print(element)

Example:

=== Cluster 1 - related ===
gom.app.project.actual_elements['Cluster 1.Point 1']
gom.app.project.inspection['Cluster 1.Point 1']
gom.app.project.inspection['Cluster 1.Point 1.dIP']
gom.app.project.inspection['Cluster 1.Point 1.X']
gom.app.project.inspection['Cluster 1.Point 1.Y']

 

Best regards,

Matthias

Link to comment
Share on other sites

Thank you very much for your response. I’m reviewing the link you shared about cluster evaluation, and another question came up.

image.png.b1c78e3bbef354b409c479a2fcceff14.png

The "Clusters" field doesn’t appear in my explorer. Could this be due to the version of ZEISS Inspect I’m using?

image.png.d7fcf5ce1aca4772a001f8cd0a99e541.png

Link to comment
Share on other sites

 Share

×
×
  • Create New...