Jump to content

[Python Script] Error in single element transformation in a stage project


---
 Share

Recommended Posts

Hello to all,

I have a problem: I want to shift every stage in a project in Z using the single element transformation alignment, but if I try to run it, it correctly works for the first stage, but from the second stage it doesn't work and appear the message:

Error MCADTool-C022:
The alignment cannot be computed in the stage in which you defined it.
Error in line 25: Error in stages 1

This is the code I used:

# -*- coding: utf-8 -*-

import gom

a=(len(gom.app.project.stages))
for n in range (a):
	print (n)
	print (a)
	gom.script.sys.show_stage (stage=gom.app.project.stages[n])
	z_trans=int(n)*(-200)
	print (z_trans)
	CAD_ALIGNMENT=gom.script.transform_element.set_matrix (
		alignment_stage_creation_policy='same_alignment_for_each_stage', 
		csys=gom.app.project.nominal_elements['system_global_coordinate_system'], 
		definition_stage={'absolute_range': 1.0, 'proxy_relative': True, 'relative_position': 0.0, 'stage': gom.app.project.stage_proxies['actual_active_ref_stage']}, 
		elements=gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts[0], 'explorer_category', 'actual_part']}), 
		invert_transformation=False, 
		rotation_direction='clockwise', 
		rotation_mode='X-Y-Z', 
		rotation_x=0.0, 
		rotation_y=0.0, 
		rotation_z=0.0, 
		translate_x=0.0, 
		translate_y=0.0, 
		translate_z=z_trans)

And the message:

CopyQ.gyrLdb.png.37e771b75cb427fa08a1e54b0132ebbb.png

How can I resolve it?

Thank you in advance!

Link to comment
Share on other sites

 Share

×
×
  • Create New...