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.

Problem with deleting all Helper Objects

Problem with deleting all Helper Objects

Anonymous
Not applicable
7,256 Views
9 Replies
Message 1 of 10

Problem with deleting all Helper Objects

Anonymous
Not applicable
Hey everybody,

when I import STEP files, I get a nice hierarchy of the assembly with helpers and stuff.

But i don't need all this and want to delete all helpers automatically by script.

The button for this looks like this:

on btnHelper pressed do
(
actionMan.executeAction 0 "40021" -- Selection: Select All
max unlink
for i in objects where superclassOf i == Helper do delete i
)


When I press the button I get the following error:

-- Error occurred in btnHelper.pressed(); filename: C:\Users\mediauser\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\usermacros\DragAndDrop-Macro4.mcr; position: 1734; line: 39
-- Frame:
>> MAXScript Rollout Handler Exception:
-- Unknown system exception <<


The weird thing is: When I execute just the first two lines of the button's function and then manually enter the third line - it works.
When I write it like above - it does not 😞


Just for explanation: I had to add the "unlink" inbetween because otherwise the "for"-loop wouldnt work for all dummy objects.

Thanks in advance!
0 Likes
7,257 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
Try

on btnHelper pressed do
(
max Select All
max unlink
for i in objects where superclassOf i == Helper do delete i
)


See if that makes a difference
0 Likes
Message 3 of 10

Steve_Curley
Mentor
Mentor
on btnHelper pressed do
(
max Select All
max Unlink
max Select None
delete Helpers
)

No need for a loop, if you want all helpers removed. Helpers is a built in collection, like Selection or Geometry. Delete is a "mapped function" so works on all objects in the collection.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 4 of 10

Anonymous
Not applicable
They say "you should learn something new everyday"
So i will buy that for a dollar 🙂
Nice tip Steve ta
0 Likes
Message 5 of 10

Steve_Curley
Mentor
Mentor
An e-beer will do 😉

You could also use a for..where...collect loop (if you only wanted a sub-set of Helpers) then do the delete on the resulting collection. Mapped functions like that are very useful 🙂

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 6 of 10

Anonymous
Not applicable
Always have A Cold one on standby
Here ya go 😛

0 Likes
Message 7 of 10

Steve_Curley
Mentor
Mentor
Cheers!!!

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 8 of 10

Anonymous
Not applicable
Works perfectly =D
Thank you very much!
0 Likes
Message 9 of 10

Anonymous
Not applicable
to unlink all objects you don't need select anything. just simply do:

objects.parent = undefined
0 Likes
Message 10 of 10

Anonymous
Not applicable

You can now do this without code in the Import Dialogue for STEP Files .
Use Hierarchy Mode "Flattened" or "Using Layer" and uncheck "keep dummy nodes".

In the Hierarchy Explorer you will be presented with a nice unsorted list of all the geometries, and geometries only 🙂


If you selected "Using Layer" you can still find the original hierarchy of the file in the Layer Explorer.

So neat! 
You can now create your own hierarchy but look back at the original one as well 🙂

0 Likes