Jump to content

Changing required alignments script


---
 Share

Recommended Posts

Keywords:

Name                                          | Description                                                           | Type                                  
--------------------------------------------------------------------------------------------------------------------------------------------------------------
alignment                                     | Alignment                                                             | Tom::Traits::CADAlignmentResult       
alignment_at_calculation                      | Required alignment for calculation                                    | Tom::Reference              

 

seems the alignment_at_calculation is a 'Reference'. I'm having trouble changing it using python.

 

Here is where I am at right now...I can't see to find any syntax to change the alignment_at_calculation.

import gom

gom.script.sys.recalculate_project ()
        
for i in gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts['Part'], 'explorer_category', 'actual', 'object_family', 'geometrical_element', 'type', 'section']}):

    x = i.get('name')
    print(x)
    print(gom.app.project.actual_elements[x].alignment_at_calculation)
    
print(gom.app.project.actual_elements.__doc__)

 

 

Link to comment
Share on other sites

Hello Tim,

here I recorded the change for "Plane 1" first, and then set the alignment per script for "Plane 2":

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

import gom

#gom.script.sys.edit_properties (
#	data=[gom.app.project.actual_elements['Plane 1']], 
#	elem_alignment_ref={'alignment': gom.app.project.alignments['Local Best-Fit'], 'alignment_can_be_used': True, 'rbmc_valid': False})

gom.script.sys.edit_properties (
	data=[gom.app.project.actual_elements['Plane 2']], 
	elem_alignment_ref={'alignment': gom.app.project.alignments['Local Best-Fit'], 'alignment_can_be_used': True, 'rbmc_valid': False})

Nanno

Link to comment
Share on other sites

 Share

×
×
  • Create New...