ScriptSpot

Forum topic · General Scripting

COPY VERTEX ID IN CLIPBOARD.

By Nik · 2013-01-20

Downloads
Description

How to make for copy vertex-ID of several objects with Edit_poly modifer (by Tab forexample)?

copy vertex id

Comments (23)

Thank you very much for everything

Nik · 2013-01-21

Ok Thank you very much for everything. I hope I'm not too stop you. You surprised me with your compassion. Really nice :)

Error :) --Unknown system exception

Nik · 2013-01-21

As so

Now we talking :)

barigazy · 2013-01-21

Now i tested in max.

;)


macroScript Copy_VertsID ButtonText:"CopyVertsID" Category:"bga_Tools" Tooltip:"Copy V-ID To Clipboard"
(
local Clipboard = dotNetClass "Clipboard"
local obj = selection[1]
if obj != undefined and isKindOf obj Editable_Poly or isKindOf obj Editable_Mesh do
(
local vIDArr = obj.selectedverts as bitarray
local clipStr = ""
if vIDArr.numberset == 0 then messageBox "Select Some Verts First!" title:"Warning" beep:off else
(
for i in vIDArr do append clipStr (i as string + " ")
Clipboard.Clear()
Clipboard.SetDataObject clipStr true
)
)
)

Hi Nikolay

Anubis · 2013-01-21

I think that this come from the line:

on btnCopy pressed do

Maybe coincident copy/paste mistake. When Branko remove the rollout he forget to remove and the button event. So delete that line, or try with my edited code:

MacroScript mcr_VertIDToClipboard 
category:"bga_Tools" 
buttonText:"CopyVertsID" 
toolTip:"Verts ID To Clipboard"
(
	local obj = selection[1]
	if obj != undefined and \
	(isKindOf obj Editable_Poly or isKindOf obj Editable_Mesh) do
	(
		local vIDArr = obj.selectedVerts as bitArray
		if vIDArr.isEmpty then
			messageBox "Select Some Verts First!" title:"Warning" beep:off
		else
		(
			local clipStr = ""
			for i in vIDArr do append clipStr (i as string + " ")
			setclipboardText clipStr
		)
	)	
)

@Branko - wow, we posted at the same time! :)

barigazy · 2013-01-21

Hi Panayot,
yes, rollout lines of code i forget to remove.
By the way, nice mxs version.
Cheers!

Thanks for the response :)

Nik · 2013-01-21

Спасибо за отклик :)

Ещё :)

Nik · 2013-01-21

Ещё ошибки пошли :)
Why is that?

Attachments

barigazy · 2013-01-21

Sorry :)

 macroscript Copy_VertsID

I not have max in front of me.I use the cell phone.Lol
Теперь он должен работать :)

Aah, it's even I had to see :))) except that:

Nik · 2013-01-21

:)

Attachments

Here such error issue

Nik · 2013-01-21

I'm sorry for molestation
with drag & drop of macroscripr

Attachments

barigazy · 2013-01-21

Open the script and change first line of code to

macroscript "Copy_VertsID"

Branko, аnd without rollout make this script?

Nik · 2013-01-21

Schutcut only.

barigazy · 2013-01-22

Copy this file in macrscript folder.
You can find macro under category "bga_Tools"

Attachments

! You golden man, thank you very much!

Nik · 2013-01-21

works thanks!

:)

barigazy · 2013-01-21

Ok. My pleasure
Cheers!

edit

barigazy · 2013-01-21

About data output

--if you using this line
i as string + " "
--then the output (after paste) will look like this
result > 10 12 54 668 44 454 454 ...
--or if you change to
i as string + "\n"
--then the output will look
result >
10
12
54
668
...

Nik · 2013-01-21

Branko friend, help me.
And the rollout inappropriately
let it be only shotcut

barigazy · 2013-01-21

Select en EditPoly or EditMesh object, pick some verts and press the button. Then just past data in any text editor

try(destroyDialog ::test)catch()
rollout test "Copy V-ID To Clipboard"
(
fn filterGeom geo = isKindOf geo Editable_Poly or isKindOf geo Editable_Mesh

button btnCopy "Copy Vertex ID" width:146

local Clipboard = dotNetClass "Clipboard"
--local sysStr = dotNetClass "System.String"
on btnCopy pressed do
(
local obj = selection[1]
if obj != undefined and filterGeom obj do
(
local vIDArr = obj.selectedverts as bitarray
local clipStr = ""
if vIDArr.numberset == 0 then messageBox "Select Some Verts First!" title:"Warning" beep:off else
(
for i in vIDArr do append clipStr (i as string + " ")
Clipboard.Clear()
Clipboard.SetDataObject clipStr true
)
)
)
)
createDialog test 150 30

That's how it looked (I created a gif, look)

Nik · 2013-01-21

No text display is certainly not required (such as "Copy Vertex ID to Clipboard").
And showing vertex id is also not necessary - it is, I have, as seen.
Operation is simply copy-paste Vertex ID
Many thanks for your reply

Attachments

try this

barigazy · 2013-01-21


rollout test "Copy V-ID To Clipboard"
(
	fn filterGeom geo = isKindOf geo Editable_Poly or isKindOf geo Editable_Mesh
	
	button btnCopy "Copy Vertex ID" width:146
 
	local Clipboard = dotNetClass "Clipboard"
	on btnCopy pressed do 
	(
		local selSet = getCurrentSelection()
		clearSelection()
		if selSet.count != 0 do
		(
			if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
			with redraw off 
			(
				for obj in selSet where filterGeom geo do
				(
					clipStr = ""
					vIDArr = obj.selectedverts as bitarray
					if vIDArr.numset != 0 do 
					(
						for i in vIDArr do append clipStr (i as string + " ")
						Clipboard.Clear()
						Clipboard.SetText clipStr
					)
				)
			)
		)
		--select selSet
		free selSet
	)
)
createDialog test 150 30 fgcolor:yellow

Similal script you can find here
http://www.scriptspot.com/forums/3ds-max/scripts-wanted/object-name-to-c…

It's not work

Nik · 2013-01-21

Does not work, please, help me please
I think the remnants of my code muddled

start

barigazy · 2013-01-20

I will start like this and you need to tell me what's next :)

fn filterGeom geo = isKindOf geo Editable_Poly or isKindOf geo Editable_Mesh
selSet = getCurrentSelection()
clearSelection()
if selSet.count != 0 do
(
if getCommandPanelTaskMode() != #create do setCommandPanelTaskMode mode:#create
with redraw off
(
for obj in selSet where filterGeom geo do
(
--???
)
)
)
select selSet
free selSet

barigazy · 2013-01-20

Please explain better what you exactly want to achive?