Need simple help for selecting new object made
I just recently started trying out maxscript, and tried to make my own tools for everyday work. I am really really new to this so pardon me if the question is stupid t.t
This is a clone detach alternative since the original EditablePoly.detachToElement do not work like when you pressed it in max and create a new object not in element.
How do i select the new created object without using its actual name like $.Top002
on DetachClone pressed do
(
a = uniquename "Top"
selectedFaces = polyop.getFaceSelection $
polyOp.detachFaces $ selectedFaces asnode:true node:$ delete:false name:(a)
subobjectlevel = 0
)
Comments
.
select objects[objects.count]
This will select last created object, i.e. the detached part.
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters
Thank you for the reply!
Thank you for the reply!
Thanks for the replies jahman
Thanks for the replies jahman and pixamoon !!
Waited quite a few days for the post to be approved by a moderator, and in that time i i managed to get it to work by do this:
on DetachClone pressed do
(
a = uniquename "Top"
selectedFaces = polyop.getFaceSelection $
polyOp.detachFaces $ selectedFaces asnode:true node:$ delete:false name:(a)
subobjectlevel = 0
b = $.name a
select b
)
Although it works, i do not know if its is good coding practice to do so
.
`
Hi,
It should be enough to use:
or if you want to get it as new variable without selecting
Best,
Pixamooon
I have a similar thing i am
I have a similar thing i am trying to accomplish, but cannot get the code to work for the life of me.
Im trying to create a script that can:
1. Take a selected editablepoly with many faces>
2. detach all faces as new editablepoly's
3. select all those newly created polys from detach command
4. add a uvwmap to those individual polys im not picky on the naming, and can probably handle the adding of uvwmap, but am stuck on selecting the polys from the detach faces script im using
below is the code im going from:
(
fn DetachAllFaces obj =
(
if classof obj == editable_poly do
(
local nf=obj.numfaces
while nf !=0 do
(
local newObjName=uniquename (obj.name+"_00")
polyop.detachFaces obj #(nf) delete:true asNode:true name:newObjName
centerpivot (getnodebyname newObjName)
nf=obj.numfaces
)
)
)
objs=for o in selection collect o
selcnt=objs.count
for i=1 to selcnt do
(
convertTo objs[i] Editable_Poly
DetachAllFaces objs[i].
delete objs[i]
)
)