Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

If sel = isGroupMember then... Else failing

If sel = isGroupMember then... Else failing

Anonymous
Not applicable
699 Views
2 Replies
Message 1 of 3

If sel = isGroupMember then... Else failing

Anonymous
Not applicable

Hi all,

So close to finishing my script now but I have this odd issues happening, I can array a single mesh on selection (x,y,z values determined by spinners) and I can now array a group on selection thanks to @miauuuu but for some reason if I drop my single selection array as the else of an if statement, it fails to know what I am selecting... can anyone help me out here?

It's the 'Else' that always fails here... example message "No "Select" function for false"

on PickFillMesh picked sel do
	(
		---------- Set Group Selection
			
		local SelectedGroupHead = (FindGroupHead sel)
		
		if sel = isGroupMember sel then
		(	
		---------- Get Selected Group Dimensions
		SelectedGroupHead.pivot = SelectedGroupHead.center
		SelectedGroupHead.pivot.z = SelectedGroupHead.min.z
		FillGroupWidth = (SelectedGroupHead.max - SelectedGroupHead.min).x
		FillGroupLength = (SelectedGroupHead.max - SelectedGroupHead.min).y
		FillGroupHeight = (SelectedGroupHead.max - SelectedGroupHead.min).z	
			
		if MoveToPallet.state == true then
		(			
		SelectedGroupHead.pos =  [0-PalletWidth/2-(0-FillGroupWidth/2),0-PalletLength/2-(0-FillGroupLength/2),149]
		)	
		
			---------- Clone Selected Group and Position
			
			for HeightAmount = 1 to StackHeight.value do
			(
				for LenghtAmount = 1 to StackLength.value do
				(
					for WidthAmount = 1 to StackWidth.value do
					(
						pos_z = ((HeightAmount-1) * FillGroupHeight)
						
						pos_y = ((LenghtAmount-1) * FillGroupLength)
					
						pos_x = ((WidthAmount-1) * FillGroupWidth)
						
						maxOps.cloneNodes SelectedGroupHead cloneType:#instance offset:[pos_x, pos_y, pos_z]
					)
				)
			)
			
				--delete original group
				delete SelectedGroupHead
			
		)
		else 
		(
			---------- Set Selection
		Select sel
		
		---------- Get Selected Mesh Dimensions
		FillMeshWidth = (sel.max - sel.min).x
		FillMeshLength = (sel.max - sel.min).y
		FillMeshHeight = (sel.max - sel.min).z
		
		---------- Clone Selected Mesh
		
		for HeightAmount = 1 to StackHeight.value do
			(
				for LenghtAmount = 1 to StackLength.value do
				(
					for WidthAmount = 1 to StackWidth.value do
					(
						pos_z = ((HeightAmount-1) * FillMeshHeight)
						
						pos_y = ((LenghtAmount-1) * FillMeshLength)
					
						pos_x = ((WidthAmount-1) * FillMeshWidth)
						
						FillMesh = copy sel pos:[pos_x, pos_y, pos_z] 
				
					)
				)
			)
		)
	
	)

 

0 Likes
Accepted solutions (1)
700 Views
2 Replies
Replies (2)
Message 2 of 3

Swordslayer
Advisor
Advisor
Accepted solution

It's exactly what's in the title of your post that's the problem, sel = isGroupMember sel assigns true/false to the sel variable, you wanted just if isGroupMember sel then...

0 Likes
Message 3 of 3

Anonymous
Not applicable

What was it Homer Simpson used to say...

Doh!

Thanks Swordslayer, thats the jobby 😉

0 Likes