Subobjects selection located at exact coordinate

Subobjects selection located at exact coordinate or coordinate range, like select all vertexes in Z: from 0.0 to 0.1. In this case I need to select all the flat surface of the mountains object.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
biwaaniya's picture

If you are not familiar with

If you are not familiar with sub object selection, you can select it by holding [ctrl] and click your mouse. The most common sub object I use in the past is vertex. If you select an object without activating any tool, then you will see the object’s vertices.

barigazy's picture

mxs

Or download attachment

AttachmentSize
bga_selectsubsbyrange.ms 2.06 KB

bga

barigazy's picture

...

editable poly object?

bga

Duka0's picture

yes

yes

barigazy's picture

...

Here we go (copy this in MXS Editor and save it as *.ms)

try(destroyDialog ::xxxRoll)catch()
rollout xxxRoll "Select Subs By Range"
(
	fn inBetween val axis vmin: vmax: = 
	(
		case axis of
		(
			1: val.x > vmin and val.x < vmax
			2: val.y > vmin and val.y < vmax
			3: val.z > vmin and val.z < vmax
		)
	)
	fn selectInRange sub:1 axis:1 minval: maxval: range:on = if selection.count > 0 do
	(
		local selectSub = if sub == 1 then polyop.setVertSelection else polyop.setFaceSelection
		local getPos = if sub == 1 then polyop.getVert else polyop.getFaceCenter
		with redraw off for node in selection where isKindOf node Editable_poly do
		(
			object = #{}
			number = if sub == 1 then node.numverts else node.numfaces
			for i = 1 to number do
			(	
				e = getPos node i
				if range then (if inBetween e axis vmin:minval vmax:maxval do append object i) else
				(
					e = case axis of
					(
						1: e.x
						2: e.y
						3: e.z
					)
					if e == minval do append object i
				)
			)
			selectSub node object
		)
	)
	spinner spn_min "min: " pos:[3,3] range:[1e-9,1e9,0] fieldwidth:100
	checkbox cb_usemax "" pos:[140,3] width:15
	spinner spn_max "max: " pos:[155,3] range:[1e-9,1e9,10] fieldwidth:100 enabled:off
	label lbl_axis "Axis:" pos:[3,23]
	radiobuttons rb_axis "" pos:[30,23] labels:#("X","Y","Z") columns:3 default:3
	label lbl_sub "SubLevel:" pos:[140,23]
	radiobuttons rb_sub "" pos:[195,23] labels:#("Verts","Faces") columns:2
	button btn_doit "DOIT" pos:[297,3] width:35 height:35
	on cb_usemax changed state do spn_max.enabled = state
	on btn_doit pressed do 
	(
		if GetCommandPanelTaskMode() != #modify do SetCommandPanelTaskMode #modify
		selectInRange sub:rb_sub.state axis:rb_axis.state minval:spn_min.value maxval:spn_max.value range:cb_usemax.checked
		subobjectlevel =  if rb_sub.state == 1 then 1 else 4
	)
)
createDialog xxxRoll 335 40 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.