Make 2D with color information

Hello,

I am trying to use Make 2D with colored objects. I dont have them in different layers so my Make 2D drawing is always black. I have too many geometry and each has a different color because they are an outcome of image sampling. So putting them to separate layers is no option. Is there a way to edit Make 2D function in script editors? Or any other easier solution?

Dear Omer
for a few hundred objects the attached script should work.
The script will create a layer for each selected object color - and set the Layercolor to the objects-color.

  • hide layer-panel before you run the script
  • try with small amount of objects first
  • use _make2d Command with option “maintain source layers”.
    (the color of the 2d-objects is now defined by the layer ! - you might want to change this with additional scripting)

If you have much more objects you should think about a 2d export as .eps / ai or using a .pdf writer. to get 2d-curves. Increase dpi also for better vector output.

hope that helps

best

t

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version Montag, 22. Juni 2015 00:36:25

Call Main()
Sub Main()
	Dim objs:objs = rhino.GetObjects("pick objs")
	If isnull(objs) Then Exit Sub

	Dim obji
	Dim layi
	Dim laynamei
	Call Rhino.EnableRedraw(False)
	For Each obji In objs
		laynamei = CStr(CStr(Rhino.ObjectColor(obji)))
		If Not (Rhino.IsLayer(laynamei)) Then
			Call Rhino.AddLayer(laynamei)
			Call Rhino.LayerColor(Laynamei,Rhino.ObjectColor(obji))
		End If
		Call Rhino.ObjectLayer(obji, laynamei)
	Next
	Call Rhino.EnableRedraw(True)
End Sub
1 Like

Hello Tom,

Thank you very much for your help. I was trying to do a similar script on python but I had doubts about amount of layers. Definitely this script will help a lot! I didn’t know that Rhino has additional pdf writers. tIf I select the cubes and export them illustrator treats them in “wireframe mode” so they wont have any fills. Is there a plugin that exports 3D data in vector format without making Make2D?

Thank you very much for your help.

install a .pdf printer / writer like free bullzip or commercial adobe acrobat distiller. Then via “_print”, choose vector output (only for wireframe), choose the pdf-writer, in printer Properties increase resolution to 600 or 1200 dpi to get better output.
maybe generate a high-res rendering and convert it back with illustrator or similar, if you need vectors.

i thought you need wireframe. make2d does not make fills / surfaces as fare as i know.

maybe you have to be more specific in the exact output you need

  • how many objects ?
  • 2d-style: fills ?, wireframe, hidden lines, etc…
  • next steps with the data ? do you really need vectors ?

best t

Hi Tom,

Thank you very much for your reply. I meant with wireframe that boxes are see through when it is directly exported as illustrator file, unlike make2d. I am using some js to make those make2d lines to fills in illustrator so that works out. Definitely the script that you gave me works and does what I need. With printing a pdf I imagined that rhino has an option to make the image on the screen as a vector image that has colored lines and fills.

Thank you,
Omer

5 years later, still works. Thanks @Tom_ for this little gem :), was super useful.