Jump to content

ATOS V8 SR1 - Possible to identify a newly imported CAD's proxy element through scripting?


---
 Share

Recommended Posts

Hello! I have a question regarding a cleaner way to identify or assign a CAD proxy to a CAD body that has been imported through scripting. I am aware that the concept of CAD proxies was removed in GOM 2018 forward, but unfortunately our facility still uses the V8 SR1 version of the software and we are unable to update at this time.

Problem: In our scan process, we compare our part to two CAD bodies, a purely nominal CAD, and one with desired design modifications. We also create two surface comparisons (one to each CAD). Through scripting, we also import a G3D Mesh of a previous scan of the part, convert that mesh to CAD, and use it to create a third surface comparison. In the script, I can create that third surface comparison by setting "project_element" directly as the newly imported CAD and the surface comparison is created as intended, as shown below where "PrevMeshName" is the name of the imported/converted G3D:

#Create Surface Comparison to Previous Mesh CAD	
	MCAD_ELEMENT=gom.script.comparison.create_multiple_surface_comparison_on_actual (
		deviation_calculation_type='shortest_distance', 
		max_angle_between_normals=1.57079633e+00, 
		max_opening_angle=5.23598776e-01, 
		name=Surface_Compare_Name, 
		project_element=gom.app.project.nominal_elements[PrevMeshName], 
		properties=gom.Binary ('eAHNWE9MHFUY/7C2RSrFtv5pqq0biojiFmgRcVvKFktDjFQtiHjQDewssHH/MTvY0ka7vTVNPHgwWk8aNR4wRQ6N6cUejImmBk6axqtJ44Fg0ouJJl1/v/fmMbPssIDGxJks8+bN937f/+97j8FsOjz09IEz0td77HjvKRm0R5JOPhLpTSXSiYzzkp3NJWwnmciLvqpkk9TWSI3USk0tprr2Lr02gedQZ2jgVFuoL+uMJc+EOlxq7zE/s1WewWuVNyW/zTzgewsaXuXkXvxevDo/UyWPYHSvSCEhKUlIWmISlyyeabxlxJHPo/Mzd8l9oNoCqjxmbEniy7g03eT6u/EFV0Gq+PYghveUoOVlAnin5dcPiANOXFEYxVwWHN+4wlVUoKpwkcMGDMGskJIRGYUIKQg0inFc3gRLG4umwNySr8OEOwnqx0A9iPm0RHCfgHDjclCNX1jG6MEoDzRScLwS7TklTBb4F76jFE3ApSTkUY2nexUmVs6AMvGZWbGzTG4iWuBru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ztO1n/urCW0cr9ZGWP0Dc6+jkyFUhXQEYXq56ph6YDLJxjX9mHjoWTQMHfsXS25BE9jJ14h7/1lTfQKiBEdxDrSYx2ASsHibUW7BVpRNkUpNJtmjM6ChtvEXeje9PZ2dnitpdv7CI/7unqwC8PfBu28vbv+mih+Vj7/gmf/suXi9vb/trm18vPx5wOWAOnwdnT613VjTeqF1RZ3nOH8MJdhMfPApcRdCdPw85Dfq/Qx4GHHB4veFgIhipV4jCOF+vYnpVb3ZNuDHIyZhwZOLousEqqchvCpHh2sTKUu/cyZ4YgVXOQin3KAeAPxX8Nxw06Dc4N//muynDuabPcakY9f+xMLxFs47FTLMqxbx8KzglPd1b4pJyFWX/Eucjbg1pQZcrdpX84SBTvJFodjaiziclt1lmelLkPoQYZhUmf8+zA4ze7y2JybfyPLvO6dt1x/DlWCX8KlYQdy5YvU+vG725X+CY6ND4x2Ne4Q6NVqL+t3j55mMjGW4NKWz/1gI+28SAlZwXlmZZjs6vn3icDTFbvS1+1Ile9f3+wUvOr7u7sxpRjWm7tWVsnsFHXbvkbHEKHLwFmOA=='), 
		search_distance=2.54000000e+01, 
		separated_elements=False, 
		tolerance=1.00000000e-01)

However, a side effect of this is that when another person in our facility examines the ATOS project and wants to "Edit Creation Parameters" of that surface comparison, the comparison automatically snaps to the "all CAD groups" proxy and must be manually corrected to only use the intended CAD. This has led to questions about the accuracy of these comparisons since at first glance when opening the "Edit Creation Parameters" dialog they are set to the wrong element.

Workaround: In an effort to resolve those questions about the accuracy of the comparison to the previous mesh, I looked into creating the surface comparison with the previous mesh's CAD Group proxy counterpart. I know the proxies exist in nominal elements with a sequential naming system like "gom.app.project.nominal_elements['nominal_single_proxy 0']", however as best I could determine, when the G3D was imported and converted to CAD, it's proxy counterpart was not automatically created. I was unable to devise a way to identify or create the proxy within the script. Once the script ends, if I attempt to manually create a surface comparison with the converted G3D CAD, its proxy appears in the nominal element selection list, and can then be identified through scripting in the future, but I needed to identify or assign the proxy without manual intervention. Our scan templates gave me the opportunity to come up with a workaround due to a number of unassigned proxies left over in the templates. I wrote some code to identify one of the unassigned proxies and tie it to the converted G3D CAD, thus giving me a known proxy that I could then use to create the surface comparison as shown below:

#Assign Previous CAD proxy
	ProxyNumbers = []
	for element in gom.app.project.nominal_elements:
		if 'proxy' in str(element):
			if str.casefold('deleted') in str.casefold(element.get('name')):
				ProxyNumbers.append((str(element).split("'")[1]).split(" ")[-1])
	
	OldestProxy = min(ProxyNumbers)
	
	ProxyVar = "proxy " + str(OldestProxy) + "'"
	
	for element in gom.app.project.nominal_elements:
		if ProxyVar in str(element):
			PrevMeshproxy = element
	
	gom.script.cad.assign_cad_proxies (single_proxy_assignment=[{'nominal_proxy': PrevMeshproxy, 'referenced_object': gom.app.project.nominal_elements[PrevMeshName]}])



#Create Surface Comparison to Previous Mesh CAD	
	MCAD_ELEMENT=gom.script.comparison.create_multiple_surface_comparison_on_actual (
		deviation_calculation_type='shortest_distance', 
		max_angle_between_normals=1.57079633e+00, 
		max_opening_angle=5.23598776e-01, 
		name=Surface_Compare_Name, 
		project_element=PrevMeshproxy, 
		properties=gom.Binary ('eAHNWE9MHFUY/7C2RSrFtv5pqq0biojiFmgRcVvKFktDjFQtiHjQDewssHH/MTvY0ka7vTVNPHgwWk8aNR4wRQ6N6cUejImmBk6axqtJ44Fg0ouJJl1/v/fmMbPssIDGxJks8+bN937f/+97j8FsOjz09IEz0td77HjvKRm0R5JOPhLpTSXSiYzzkp3NJWwnmciLvqpkk9TWSI3USk0tprr2Lr02gedQZ2jgVFuoL+uMJc+EOlxq7zE/s1WewWuVNyW/zTzgewsaXuXkXvxevDo/UyWPYHSvSCEhKUlIWmISlyyeabxlxJHPo/Mzd8l9oNoCqjxmbEniy7g03eT6u/EFV0Gq+PYghveUoOVlAnin5dcPiANOXFEYxVwWHN+4wlVUoKpwkcMGDMGskJIRGYUIKQg0inFc3gRLG4umwNySr8OEOwnqx0A9iPm0RHCfgHDjclCNX1jG6MEoDzRScLwS7TklTBb4F76jFE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jFaFBVRddJRx4sgnW1HWdNa9emlW+cmxaTUztO1n/urCW0cr9ZGWP0Dc6+jkyFUhXQEYXq56ph6YDLJxjX9mHjoWTQMHfsXS25BE9jJ14h7/1lTfQKiBEdxDrSYx2ASsHibUW7BVpRNkUpNJtmjM6ChtvEXeje9PZ2dnitpdv7CI/7unqwC8PfBu28vbv+mih+Vj7/gmf/suXi9vb/trm18vPx5wOWAOnwdnT613VjTeqF1RZ3nOH8MJdhMfPApcRdCdPw85Dfq/Qx4GHHB4veFgIhipV4jCOF+vYnpVb3ZNuDHIyZhwZOLousEqqchvCpHh2sTKUu/cyZ4YgVXOQin3KAeAPxX8Nxw06Dc4N//muynDuabPcakY9f+xMLxFs47FTLMqxbx8KzglPd1b4pJyFWX/Eucjbg1pQZcrdpX84SBTvJFodjaiziclt1lmelLkPoQYZhUmf8+zA4ze7y2JybfyPLvO6dt1x/DlWCX8KlYQdy5YvU+vG725X+CY6ND4x2Ne4Q6NVqL+t3j55mMjGW4NKWz/1gI+28SAlZwXlmZZjs6vn3icDTFbvS1+1Ile9f3+wUvOr7u7sxpRjWm7tWVsnsFHXbvkbHEKHLwFmOA=='), 
		search_distance=2.54000000e+01, 
		separated_elements=False, 
		tolerance=1.00000000e-01)

This worked for the time being, as when other users attempted to "Edit Creation Parameters" on the new surface comparison, it now retained the nominal assignment to the converted G3D CAD only, alleviating any accuracy concerns.

New Problem and Needed Solution: Entering next year, there is a massive redesign of our parts that requires new scan templates built from scratch, which means there will be no unassigned proxies left over in the project to utilize this workaround. So I am revisiting this concern and hoping to find a new, cleaner solution that would allow me to either create a new CAD proxy from scratch upon import/conversion of the previous scan G3D, or otherwise identify its existing proxy (that doesn't seem to be automatically created) without manual intervention. Do you have any advice on how to accomplish this?

Thank you!

Link to comment
Share on other sites

 Share

×
×
  • Create New...