Select by dimension X,Y or Z

Hi! Please, help with a simple script. I have 10 grouped objects in a line with different dimension. I need to select obejects from goups with exect parameter. Function like SELECT SIMILAR, but BY DIMENSION. I'll try to explain the sequence of commands:

1. Select all objects in the viewport, but only those whose scale X > 200mm
2. Select all objects in the viewport, but only those whose scale Y < 300mm
3. Select all objects in the viewport, but only those whose scale Z = 400mm
OR
1. Select all objects in the viewport, but only those whose Dimension X > 200mm
2. Select all objects in the viewport, but only those whose Dimension Y < 300mm
3. Select all objects in the viewport, but only those whose Dimension Z = 400mm

Thank you all for your help in advance!

Comments

Comment viewing options

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

I have screenshots:.. I need

I have screenshots:..

I need little script. First button to select only vertical object and second button to select only horizontal objects.

AttachmentSize
002.jpg 279.01 KB
003.jpg 284.26 KB

EPXLSD

miauu's picture

.

Try this:

(
	global rol_selObjects
	try(destroyDialog rol_selObjects)catch()
	rollout rol_selObjects " Sel. Obj."
	(
		group "X size"
		(
			checkBox chkBox_xLessThan "<" tooltip:"Less than"
			spinner spn_xSize "" range:[0,1e9,200] type:#worldunits offset:[-30,-20]
			checkBox chkBox_xGreaterThan ">" offset:[100,-20] tooltip:"Greater than"
		)
		group "Y size"
		(
			checkBox chkBox_yLessThan "<" tooltip:"Less than"
			spinner spn_ySize "" range:[0,1e9,300] type:#worldunits offset:[-30,-20]
			checkBox chkBox_yGreaterThan ">" offset:[100,-20] tooltip:"Greater than"
		)
		group "Z size"
		(
			checkBox chkBox_zLessThan "<" tooltip:"Less than"
			spinner spn_zSize "" range:[0,1e9,400] type:#worldunits offset:[-30,-20]
			checkBox chkBox_zGreaterThan ">" offset:[100,-20] tooltip:"Greater than"
		)
 
		button btn_select "SELECT" width:140
 
		function GetObjectSize o =
		(
			objLocalBBox = nodeLocalBoundingBox o
			tm = o.objecttransform
			bmin = objLocalBBox[1]*(inverse tm) 
			bmax = objLocalBBox[2]*(inverse tm)
			bbox_size = objLocalBBox[2] - objLocalBBox[1]
		)
 
		on chkBox_xLessThan changed state do
		(
			if state do chkBox_xGreaterThan.state = false
		)
		on chkBox_xGreaterThan changed state do
		(
			if state do chkBox_xLessThan.state = false
		)
		on chkBox_yLessThan changed state do
		(
			if state do chkBox_yGreaterThan.state = false
		)
		on chkBox_yGreaterThan changed state do
		(
			if state do chkBox_yLessThan.state = false
		)
		on chkBox_zLessThan changed state do
		(
			if state do chkBox_zGreaterThan.state = false
		)
		on chkBox_zGreaterThan changed state do
		(
			if state do chkBox_zLessThan.state = false
		)
 
		on btn_select pressed do
		(
			objsArr = objects as array			
			objsToSelArr = #()
			for o in objsArr do
			(
				objSize = GetObjectSize o
				oXsize = abs objSize[1]
				oYsize = abs objSize[2]
				oZsize = abs objSize[3]
				if chkBox_xLessThan.checked do
				(
					if oXsize < spn_xSize.value do append objsToSelArr o
				)
				if chkBox_xGreaterThan.checked do
				(
					if oXsize > spn_xSize.value do append objsToSelArr o
				)
				if chkBox_yLessThan.checked do
				(
					if oYsize < spn_ySize.value do append objsToSelArr o
				)
				if chkBox_yGreaterThan.checked do
				(
					if oYsize > spn_ySize.value do append objsToSelArr o
				)
				if chkBox_zLessThan.checked do
				(
					if oZsize < spn_zSize.value do append objsToSelArr o
				)
				if chkBox_zGreaterThan.checked do
				(
					if oZsize > spn_zSize.value do append objsToSelArr o
				)
			)
			if objsToSelArr.count != 0 do select objsToSelArr	
		)
	)
	createdialog rol_selObjects width:150
)
EPXLSD's picture

YES!!!

MIAUU, It's perfect! Thank u BIG HUMAN very much! =)

EPXLSD

EPXLSD's picture

Nearly command: Select

Nearly command: Select Similar, but with current parameter. And i need to change it. For example select similar object with scale X > 30mm.

EPXLSD

Comment viewing options

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