Community
3ds Max Forum
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extract operand from boolean

20 REPLIES 20
SOLVED
Reply
Message 1 of 21
Anonymous
8557 Views, 20 Replies

Extract operand from boolean

Hello everyone,

 

the new functionality of Boolean in 3dsMax 2017 seems nice, but I miss the old functionality with being able to extract operands from the boolean (I can only remove them, so they are gone). I also miss the function to add operands as "Instance" instead of "Move". 

 

Has the feature been removed from the program?

 

It was very handy to use the same object for subtraction on multiple objects.

Is this function still present, or is there a workaround for it?

 

Thank you!

20 REPLIES 20
Message 2 of 21
Swordslayer
in reply to: Anonymous

The Extract functionality was removed from the UI (the reasoning behind that was that now that the objects added to boolean remain in scene, only hidden, there's no need - I can't quite agree with that, though). As a workaround, you can extract all objects used in the Boolean compound as instances by selecting the Boolean object and running

 

select (for obj in $.objects collect mesh baseObject:(obj[1].value))

It will select the extracted objects, so you can isolate the selection and delete those that you don't need.

 

Also be sure to watch the new boolean tips&tricks if you haven't already.

Message 3 of 21
Alfred.DeFlaminis
in reply to: Anonymous

Hello @Anonymous,

 

Did @Swordslayer's suggestion help here?   It takes a bit of getting used to but now that I'm used to it I am enjoying it.  I iterate on save a lot so I can always go back and grab it pre-boolean if I've deleted it from the scene after boolean.  

 

To answer your question though, yes it was removed from booleans.  If you want to use that old behavior, check out the pro boolean as it retains those features.  Does that work for you?

 

Best Regards,

Message 4 of 21
Anonymous
in reply to: Alfred.DeFlaminis

Dear Alfred,

 

Thank you for your answer!

 

Yes, I figured out, the ProBoolean still works the same way. But I experienced Boolean works much faster for certain objects. For example in objects which have a lot of separate unwelded geometry elements in it, ProBoolean works very slow. So I must use Boolean in these situations.

 

IMHO I think for a fast workflow you should be able to extract the operands. 

For example if I had to make more versions of a concept, easily duplicating operators was a very good thing.

I also think, editing the elements in real time was possible before as well, wasn't it? I could edit them real time, either I could select the element from the Boolean's stack. Or even better, if I added them as Instance, I could edit it, and see the changes in real time.

 

Now, before using Boolean, I always have to make an instance of the operand, and move it onto a hidden layer to be able to do this. And if I forgot to duplicate it, it really slows down the workflow.

 

Anyways, I sure can get used to it, but it would be nice, if there was a function which extracts an instance of the operand, and places it in the same position.

What you mentioned @Swordslayer, works Thank you! But it places and rotates the elements aligned to the origin. This also slows down the workflow a bit, but it can be an alternative solution.

 

Message 5 of 21
Swordslayer
in reply to: Anonymous


@Anonymous wrote:

Now, before using Boolean, I always have to make an instance of the operand, and move it onto a hidden layer to be able to do this. And if I forgot to duplicate it, it really slows down the workflow.


It does that automatically, not a hidden layer though, it creates an instance of the operand and simply hides it. Check the Unhide By Name contents after adding an operand (or have a scene explorer open just like in the video; seriously, check it). The problems that arise are bound to happen if you merge just the boolean object or do a scene cleanup. Then, having an Extract option would be better.


@Anonymous wrote:

Anyways, I sure can get used to it, but it would be nice, if there was a function which extracts an instance of the operand, and places it in the same position.

What you mentioned @Swordslayer, works Thank you! But it places and rotates the elements aligned to the origin. This also slows down the workflow a bit, but it can be an alternative solution.


Oh, my mistake, sorry, I assumed it does the same as Sweep modifier does with profile shapes, i.e. it extracts an instance at the origin.

This will only work correctly for objects that are in the top level (i.e. not nested in a SubBoolean group):

 

if isKindOf $ Boolean3 do
(
	local objs = $.objects
	local TMs = $.operand_tm

	local nodes = for i = 1 to objs.count collect 
		mesh baseObject:objs[i][1].value transform:(TMs[i].value * $.objectTransform)

	select nodes
)
Message 6 of 21
Anonymous
in reply to: Swordslayer

Sorry, I misunderstood you then, and I was not able to check the tutodial yet.

So I can always reach the operands as hidden instance objects. This is great, thank you!

Message 7 of 21
Alfred.DeFlaminis
in reply to: Anonymous

Hello @Anonymous,

 

You're right I can confirm this, my mistake.  My error was that I wasn't in instance mode before.  I edited my post so as not to confuse the issue for future users.  One way to get this idea across is to put in a feature request, if you'd like.  

 

I have included a link to this thread for you in a logged Improvement case in our tracker about extracting operands, so combined with the feature request you are getting maximum exposure for your idea.  I am happy to do this for you and I wish you the best.

 

Best Regards,

Message 8 of 21

Thank you for this script. It does indeed extract the operands, but the transforms do not translate, therefore not ideal. If the compound object has been scaled, rotated, or moved, the extracted objects do not align with the boolean compound object and therefore very difficult to edit with any meaningful real-time relationship to the compound object.

 

The extract function is invaluable in previous versions. It keeps all the operands in a self-contained unit, and the operands are extracted and aligned perfectly to the compound object with all the transforms, etc. The new functionality of simply hiding the operands is ridiculously cumbersome and not workable for complex scenes....

 

Sometimes proboolean does not work properly, and boolean is a better option. I am very frustrated by this development, to the point where am very close to going back to V2016. Please Autodesk, put the extract functionality back into the boolean object (and the cut would be nice too).

Message 9 of 21

I couldn't agree more. Boolean sometimes works better than pro and is an asset to keep, but not having extract operand is useless for a design workflow. Please fix.

 

I also tried finding the hidden operand and could not locate it in scene explorer of unhide by name. What am I missing?

Message 10 of 21

This topic is not solved. Removing the extract operand function from boolean (and it not being available in the new shapeboolean) devalues these compound objects substantially.

 

PLEASE can someone help to provide a workaround if autodesk does not plan to do anything about this!?

 

The script created earlier in this thread works well to extract the operands, but it places them at the origin and not aligned to the boolean object....thanks in advance!!!

Message 11 of 21

No, the script in the accepted answer extracts the operands with the transform applied. All you need to do to make it work with shape booleans is replace Boolean3 with ShapeBooleanObject.

Message 12 of 21

AWESOME!!!!! Thank you for clarifying @Swordslayer ! It works great!

 

Problem SOLVED!!!

Message 13 of 21

Can someone help me to turn this script into a macroscript? I want to be able to add it into my quad menu.

 

I changed the extension to .mcr and added the following lines to the beginning of the code, but now I am getting syntax errors.

 

macroScript Boolean_Extract_Operand
category: "PFS"

if isKindOf $ Boolean3 do
(
local objs = $.objects
local TMs = $.operand_tm

local nodes = for i = 1 to objs.count collect
mesh baseObject:objs[i][1].value transform:(TMs[i].value * $.objectTransform)

select nodes
)

Message 14 of 21

macroScript Boolean_Extract_Operand
buttonText:"Booleans - Extract Operand"
tooltip:"Booleans - Extract Operand"
category: "PFS"
(
	fn isValidBoolObj obj = isKindOf obj Boolean3 or isKindOf obj ShapeBooleanObject

	on isEnabled do isValidBoolObj $
	on execute do if isValidBoolObj $ do
	(
		local objs = $.objects
		local TMs = $.operand_tm

		local nodes = for i = 1 to objs.count collect 
			mesh baseObject:objs[i][1].value transform:(TMs[i].value * $.objectTransform)

		select nodes
	)
)
Message 15 of 21

THANK YOU @Swordslayer !!!!

 

Works like a charm, and it is great you incorporated shapeboolean as well.

 

I LOVE THIS COMMUNITY!!!

 

PROBLEM SOLVED!

Message 16 of 21
Jixal
in reply to: peter.sherrill

This is really cool. Thanks for providing a great little script. 

 

Although it seems a bit crazy to have to hunt through the internet to be able to do a simple action that was once freely given in the UI. Seems a bit of a backwards step.

Message 17 of 21
Anonymous
in reply to: Swordslayer

Thank you for your script. Would it also be possible to extract only the selected operand ?

Message 18 of 21
Swordslayer
in reply to: Anonymous

macroScript Boolean_Extract_SelOperand
	buttonText:"Booleans - Extract Selected Operand"
	tooltip:"Booleans - Extract Selected Operand"
	category: "PFS"
(
	local LB_GETSEL = 0x187
	local LB_GETCOUNT = 0x18B
	local iGlobal = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
	
	fn getListBoxItemCount hWnd =
		windows.sendMessage hWnd LB_GETCOUNT 0 0

	fn isListBoxItemSelected hWnd index =
		windows.sendMessage hWnd LB_GETSEL index 0 > 0

	fn isValidBoolObj obj = isKindOf obj Boolean3 or isKindOf obj ShapeBooleanObject

	on isEnabled do isValidBoolObj (modPanel.getCurrentObject())
	on execute do if isValidBoolObj  (modPanel.getCurrentObject()) do
	(
		local obj = modPanel.getCurrentObject()
		local cpHWnd = iGlobal.UtilGetCoreInterface.CommandPanelRollup.HWnd
		local cpChildren = windows.getChildrenHWnd cpHWnd
		local listBoxHWnd = for child in cpChildren
			where UIAccessor.getWindowResourceID child[1] == 1020 do
				exit with child[1]

		if isKindOf listBoxHWnd Number do
		(
			local objs = obj.objects
			local TMs = obj.operand_tm
			local opName, itemCount = getListBoxItemCount listBoxHWnd

			local selItems = for i = 0 to itemCount - 1 where isListBoxItemSelected listBoxHWnd i collect i + 1
			select (for i in selItems collect mesh baseObject:objs[i][1].value transform:(TMs[i].value * $.objectTransform))
		)
	)
)
Message 19 of 21
Anonymous
in reply to: Swordslayer

Works Perfectly. Thank you very much!

Message 20 of 21
ROM_RRR
in reply to: Anonymous

@SwordslayerHUGE thank you! Could the selected operand be extracted with its material?

P.S. I frankly don't understand how Booleans could be published without ability to edit an operand WHILE seeing the end result.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report