Script for changing printwidth, print color and linetype to "by layer" for all obejcts inside blocks


I have a lot of blocks for different 2D furniture that has been gathered from different files. When I want to print a PDF of my plans all the print width settings I applied to the layers are overruled by the individual settings for objects inside the different blocks. I’m looking for a script that allow you to change Print Width properties for all objects inside all blocks to be “by layer”. This way you wouldn’t have to enter every single block and change it manually.

Does anyone have a solution to this?

1 Like

Bumping this - really could do with this at the moment

I cobbled together a Rhinoscript which does this - hope this helps anyone else in need!

It’s not super fast on large drawings with lots of blocks.

Option Explicit

Call SetBlockObjectsByLayer()
Sub SetBlockObjectsByLayer()
	Dim blockNames
	blockNames = Rhino.BlockNames(True)
	If (Not IsArray(blockNames)) Then
		Exit Sub
	End If

	Dim blockName
	For Each blockName In blockNames
		Dim blockObjects
		blockObjects = Rhino.BlockObjects(blockName)
		If IsArray(blockObjects) Then
			Call Rhino.ObjectColorSource(blockObjects, 0)
			Call Rhino.ObjectLinetypeSource(blockObjects, 0)
			Call Rhino.ObjectPrintColorSource(blockObjects, 0)
			Call Rhino.ObjectPrintWidthSource(blockObjects, 0)
			Call Rhino.ObjectMaterialSource(blockObjects, 0)
			Call Rhino.ObjectLayer(blockObjects, "Block Elements")
		End If
End Sub