Hi guys,
I'm trying to make a script that basically converts whatever you have selected (faces, edges etc) to verts if you have something selected like a face or something.
But if you don't have nothing selected or are in vert mode it won't do anything, and will leave the object.
So far I have this.
macroScript ConvertToVertOrExit
category:"Pedro Scripts"
toolTip:"Converts Selection to verts or exits the object"
(
try
(
if (subobjectlevel >= 1) then
(
macros.run "Editable Polygon Object" "EPoly_Convert_Sel_To_Vertex"
)
if (subobjectlevel == 1) then
(
subobjectLevel = 0
clearSelection()
)
if (subobjectlevel == 0) then
(
)
if ( $ != undefined) then
(
modPanel.setCurrentObject $
subobjectLevel = 1
)
)
catch()
)
Any help is appreciated.
I guess i need a code to see if ihave something selected.
Thanks!
Pedro
Comments (3)
Comment policy
Try now.
Hey barigazy,
Thanks for replying.
Unfortunately it doesn't work. If you are on vert mode or don't have anything selected it won't leave the object.
Try this one. Supports Editable Poly object and Edit Poly modifier
macroScript ConvertToVertOrExit
category:"Pedro Scripts"
toolTip:"Converts Selection to verts or exits the object"
(
if selection.count == 1 do
(
node = case classof selection[1] of
(
(PolyMeshObject): selection[1].modifiers[1]
(Editable_Poly): selection[1]
default: (undefined ; clearselection())
)
if node == undefined then messageBox "This object is not supported!" title:"Warning" beep:off else
(
array = #(#Edge,#Border,#Face,#Element)
if (e = finditem array (node.GetEPolySelLevel())) == 0 then clearselection() else
(node.convertSelection array[e] #Vertex ; subobjectLevel = 1)
)
)
)