Jump to content

How to select alignments in a dialog selection element


---
 Share

Recommended Posts

Hello,

I have to realize a script and in this script I have to let make a choice to the operator between the alignments that exist in the project. I think it's achievable using the selection element, but I don't know how to filter by "Alignments". I found this code https://connect.gom.com/download/attachments/47554317/dialog_custom_elem_select.py?version=1&modificationDate=1602509177000&api=v2 but I don't know how to adapt it for filter the alignments in my project. Thank you very much for any help!

Link to comment
Share on other sites

No one has a solution? I've also tried with this code, but it doesn't work:

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

import gom

DIALOG4=gom.script.sys.create_user_defined_dialog (content='<dialog>' \
' <title>Demo "New selection element"</title>' \
' <style></style>' \
' <control id="OkCancel"/>' \
' <position></position>' \
' <embedding></embedding>' \
' <sizemode></sizemode>' \
' <size height="113" width="220"/>' \
' <content columns="2" rows="1">' \
'  <widget columnspan="1" rowspan="1" type="label" row="0" column="0">' \
'   <name>label_6</name>' \
'   <tooltip></tooltip>' \
'   <text>New</text>' \
'   <word_wrap>false</word_wrap>' \
'  </widget>' \
'  <widget columnspan="1" rowspan="1" type="input::point3d" row="0" column="1">' \
'   <name>input_new</name>' \
'   <tooltip></tooltip>' \
'   <supplier>custom</supplier>' \
'  </widget>' \
' </content>' \
'</dialog>')

def dialog_event_handler (widget):
	pass

# filter system planes
def element_filter( element ):
	try:
		if element.type in ['alignments']: 
			return True
	except Exception as e:
		pass
	return False

DIALOG4.handler = dialog_event_handler
DIALOG4.input_new.filter = element_filter

RESULT=gom.script.sys.show_user_defined_dialog (dialog=DIALOG4)

Someone can help me? Thank you very much

Link to comment
Share on other sites

Hi Marco,

with the filter part like this it showed me the alignments:

# filter 
def element_filter( element ):
	try:
		if element.type == 'transformation_object': 
			return True
	except Exception as e:
		pass
	return False

Out of interest, what is the background of this script?

Regards,
Nanno

Link to comment
Share on other sites

Thank you Nanno! Where I can find a list of the variables I can use? Because I tried with 'alignments', 'Alignments', 'alignments_name' and many many more, I think I never thought of 'transformation_object' 😄

I have to automate the complete control of a sampling: open the ginspect of the previous step of tool adjustment (CAD comparison), make the same control for the actual sample and then, automatically, make the comparison between the actual and the previous step parts. And the choice of the alignment is important for let the operator choice the alignment to use when the script update the report page with the mesh-mesh comparison.

I hope I explained myself.

Link to comment
Share on other sites

Hello Marco,

I pressed F2 in the script editor and filtered  for "type" when an alignment was selected.

Couldn't you define the desired alignment on a report page with the mesh-mesh-comparison?

Regards,
Nanno

Link to comment
Share on other sites

Thank you very much Nanno! I don't understand what do you mean with "define the desired alignment on a report page with the mesh-mesh-comparison", but my goal is obtained. Thank you very very much!

Link to comment
Share on other sites

Hello Marco,

you can create the inspection as you want, for example in a stage project with the alignment you need, the mesh to inspect etc. and create a report page. It will automatically update when you import new meshes into the project, so as I understand it this could be inspected without scripting.

Regards,
Nanno

Link to comment
Share on other sites

 Share

×
×
  • Create New...