Jump to content

How to get the 3d position of a label?


---
 Share

Recommended Posts

Good morning to all,

I have to get the position in the active 3d view of a label. With a dn label this is possible, but with a normal label it seems that it's not possible (the result is None). I am wrong with something?

image.png.e6886dc929d86efd581339251bf29a84.pngimage.png.07384628fc069dd9b34e4fbc68d23c0a.png

Link to comment
Share on other sites

If found the bug: if you just visualize the label, the offset posizion in 3d view is None, if you move the label the property "label_offset_in_3d_view" start to work. I attach a video about this that I think i't a bug.

Link to comment
Share on other sites

Hi Marco,

Which version (incl. service-pack) of ZEISS INSPECT are you using?

Thank you and best regards,

Matthias

 

Link to comment
Share on other sites

Hi Nanno! My goal is to take the vector and the position in the 3dview of a dn label then create a normal deviation label in the same position of the dn label. Do you know the right way to do it? 

Link to comment
Share on other sites

hey marco, to clarify - you want a nominal surface point with dn check instead of a deviation label on the surface comparison? 

 

import gom
import numpy as np

gom_part = gom.app.project.parts[0]
label = gom.app.project.inspection['Surface comparison 2'].deviation_label['Surface comparison 2.1']
coord = np.array(label.data.coordinate)
normal = np.array(label.data.normal)

x,  y,  z  = coord.reshape(-1)
nx, ny, nz = normal.reshape(-1)

gom.script.cad.show_element_exclusively (elements=gom.ElementSelection ({'category': ['key', 'elements', 'part', gom_part, 'explorer_category', 'nominal_part']}))
##nominal surface pt
nominal_surface_pt = gom.script.primitive.create_surface_point (
	name_expression='Point_from_label', 
	point={'interpolated': True, 'normal': gom.Vec3d (nx, ny, nz), 'point': gom.Vec3d (x,y,z), 'target': gom_part})

##make sure its attached to cad surface
gom.script.cad.adapt_elements_to_cad (
	elements=[nominal_surface_pt], 
	normal_from_cad=True, 
	position_from_cad=True)

##mp
MCAD_ELEMENT=gom.script.inspection.measure_by_intersection_with_mesh (
	elements=[nominal_surface_pt])
#check	
MCAD_ELEMENT=gom.script.inspection.inspect_dimension (
	csys=gom.app.project.nominal_elements['system_global_coordinate_system'], 
	elements=[nominal_surface_pt], 
	nominal_value=0.0, 
	nominal_value_source='fixed_value', 
	type='normal')

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...