Jump to content

How to rename element in clipboard


---
 Share

Recommended Posts

Hello GOM team,

I have to copy a stage, put it in cliipboard and then rename it with the original stage name. In the image example I have to rename the element in clipboard as "12016229_220324_Figura_1". I have written the code to copy all stages, but I have to implemate it with the renaming part.

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

import gom



gom.script.manage_alignment.set_alignment_active (cad_alignment=gom.app.project.alignments[1])

gom.script.sys.recalculate_project (with_reports=False)


for g in gom.app.project.stages:
	print(g.name)
	
	gom.script.sys.copy_to_clipboard (elements=gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts[0], 'explorer_category', 'actual_part']}))
	
	gom.script.sys.paste_from_clipboard (destination=gom.ElementSelection ({'category': ['key', 'elements', 'part', gom.app.project.parts[0], 'explorer_category', 'actual_part']}))
	

Thank you very much.

 

CopyQ.SCNwUf.png

Link to comment
Share on other sites

I found the solution:

gom.script.sys.edit_properties (
		data=[gom.app.project.parts['Part'].actual], 
		elem_name=gom.app.project.stage[0])

and then copy and past in clipboard.

Link to comment
Share on other sites

 Share

×
×
  • Create New...