Notifications
Clear all

[Closed] Batchscript with Ribbon Tools

Hello everybody,

I have to include a file from vectorworks -> C4D -> FBX. Most of these information are fine. But the windows seems broken since export from vectorworks. So its a easy thing.

I just need to select a window-object, weld down the vertices and do “Cap Poly” at the Graphite Tools.

The problem is, there are around 1000 such objects in this scene…
So I need a script which cycles through my selected objects and “cap poly” all of them.

I tried something, but it doesn’t work.

      for obj in selection do
		(
	                allVerts = #{1..4}
			max modify mode
			subObjectLevel = 1
			actionMan.executeAction 0 "40021" -- Selection: Select All
			PolyToolsModeling.CreateFace allVerts
		)

Can someone hint me in the right direction, please? Thank you

6 Replies

You can try subobjectlevel = 3(border) and then use the Cap to create new face.


(
	selObjsArr = selection as array
	max modify mode
	for o in selObjsArr do
	(
		select o
		subobjectlevel = 3
		max select all
		o.capHoles #Edge
	)
)

Hi Miauu,

capHoles with edge does not work because there are no edges, just vertices.

But I modified your Script with my approach and its working! But you have to be careful because 1000 objects seems way to much for this single thread oldschool maxscript thing to be calculated at once! So I did it with some smaller Sets and everything is nice and fine!

(
	selObjsArr = selection as array
	max modify mode
	for o in selObjsArr do
	(
		select o
		subObjectLevel = 1 --switch to Vertex level
		allVerts = #{1..4} -- (polyop.getNumVerts obj)
		actionMan.executeAction 0 "40021" -- Selection: Select All
		PolyToolsModeling.CreateFace allVerts
	)
)

It also seems to stuck with over 200 objects. Is there any approach to speed this up somehow? Using a secret hidden 64 bit multithreading code? Is there a way to convert this to MCG or something like this?

Edit: I’ve read about the selectmore-operator and it shoul have 3000x more speed than normal select. But in the abovescript I guess it should fit somehow in the array collection. How to achieve this? Sorry, I am just a beginner in maxscript.

Edit2: I was able to melt it down a bit.

(
	selObjsArr = selection as array

	for o in selObjsArr do
	(
		selectmore o
		subObjectLevel = 1 --switch to Vertex level
		polyOp.createPolygon $ #(1,2,3,4)
	)
)

And it seems to work, but slowly. Maybe I am just a little bit to impatient in times of 64 bit multithreaded operations in any other software on this planet

Not sure if you will or not, but you might get a speed increase by turning off scene/viewport redraw.

Turn off the scene redraw, search the forum of how to disable command pannel flickering, and use SELECT onstead of SELECT MORE. The script needs to select the object, so the commands to works properly. There is no need to use Select More instead.

If that code worked for you, try this:

(
  	for j in selection where iskindof j editable_poly do polyop.createpolygon j #(1,2,3,4)
  	completeredraw()
  )